ITK  5.4.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  * https://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 #include "itkMakeFilled.h"
24 
25 #include <array>
26 
27 namespace itk
28 {
41 template <typename TCellInterface>
42 class ITK_TEMPLATE_EXPORT QuadrilateralCell
43  : public TCellInterface
45 {
46 public:
47  ITK_DISALLOW_COPY_AND_MOVE(QuadrilateralCell);
48 
51  itkCellInheritedTypedefs(TCellInterface);
55  itkOverrideGetNameOfClassMacro(QuadrilateralCell);
56 
59  using VertexAutoPointer = typename VertexType::SelfAutoPointer;
60 
63  using EdgeAutoPointer = typename EdgeType::SelfAutoPointer;
64 
66  static constexpr unsigned int NumberOfPoints = 4;
67  static constexpr unsigned int NumberOfVertices = 4;
68  static constexpr unsigned int NumberOfEdges = 4;
69  static constexpr unsigned int CellDimension = 2;
70  static constexpr unsigned int NumberOfDerivatives = 8;
71 
74  GetType() const override
75  {
77  }
78  void
79  MakeCopy(CellAutoPointer &) const override;
82  unsigned int
83  GetDimension() const override;
84 
85  unsigned int
86  GetNumberOfPoints() const override;
87 
88  CellFeatureCount
89  GetNumberOfBoundaryFeatures(int dimension) const override;
90 
91  bool
92  GetBoundaryFeature(int dimension, CellFeatureIdentifier, CellAutoPointer &) override;
93  void
94  SetPointIds(PointIdConstIterator first) override;
95 
96  void
97  SetPointIds(PointIdConstIterator first, PointIdConstIterator last) override;
98 
99  void
100  SetPointId(int localId, PointIdentifier) override;
101  PointIdIterator
102  PointIdsBegin() override;
103 
104  PointIdConstIterator
105  PointIdsBegin() const override;
106 
107  PointIdIterator
108  PointIdsEnd() override;
109 
110  PointIdConstIterator
111  PointIdsEnd() const override;
112 
114  virtual CellFeatureCount
115  GetNumberOfVertices() const;
116 
117  virtual CellFeatureCount
118  GetNumberOfEdges() const;
119 
120  virtual bool
121  GetVertex(CellFeatureIdentifier, VertexAutoPointer &);
122  virtual bool
123  GetEdge(CellFeatureIdentifier, EdgeAutoPointer &);
124 
126  bool
127  EvaluatePosition(CoordRepType * x,
128  PointsContainer * points,
129  CoordRepType * closestPoint,
130  CoordRepType[CellDimension],
131  double * dist2,
132  InterpolationWeightType * weight) override;
133 
136 
138  QuadrilateralCell() = default;
139 
140 #if defined(__GNUC__)
141  // A bug in some versions of the GCC and Clang compilers
142  // result in an ICE or linker error when "= default" is requested.
143  // This was observed in at least gcc 4.8 and 5.4.0, and
144  // AppleClang 7.0.2 and 8.0.0. Probably others too.
145  // "= default" doesn't gain us much, so just don't use it here.
146  ~QuadrilateralCell() override{};
147 #else
148  ~QuadrilateralCell() override = default;
149 #endif
150 
151 protected:
153  std::array<PointIdentifier, NumberOfPoints> m_PointIds{ MakeFilled<std::array<PointIdentifier, NumberOfPoints>>(
155 
156  void
157  InterpolationDerivs(const CoordRepType pointCoords[CellDimension], CoordRepType derivs[NumberOfDerivatives]);
158  void
159  InterpolationFunctions(const CoordRepType pointCoords[CellDimension],
160  InterpolationWeightType weights[NumberOfPoints]);
161  void
162  EvaluateLocation(int & itkNotUsed(subId),
163  const PointsContainer * points,
164  const CoordRepType pointCoords[PointDimension],
165  CoordRepType x[PointDimension],
166  InterpolationWeightType * weights);
167 };
168 } // end namespace itk
169 
170 #ifndef ITK_MANUAL_INSTANTIATION
171 # include "itkQuadrilateralCell.hxx"
172 #endif
173 
174 #endif
itkQuadrilateralCellTopology.h
itk::VertexCell
Represents a single vertex for a Mesh.
Definition: itkVertexCell.h:42
itk::QuadrilateralCell
Represents a quadrilateral for a Mesh.
Definition: itkQuadrilateralCell.h:42
itkCellVisitMacro
#define itkCellVisitMacro(TopologyId)
Definition: itkCellInterface.h:32
itkLineCell.h
itk::QuadrilateralCell::VertexAutoPointer
typename VertexType::SelfAutoPointer VertexAutoPointer
Definition: itkQuadrilateralCell.h:59
itk::QuadrilateralCell::GetType
CellGeometryEnum GetType() const override
Definition: itkQuadrilateralCell.h:74
itkCellInheritedTypedefs
#define itkCellInheritedTypedefs(superclassArg)
Definition: itkCellInterface.h:55
itkMakeFilled.h
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:63
itk::LineCell
Represents a line segment for a Mesh.
Definition: itkLineCell.h:45
itk::NumericTraits::max
static constexpr T max(const T &)
Definition: itkNumericTraits.h:168
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::CommonEnums::CellGeometry::QUADRILATERAL_CELL