ITK  5.2.0
Insight Toolkit
itkQuadrilateralCell.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 itkQuadrilateralCell_h
19 #define itkQuadrilateralCell_h
20 
21 #include "itkLineCell.h"
23 
24 namespace itk
25 {
38 template <typename TCellInterface>
39 class ITK_TEMPLATE_EXPORT QuadrilateralCell
40  : public TCellInterface
42 {
43 public:
44  ITK_DISALLOW_COPY_AND_MOVE(QuadrilateralCell);
45 
48  itkCellInheritedTypedefs(TCellInterface);
50 
52  itkTypeMacro(QuadrilateralCell, CellInterface);
53 
56  using VertexAutoPointer = typename VertexType::SelfAutoPointer;
57 
60  using EdgeAutoPointer = typename EdgeType::SelfAutoPointer;
61 
63  static constexpr unsigned int NumberOfPoints = 4;
64  static constexpr unsigned int NumberOfVertices = 4;
65  static constexpr unsigned int NumberOfEdges = 4;
66  static constexpr unsigned int CellDimension = 2;
67  static constexpr unsigned int NumberOfDerivatives = 8;
68 
71  GetType() const override
72  {
74  }
75  void
76  MakeCopy(CellAutoPointer &) const override;
78 
79  unsigned int
80  GetDimension() const override;
81 
82  unsigned int
83  GetNumberOfPoints() const override;
84 
85  CellFeatureCount
86  GetNumberOfBoundaryFeatures(int dimension) const override;
87 
88  bool
89  GetBoundaryFeature(int dimension, CellFeatureIdentifier, CellAutoPointer &) override;
90  void
91  SetPointIds(PointIdConstIterator first) override;
92 
93  void
94  SetPointIds(PointIdConstIterator first, PointIdConstIterator last) override;
95 
96  void
97  SetPointId(int localId, PointIdentifier) override;
98  PointIdIterator
99  PointIdsBegin() override;
100 
101  PointIdConstIterator
102  PointIdsBegin() const override;
103 
104  PointIdIterator
105  PointIdsEnd() override;
106 
107  PointIdConstIterator
108  PointIdsEnd() const override;
109 
111  virtual CellFeatureCount
112  GetNumberOfVertices() const;
113 
114  virtual CellFeatureCount
115  GetNumberOfEdges() const;
116 
117  virtual bool
118  GetVertex(CellFeatureIdentifier, VertexAutoPointer &);
119  virtual bool
120  GetEdge(CellFeatureIdentifier, EdgeAutoPointer &);
121 
123  bool
124  EvaluatePosition(CoordRepType * x,
125  PointsContainer * points,
126  CoordRepType * closestPoint,
127  CoordRepType[CellDimension],
128  double * dist2,
129  InterpolationWeightType * weight) override;
130 
133 
136  {
137  for (PointIdentifier i = 0; i < Self::NumberOfPoints; i++)
138  {
139  m_PointIds[i] = NumericTraits<PointIdentifier>::max();
140  }
141  }
143 
144 #if defined(__GNUC__)
145  // A bug in some versions of the GCC and Clang compilers
146  // result in an ICE or linker error when "= default" is requested.
147  // This was observed in at least gcc 4.8 and 5.4.0, and
148  // AppleClang 7.0.2 and 8.0.0. Probably others too.
149  // "= default" doesn't gain us much, so just don't use it here.
150  ~QuadrilateralCell() override{};
151 #else
152  ~QuadrilateralCell() override = default;
153 #endif
154 
155 protected:
157  PointIdentifier m_PointIds[NumberOfPoints];
158 
159  void
160  InterpolationDerivs(const CoordRepType pointCoords[CellDimension], CoordRepType derivs[NumberOfDerivatives]);
161  void
162  InterpolationFunctions(const CoordRepType pointCoords[CellDimension],
163  InterpolationWeightType weights[NumberOfPoints]);
164  void
165  EvaluateLocation(int & itkNotUsed(subId),
166  const PointsContainer * points,
167  const CoordRepType pointCoords[PointDimension],
168  CoordRepType x[PointDimension],
169  InterpolationWeightType * weights);
170 };
171 } // end namespace itk
172 
173 #ifndef ITK_MANUAL_INSTANTIATION
174 # include "itkQuadrilateralCell.hxx"
175 #endif
176 
177 #endif
itkQuadrilateralCellTopology.h
itk::VertexCell
Represents a single vertex for a Mesh.
Definition: itkVertexCell.h:39
itk::QuadrilateralCell
Represents a quadrilateral for a Mesh.
Definition: itkQuadrilateralCell.h:39
itkCellVisitMacro
#define itkCellVisitMacro(TopologyId)
Definition: itkCellInterface.h:32
itkLineCell.h
itk::QuadrilateralCell::VertexAutoPointer
typename VertexType::SelfAutoPointer VertexAutoPointer
Definition: itkQuadrilateralCell.h:56
itk::QuadrilateralCell::GetType
CellGeometryEnum GetType() const override
Definition: itkQuadrilateralCell.h:71
itkCellInheritedTypedefs
#define itkCellInheritedTypedefs(superclassArg)
Definition: itkCellInterface.h:55
itk::QuadrilateralCellTopology
Holds data defining the topological connections of the vertices and edges of a QuadrilateralCell.
Definition: itkQuadrilateralCellTopology.h:36
itk::CommonEnums::CellGeometry
CellGeometry
Definition: itkCommonEnums.h:138
itk::QuadrilateralCell::EdgeAutoPointer
typename EdgeType::SelfAutoPointer EdgeAutoPointer
Definition: itkQuadrilateralCell.h:60
itk::LineCell
Represents a line segment for a Mesh.
Definition: itkLineCell.h:42
itk::NumericTraits::max
static constexpr T max(const T &)
Definition: itkNumericTraits.h:167
itk::CellInterface
An abstract interface for cells.
Definition: itkCellInterface.h:96
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkCellCommonTypedefs
#define itkCellCommonTypedefs(celltype)
Definition: itkCellInterface.h:46
itk::QuadrilateralCell::QuadrilateralCell
QuadrilateralCell()
Definition: itkQuadrilateralCell.h:135
itk::CommonEnums::CellGeometry::QUADRILATERAL_CELL