ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkFEMObject.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkFEMObject_h
19 #define __itkFEMObject_h
20 
21 #include "itkDataObject.h"
22 
23 #include "itkFEMElementBase.h"
26 #include "itkFEMLoadBase.h"
27 #include "itkFEMLoadNode.h"
28 #include "itkFEMLoadBC.h"
29 #include "itkFEMLoadBCMFC.h"
30 #include "itkFEMLoadEdge.h"
31 #include "itkFEMLoadGrav.h"
32 #include "itkFEMLoadLandmark.h"
33 #include "itkFEMMaterialBase.h"
35 #include "itkVectorContainer.h"
36 
37 namespace itk
38 {
39 namespace fem
40 {
73 template <unsigned int VDimension = 3>
74 class ITK_EXPORT FEMObject : public DataObject
75 {
76 public:
78  typedef FEMObject Self;
82 
84  itkNewMacro(Self);
85 
87  itkTypeMacro(FEMObject, DataObject);
88 
89  itkStaticConstMacro(FEMDimension, unsigned int, VDimension);
90  itkStaticConstMacro(MaxDimensions, unsigned int, 3);
91 
92  typedef unsigned long ElementIdentifier;
93  typedef unsigned long NodeIdentifier;
94  typedef unsigned long LoadIdentifier;
95  typedef unsigned long MaterialIdentifier;
96 
102 
112 
114  typedef typename
116  typedef typename
118  typedef typename
120  typedef typename
122  typedef typename
124  typedef typename
126  typedef typename
128  typedef typename
130 
131  // Copy the contents
132  void DeepCopy(FEMObject *Copy);
133 
134  // Get methods to get the entire VectorContainers for Elements, Nodes, Loads, and Materials
135  itkGetObjectMacro(ElementContainer, ElementContainerType);
136  itkGetObjectMacro(NodeContainer, NodeContainerType);
137  itkGetObjectMacro(LoadContainer, LoadContainerType);
138  itkGetObjectMacro(MaterialContainer, MaterialContainerType);
139 
141  unsigned int GetNumberOfDegreesOfFreedom(void) const
142  {
143  return m_NGFN;
144  }
145 
147  unsigned int GetNumberOfMultiFreedomConstraints(void) const
148  {
149  return m_NMFC;
150  }
151 
153  unsigned int GetNumberOfNodes(void) const
154  {
155  return m_NodeContainer->Size();
156  }
157 
159  unsigned int GetNumberOfElements(void) const
160  {
161  return m_ElementContainer->Size();
162  }
163 
165  unsigned int GetNumberOfLoads(void) const
166  {
167  return m_LoadContainer->Size();
168  }
169 
171  unsigned int GetNumberOfMaterials(void) const
172  {
173  return m_MaterialContainer->Size();
174  }
175 
179  void AddNextElement(Element::Pointer e);
180 
184  void InsertElement(Element::Pointer e, ElementIdentifier index);
185 
189  void AddNextNode(Element::Node::Pointer e);
190 
194  void InsertNode(Element::Node::Pointer e, NodeIdentifier index);
195 
199  void AddNextMaterial(Material::Pointer mat)
200  {
201  this->AddNextMaterialInternal(mat.GetPointer());
202  }
203  void AddNextMaterial(MaterialLinearElasticity::Pointer mat)
204  {
205  this->AddNextMaterialInternal(mat.GetPointer());
206  }
207 
211  void InsertMaterial(Material::Pointer e, MaterialIdentifier index);
212 
216  void AddNextLoad(Load::Pointer ld)
217  { this->AddNextLoadInternal(ld.GetPointer()); }
218  void AddNextLoad(LoadNode::Pointer ld)
219  { this->AddNextLoadInternal(ld.GetPointer()); }
220  void AddNextLoad(LoadBCMFC::Pointer ld)
221  { this->AddNextLoadInternal(ld.GetPointer()); }
222  void AddNextLoad(LoadBC::Pointer ld)
223  { this->AddNextLoadInternal(ld.GetPointer()); }
224  void AddNextLoad(LoadEdge::Pointer ld)
225  { this->AddNextLoadInternal(ld.GetPointer()); }
226  void AddNextLoad(LoadGravConst::Pointer ld)
227  { this->AddNextLoadInternal(ld.GetPointer()); }
228  void AddNextLoad(LoadLandmark::Pointer ld)
229  { this->AddNextLoadInternal(ld.GetPointer()); }
230 
234  void InsertLoad(Load::Pointer ld, LoadIdentifier index);
235 
239  Element::ConstPointer GetElement(ElementIdentifier index) const;
240  Element::Pointer GetElement(ElementIdentifier index);
242 
246  Element::ConstPointer GetElementWithGlobalNumber(int globalNumber) const;
247  Element::Pointer GetElementWithGlobalNumber(int globalNumber);
249 
253  Element::Node::Pointer GetNode(NodeIdentifier index);
254  Element::Node::ConstPointer GetNode(NodeIdentifier index) const;
256 
260  Element::Node::Pointer GetNodeWithGlobalNumber(int globalNumber);
261 
265  Material::ConstPointer GetMaterial(MaterialIdentifier index) const;
266  Material::Pointer GetMaterial(MaterialIdentifier index);
268 
272  Material::ConstPointer GetMaterialWithGlobalNumber(int globalNumber) const;
273  Material::Pointer GetMaterialWithGlobalNumber(int globalNumber);
275 
279  Load::ConstPointer GetLoad(LoadIdentifier index) const;
280  Load::Pointer GetLoad(LoadIdentifier index);
282 
286  Load::Pointer GetLoadWithGlobalNumber(int globalNumber);
287 
291  void Clear();
292 
297  void RenumberNodeContainer();
298 
305  void FinalizeMesh();
306 
307 protected:
309  FEMObject();
310  ~FEMObject();
311  virtual void PrintSelf(std::ostream& os, Indent indent) const;
313 
319  void GenerateGFN(void);
320 
326  void GenerateMFC(void);
327 
328  void AddNextMaterialInternal(Material *mat);
332  unsigned int m_NGFN;
333 
338  unsigned int m_NMFC;
339 
344 
345 private:
346  FEMObject(const Self &); // purposely not implemented
347  void operator=(const Self &); // purposely not implemented
348 
349  void AddNextLoadInternal(Load *l);
350 }; // End Class: FEMObject
351 
352 }
353 }
354 
355 #ifndef ITK_MANUAL_INSTANTIATION
356 #include "itkFEMObject.hxx"
357 #endif
358 
359 #endif // #ifndef __itkFEMObject_h
360