ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkFEMElementStd.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 
19 #ifndef itkFEMElementStd_h
20 #define itkFEMElementStd_h
21 
22 #include "itkFEMElementBase.h"
23 
24 namespace itk
25 {
26 namespace fem
27 {
55 template <unsigned int VNumberOfNodes, unsigned int VNumberOfSpatialDimensions, typename TBaseClass = Element>
56 class ElementStd : public TBaseClass
57 {
58 public:
59 
61  typedef ElementStd Self;
62  typedef TBaseClass Superclass;
65 
67  itkTypeMacro(ElementStd, TBaseClass);
68 
69 // FIXME: Add concept cheking for TBaseClass, and TPointClass
70 
71  // Repeat typedefs and enums from parent class
72 
73  typedef typename Superclass::Float Float;
74  typedef typename Superclass::MatrixType MatrixType;
75  typedef typename Superclass::VectorType VectorType;
76  typedef typename Superclass::LoadType LoadType;
77  typedef typename Superclass::LoadPointer LoadPointer;
78  typedef typename Superclass::NodeIDType NodeIDType;
79  typedef typename Superclass::DegreeOfFreedomIDType DegreeOfFreedomIDType;
80  typedef typename Superclass::Node Node;
81  enum { InvalidDegreeOfFreedomID = Superclass::InvalidDegreeOfFreedomID };
82 
86  enum { NumberOfNodes = VNumberOfNodes };
87 
91  enum { NumberOfSpatialDimensions = VNumberOfSpatialDimensions };
92 
96  ElementStd();
97 
98  // ////////////////////////////////////////////////////////////////////////
102  virtual unsigned int GetNumberOfNodes(void) const ITK_OVERRIDE
103  {
104  return NumberOfNodes;
105  }
106 
111  virtual NodeIDType GetNode(unsigned int n) const ITK_OVERRIDE
112  {
113  if( n >= NumberOfNodes )
114  {
115  return ITK_NULLPTR;
116  }
117  return this->m_node[n];
118  }
119 
120  virtual void SetNode(unsigned int n, NodeIDType node) ITK_OVERRIDE
121  {
122  this->SetNodeInternal(n,node);
123  }
124  virtual void SetNode(unsigned int n, typename Superclass::Node::Pointer node) ITK_OVERRIDE
125  {
126  this->SetNodeInternal(n,node);
127  }
128 
130  virtual const VectorType & GetNodeCoordinates(unsigned int n) const ITK_OVERRIDE
131  {
132  return m_node[n]->GetCoordinates();
133  }
134 
136  virtual unsigned int GetNumberOfSpatialDimensions() const ITK_OVERRIDE
137  {
139  }
140 
141  // ////////////////////////////////////////////////////////////////////////
142 
143 protected:
144 
145  virtual void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
146 
147  virtual void SetNodeInternal(unsigned int n, const Node *node)
148  {
149  if( n >= NumberOfNodes )
150  {
151  return;
152  }
153  this->m_node[n] = node;
154  }
159 };
160 
161 }
162 } // end namespace itk::fem
163 
164 #ifndef ITK_MANUAL_INSTANTIATION
165 #include "itkFEMElementStd.hxx"
166 #endif
167 
168 #endif // #ifndef itkFEMElementStd_h
virtual void SetNodeInternal(unsigned int n, const Node *node)
virtual void PrintSelf(std::ostream &os, Indent indent) const override
Superclass::DegreeOfFreedomIDType DegreeOfFreedomIDType
virtual unsigned int GetNumberOfNodes(void) const override
Superclass::Node Node
Superclass::LoadPointer LoadPointer
virtual const VectorType & GetNodeCoordinates(unsigned int n) const override
Implements standard node management in the element classes.
SmartPointer< const Self > ConstPointer
virtual NodeIDType GetNode(unsigned int n) const override
vnl_vector< Float > VectorType
virtual unsigned int GetNumberOfSpatialDimensions() const override
virtual void SetNode(unsigned int n, typename Superclass::Node::Pointer node) override
Superclass::Float Float
SmartPointer< Self > Pointer
Superclass::VectorType VectorType
Superclass::NodeIDType NodeIDType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void SetNode(unsigned int n, NodeIDType node) override
const Node * m_node[NumberOfNodes]
Superclass::LoadType LoadType
Superclass::MatrixType MatrixType