ITK FEM Modifications

From KitwarePublic
Revision as of 14:01, 18 March 2011 by Vmagnotta (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This page describes the changes being made to the ITK FEM framework. The current repository for this work is hosted on github


Solver

  • Derive from ProcessObject and template over dimension
    • template <unsigned int VDimension = 3> class ITK_EXPORT Solver1 : public ProcessObject
  • Remove all I/O from Solver
  • Use SetInput() and GetOutput() methods to set the FE problem and to get the deformed mesh
  • Update() method will execute the Solver
  • Retain the following methods
    • SetLinearSystemWrapper()
    • GetLinearSystemWrapper()
    • GetElementAtPoint()
    • GetDeformationEnergy()
    • SetTimeStep()
    • GetSolution()

FEMObject

A new object type was added, itk::fem::FEMObject, that is used to define the FEM problem. The class derives from DataObject and is templated over dimension.

  • template <unsigned int VDimension = 3> class ITK_EXPORT FEMObject : public DataObject
  • Class Methods
    • GetNumberOfDegreesOfFreedom()
    • GetNumberOfMultiFreedomConstraints()
    • GetNumberOfNodes
    • GetNumberOfElements
    • GetNumberOfLoads(void)
    • GetNumberOfMaterials(void)
    • AddNextElement(Element::Pointer e)
    • InsertElement(Element::Pointer e, ElementIdentifier index)
    • AddNextNode(Node::Pointer e)
    • InsertNode(Node::Pointer e, NodeIdentifier index)
    • AddNextMaterial(Material::Pointer mat)
    • InsertMaterial(Material::Pointer e, MaterialIdentifier index)
    • AddNextLoad(Load::Pointer ld)
    • InsertLoad(Load::Pointer ld, LoadIdentifier index)
    • GetElement(ElementIdentifier index)
    • GetElementWithGlobalNumber(int globalNumber)
    • GetNode(NodeIdentifier index)
    • GetNodeWithGlobalNumber(int globalNumber)
    • GetMaterial(MaterialIdentifier index)
    • GetMaterialWithGlobalNumber(int globalNumber)
    • GetLoad(LoadIdentifier index)
    • GetLoadWithGlobalNumber(int globalNumber)
    • RenumberNodeContainer()
    • FinalizeMesh()

FEMSpatialObject

This class provides a spatial object wrapper around the FEMObject. This class facilities the I/O which is now supported by the MetaIO library.

Using FEM Framework

 const unsigned int Dimension = 3;
 typedef itk::SpatialObject<Dimension>         SpatialObjectType;
 typedef SpatialObjectType::Pointer            SpatialObjectPointer;

 // Read the FEM Problem
 typedef itk::SpatialObjectReader<Dimension>    SpatialObjectReaderType;
 typedef SpatialObjectReaderType::Pointer            SpatialObjectReaderPointer;
 SpatialObjectReaderPointer SpatialReader = SpatialObjectReaderType::New();
 SpatialReader->SetFileName( argv[1] );
 SpatialReader->Update();

 typedef itk::FEMObjectSpatialObject<Dimension>    FEMObjectSpatialObjectType;
 typedef FEMObjectSpatialObjectType::Pointer       FEMObjectSpatialObjectPointer;
 FEMObjectSpatialObjectType::Pointer femSO = 
      dynamic_cast<FEMObjectSpatialObjectType*>((*(children->begin())).GetPointer());
 femSO->GetFEMObject()->FinalizeMesh();

 
 // Solve FEM Problem
 typedef itk::fem::Solver1<Dimension>    Solver3DType;
 Solver3DType::Pointer solver = Solver3DType::New();
 solver->SetInput( femSO->GetFEMObject() );
 solver->Update( );
 

 // Write the solution - (i.e. deformed mesh)
 FEMObjectSpatialObjectType::Pointer femSODef = FEMObjectSpatialObjectType::New();
 femSODef->SetFEMObject(solver->GetOutput());

 typedef itk::SpatialObjectWriter<Dimension>  SpatialObjectWriterType;
 typedef SpatialObjectWriterType::Pointer     SpatialObjectWriterPointer;
 SpatialObjectWriterPointer SpatialWriter = SpatialObjectWriterType::New();
 SpatialWriter->SetInput(femSODef);
 SpatialWriter->SetFileName( argv[2] );
 SpatialWriter->Update();

Ongoing Work

  • Remove old FEM Factory infrastructure
  • Finalize how to handle Image derived loads
  • Update FEM Registration
  • Merge with Modular ITK
  • Further code cleanup and testing