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/09/10 14:29:44 $ 00007 Version: $Revision: 1.26 $ 00008 00009 Copyright (c) Insight Software 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 00209 virtual void AssembleLandmarkContribution(const Element::Pointer e, float); 00210 00224 void ApplyBC(int dim=0, unsigned int matrix=0); 00225 00233 void AssembleF(int dim=0); 00234 00238 void DecomposeK( void ); 00239 00243 virtual void Solve( void ); 00244 00249 void UpdateDisplacements( void ); 00250 00251 Float GetSolution(unsigned int i,unsigned int which=0) 00252 { 00253 return m_ls->GetSolutionValue(i,which); 00254 } 00255 00256 unsigned int GetNumberOfDegreesOfFreedom( void ) 00257 { 00258 return NGFN; 00259 } 00260 00262 Float GetDeformationEnergy(unsigned int SolutionIndex=0); 00263 00264 public: 00269 Solver(); 00270 00274 virtual ~Solver() {} 00275 00290 void SetLinearSystemWrapper(LinearSystemWrapper::Pointer ls); 00291 00297 LinearSystemWrapper::Pointer GetLinearSystemWrapper() { return m_ls; } 00298 00303 virtual void InitializeLinearSystemWrapper(void); 00304 00308 virtual Float GetTimeStep( void ) const { return 0.0; } 00309 00315 virtual void SetTimeStep(Float) {} 00316 00317 protected: 00318 00322 unsigned int NGFN; 00323 00328 unsigned int NMFC; 00329 00331 LinearSystemWrapper::Pointer m_ls; 00332 00333 private: 00334 00338 LinearSystemWrapperVNL m_lsVNL; 00339 00345 InterpolationGridType::Pointer m_InterpolationGrid; 00346 00347 }; 00348 00349 00350 00351 00352 }} // end namespace itk::fem 00353 00354 #endif // #ifndef __itkFEMSolver_h

Generated at Sun Apr 1 02:28:25 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000