Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkFEMSolver.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkFEMSolver.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/02/26 20:25:53 $
00007   Version:   $Revision: 1.24 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 
00018 #ifndef __itkFEMSolver_h
00019 #define __itkFEMSolver_h
00020 
00021 #include "itkFEMElementBase.h"
00022 #include "itkFEMMaterialBase.h"
00023 #include "itkFEMLoadBase.h"
00024 
00025 #include "itkFEMLinearSystemWrapper.h"
00026 #include "itkFEMLinearSystemWrapperVNL.h"
00027 
00028 #include "itkImage.h"
00029 
00030 namespace itk {
00031 namespace fem {
00032 
00041 class Solver 
00042 {
00043 public:
00044 
00048   typedef Element::Float Float;
00049 
00054   typedef Element::ArrayType ElementArray;
00055   ElementArray el;
00056 
00060   typedef Node::ArrayType NodeArray;
00061   NodeArray node;
00062 
00066   typedef Load::ArrayType LoadArray;
00067   LoadArray load;
00068 
00072   typedef Material::ArrayType MaterialArray;
00073   MaterialArray mat;
00074 
00078   typedef Element::VectorType VectorType;
00079 
00090   itkStaticConstMacro(MaxGridDimensions, unsigned int, 3);
00091 
00095   typedef itk::Image<Element::ConstPointer,MaxGridDimensions> InterpolationGridType;
00096 
00111   void InitializeInterpolationGrid(const VectorType& size, const VectorType& bb1, const VectorType& bb2);
00112 
00116   void InitializeInterpolationGrid(const VectorType& size)
00117   {
00118     InitializeInterpolationGrid(size, VectorType(size.size(),0.0), size-1.0);
00119   }
00120 
00131   const InterpolationGridType * GetInterpolationGrid(void) const
00132   { return m_InterpolationGrid.GetPointer(); }
00133 
00142   const Element * GetElementAtPoint(const VectorType& pt) const;
00143 
00147   void Read( std::istream& f );
00148   
00152   void Write( std::ostream& f );
00153 
00157   virtual void Clear( void );
00158 
00159 
00168   void GenerateGFN( void );
00169             
00173   void AssembleK( void );
00174 
00181   virtual void InitializeMatrixForAssembly(unsigned int N);
00182 
00188   virtual void FinalizeMatrixAfterAssembly( void )
00189   {
00190     // Apply the boundary conditions to the K matrix
00191     this->ApplyBC();
00192   };
00193 
00200   virtual void AssembleElementMatrix(Element::Pointer e);
00201 
00215   void ApplyBC(int dim=0, unsigned int matrix=0);
00216   
00224   void AssembleF(int dim=0);
00225 
00229   void DecomposeK( void );
00230 
00234   virtual void Solve( void );
00235 
00240   void UpdateDisplacements( void );
00241 
00242   Float GetSolution(unsigned int i,unsigned int which=0)
00243   {
00244     return m_ls->GetSolutionValue(i,which);
00245   }
00246 
00247   unsigned int GetNumberOfDegreesOfFreedom( void )
00248   {
00249     return NGFN;
00250   }
00251 
00253   Float GetDeformationEnergy(unsigned int SolutionIndex=0);
00254 
00255 public:
00260   Solver();
00261 
00265   virtual ~Solver() {}
00266 
00281   void SetLinearSystemWrapper(LinearSystemWrapper::Pointer ls);
00282 
00288   LinearSystemWrapper::Pointer GetLinearSystemWrapper() { return m_ls; }
00289 
00294   virtual void InitializeLinearSystemWrapper(void);
00295 
00299   virtual Float GetTimeStep( void ) const { return 0.0; }
00300 
00306   virtual void SetTimeStep(Float) {}
00307 
00308 protected:
00309 
00313   unsigned int NGFN;
00314 
00319   unsigned int NMFC;
00320 
00322   LinearSystemWrapper::Pointer m_ls;
00323 
00324 private:
00325 
00329   LinearSystemWrapperVNL m_lsVNL;
00330 
00336   InterpolationGridType::Pointer m_InterpolationGrid;
00337 
00338 };
00339 
00340 
00341 
00342 
00343 }} // end namespace itk::fem
00344 
00345 #endif // #ifndef __itkFEMSolver_h

Generated at Fri May 21 01:14:46 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000