ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkHexahedronCell.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 __itkHexahedronCell_h
19 #define __itkHexahedronCell_h
20 
21 #include "itkQuadrilateralCell.h"
23 
24 namespace itk
25 {
43 template< typename TCellInterface >
44 class ITK_EXPORT HexahedronCell:public TCellInterface, private HexahedronCellTopology
45 {
46 public:
49  itkCellInheritedTypedefs(TCellInterface);
51 
53  itkTypeMacro(HexahedronCell, CellInterface);
54 
57  typedef typename VertexType::SelfAutoPointer VertexAutoPointer;
58 
61  typedef typename EdgeType::SelfAutoPointer EdgeAutoPointer;
62 
65  typedef typename FaceType::SelfAutoPointer FaceAutoPointer;
66 
68  enum { NumberOfPoints = 8,
69  NumberOfVertices = 8,
70  NumberOfEdges = 12,
71  NumberOfFaces = 6,
72  CellDimension = 3 };
73 
75  virtual CellGeometry GetType(void) const
76  { return Superclass::HEXAHEDRON_CELL; }
77  virtual void MakeCopy(CellAutoPointer &) const;
79 
80  virtual unsigned int GetDimension(void) const;
81 
82  virtual unsigned int GetNumberOfPoints(void) const;
83 
84  virtual CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const;
85 
86  virtual bool GetBoundaryFeature(int dimension, CellFeatureIdentifier, CellAutoPointer &);
87  virtual void SetPointIds(PointIdConstIterator first);
88 
89  virtual void SetPointIds(PointIdConstIterator first, PointIdConstIterator last);
90 
91  virtual void SetPointId(int localId, PointIdentifier);
92  virtual PointIdIterator PointIdsBegin(void);
93 
94  virtual PointIdConstIterator PointIdsBegin(void) const;
95 
96  virtual PointIdIterator PointIdsEnd(void);
97 
98  virtual PointIdConstIterator PointIdsEnd(void) const;
99 
101  virtual CellFeatureCount GetNumberOfVertices(void) const;
102 
103  virtual CellFeatureCount GetNumberOfEdges(void) const;
104 
105  virtual CellFeatureCount GetNumberOfFaces(void) const;
106 
107  virtual bool GetVertex(CellFeatureIdentifier, VertexAutoPointer &);
108  virtual bool GetEdge(CellFeatureIdentifier, EdgeAutoPointer &);
109  virtual bool GetFace(CellFeatureIdentifier, FaceAutoPointer &);
110 
112  virtual bool EvaluatePosition(CoordRepType *,
113  PointsContainer *,
114  CoordRepType *,
115  CoordRepType[],
116  double *,
117  InterpolationWeightType *);
118 
120  itkCellVisitMacro(Superclass::HEXAHEDRON_CELL);
121 
122 protected:
124  PointIdentifier m_PointIds[NumberOfPoints];
125 
126  void InterpolationDerivs(CoordRepType pcoords[3], CoordRepType derivs[24]);
127  void InterpolationFunctions(CoordRepType pcoords[3], InterpolationWeightType sf[8]);
128  void EvaluateLocation(int &itkNotUsed(subId), PointsContainer * points, CoordRepType pcoords[3],
129  CoordRepType x[3], InterpolationWeightType * weights);
130 
131 public:
133  {
134  for ( unsigned int i = 0; i < itkGetStaticConstMacro(NumberOfPoints); i++ )
135  {
136  m_PointIds[i] = NumericTraits< PointIdentifier >::max();
137  }
138  }
139 
141 
142 private:
143  HexahedronCell(const Self &); //purposely not implemented
144  void operator=(const Self &); //purposely not implemented
145 };
146 } // end namespace itk
147 
148 #ifndef ITK_MANUAL_INSTANTIATION
149 #include "itkHexahedronCell.hxx"
150 #endif
151 
152 #endif
153