ITK  5.4.0
Insight Toolkit
itkQuadEdgeMeshLineCell.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 itkQuadEdgeMeshLineCell_h
19 #define itkQuadEdgeMeshLineCell_h
20 
21 #include "itkAutoPointer.h"
22 #include "itkMesh.h"
23 #include "itkGeometricalQuadEdge.h"
24 
25 namespace itk
26 {
39 template <typename TCellInterface>
40 class ITK_TEMPLATE_EXPORT QuadEdgeMeshLineCell
41  : public TCellInterface
42  , public TCellInterface::CellTraits::QuadEdgeType
43 {
44 public:
45  ITK_DISALLOW_COPY_AND_MOVE(QuadEdgeMeshLineCell);
46 
48  // itkCellCommonTypedefs
52  using RawPointer = Self *;
53  using ConstRawPointer = const Self *;
54 
55  // itkCellInheritedTypedefs
56  using Superclass = TCellInterface;
57  using typename Superclass::PixelType;
58  using CellType = typename Superclass::CellType;
59  using typename Superclass::CellAutoPointer;
60  using typename Superclass::CellConstAutoPointer;
61  using typename Superclass::CellRawPointer;
62  using typename Superclass::CellConstRawPointer;
63  using CellTraits = typename Superclass::CellTraits;
64  using typename Superclass::CoordRepType;
65  using typename Superclass::InterpolationWeightType;
66  using typename Superclass::PointIdentifier;
67  using typename Superclass::CellIdentifier;
68  using typename Superclass::CellFeatureIdentifier;
69  using CellFeatureCount = typename Superclass::CellFeatureIdentifier;
70  using typename Superclass::PointType;
71  using typename Superclass::PointsContainer;
72  using typename Superclass::UsingCellsContainer;
73  using typename Superclass::ParametricCoordArrayType;
74  using typename Superclass::ShapeFunctionsArrayType;
75  static constexpr unsigned int PointDimension = Superclass::PointDimension;
76  static constexpr unsigned int CellDimension = 2;
77 
79  using MultiVisitor = typename CellType::MultiVisitor;
80 
82  using PointIdIterator = typename CellTraits::PointIdIterator;
83  using PointIdConstIterator = typename CellTraits::PointIdConstIterator;
84  using PointIdInternalIterator = typename CellTraits::PointIdInternalIterator;
85  using PointIdInternalConstIterator = typename CellTraits::PointIdInternalConstIterator;
86 
88  using QEType = typename CellTraits::QuadEdgeType;
89  using VertexRefType = typename QEType::OriginRefType;
90  using FaceRefType = typename QEType::DualOriginRefType;
91  using PrimalDataType = typename QEType::PrimalDataType;
92  using DualDataType = typename QEType::DualDataType;
93  using QEDual = typename QEType::DualType;
94 
95 public:
97  itkTypeMacro(QuadEdgeMeshLineCell, TCellInterface);
98 
99  // accessor to the new QEGeom link that replaces now inheritance.
100  QEType *
101  GetQEGeom() const
102  {
103  return (m_QuadEdgeGeom);
104  }
105 
106 public:
109  ~QuadEdgeMeshLineCell() override;
113  void
114  SetIdent(CellIdentifier cid);
115 
116  CellIdentifier
117  GetIdent();
118 
120  void
121  Accept(CellIdentifier cellId, MultiVisitor * mv) override;
122 
124  GetType() const override;
125 
127  static constexpr CellGeometryEnum
129  {
131  }
132 
133  unsigned int
134  GetDimension() const override;
135 
136  unsigned int
137  GetNumberOfPoints() const override;
138 
139  CellFeatureCount
140  GetNumberOfBoundaryFeatures(int dimension) const override;
141 
142  bool
143  GetBoundaryFeature(int dimension, CellFeatureIdentifier cellId, CellAutoPointer & cell) override;
144 
146  void
147  MakeCopy(CellAutoPointer & cell) const override
148  {
149  cell.TakeOwnership(new Self);
150  cell->SetPointId(0, this->GetQEGeom()->GetOrigin());
151  cell->SetPointId(1, this->GetQEGeom()->GetDestination());
152  }
159  void
160  SetPointIds(PointIdConstIterator first) override;
161 
162  void
163  SetPointIds(PointIdConstIterator first, PointIdConstIterator last) override;
164 
165  void
166  SetPointId(int localId, PointIdentifier pId) override;
167 
168  PointIdIterator
169  PointIdsBegin() override
170  {
171  SynchronizePointsAPI();
172  return &m_PointIds[0];
173  }
174 
175  PointIdIterator
176  PointIdsEnd() override
177  {
178  SynchronizePointsAPI();
179  return (&m_PointIds[1] + 1);
180  }
181 
182  PointIdConstIterator
183  GetPointIds() const override
184  {
185  SynchronizePointsAPI();
186  return &m_PointIds[0];
187  }
188 
189  PointIdConstIterator
190  PointIdsBegin() const override
191  {
192  SynchronizePointsAPI();
193  return &m_PointIds[0];
194  }
195 
196  PointIdConstIterator
197  PointIdsEnd() const override
198  {
199  SynchronizePointsAPI();
200  return (&m_PointIds[1] + 1);
201  }
202 
204  void
206  {
207  m_PointIds[0] = GetQEGeom()->GetOrigin();
208  m_PointIds[1] = GetQEGeom()->GetDestination();
209  }
213  virtual void
214  InternalSetPointIds(PointIdInternalConstIterator first);
215 
216  virtual void
217  InternalSetPointIds(PointIdInternalConstIterator first, PointIdInternalConstIterator last);
218 
219  virtual PointIdInternalIterator
220  InternalPointIdsBegin();
221 
222  virtual PointIdInternalIterator
223  InternalPointIdsEnd();
224 
225  virtual PointIdInternalConstIterator
226  InternalGetPointIds() const;
227 
228  virtual PointIdInternalConstIterator
229  InternalPointIdsBegin() const;
230 
231  virtual PointIdInternalConstIterator
232  InternalPointIdsEnd() const;
233 
234 private:
239  CellIdentifier m_Identifier{};
240  QEType * m_QuadEdgeGeom{};
241  mutable PointIdentifier m_PointIds[2]{};
242 };
243 } // end namespace itk
244 
245 #ifndef ITK_MANUAL_INSTANTIATION
246 # include "itkQuadEdgeMeshLineCell.hxx"
247 #endif
248 
249 #endif
itk::AutoPointer
Implements an Automatic Pointer to an object.
Definition: itkAutoPointer.h:46
itk::QuadEdgeMeshLineCell::PointIdIterator
typename CellTraits::PointIdIterator PointIdIterator
Definition: itkQuadEdgeMeshLineCell.h:82
itk::CommonEnums::CellGeometry::LINE_CELL
itkAutoPointer.h
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itkGeometricalQuadEdge.h
itk::QuadEdgeMeshLineCell::GetQEGeom
QEType * GetQEGeom() const
Definition: itkQuadEdgeMeshLineCell.h:101
itk::QuadEdgeMeshLineCell::PointIdsBegin
PointIdConstIterator PointIdsBegin() const override
Definition: itkQuadEdgeMeshLineCell.h:190
itk::QuadEdgeMeshLineCell::SynchronizePointsAPI
void SynchronizePointsAPI() const
Definition: itkQuadEdgeMeshLineCell.h:205
itk::QuadEdgeMeshLineCell::PrimalDataType
typename QEType::PrimalDataType PrimalDataType
Definition: itkQuadEdgeMeshLineCell.h:91
itk::QuadEdgeMeshLineCell::PointIdConstIterator
typename CellTraits::PointIdConstIterator PointIdConstIterator
Definition: itkQuadEdgeMeshLineCell.h:83
itk::QuadEdgeMeshLineCell::MakeCopy
void MakeCopy(CellAutoPointer &cell) const override
Definition: itkQuadEdgeMeshLineCell.h:147
itkMesh.h
itk::QuadEdgeMeshLineCell
Class that connects the QuadEdgeMesh with the Mesh.
Definition: itkQuadEdgeMeshLineCell.h:40
itk::QuadEdgeMeshLineCell::PointIdsEnd
PointIdConstIterator PointIdsEnd() const override
Definition: itkQuadEdgeMeshLineCell.h:197
itk::QuadEdgeMeshLineCell::QEDual
typename QEType::DualType QEDual
Definition: itkQuadEdgeMeshLineCell.h:93
itk::QuadEdgeMeshLineCell::GetPointIds
PointIdConstIterator GetPointIds() const override
Definition: itkQuadEdgeMeshLineCell.h:183
itk::QuadEdgeMeshLineCell::PointIdInternalConstIterator
typename CellTraits::PointIdInternalConstIterator PointIdInternalConstIterator
Definition: itkQuadEdgeMeshLineCell.h:85
itk::CommonEnums::CellGeometry
CellGeometry
Definition: itkCommonEnums.h:138
itk::QuadEdgeMeshLineCell::GetTopologyId
static constexpr CellGeometryEnum GetTopologyId()
Definition: itkQuadEdgeMeshLineCell.h:128
itk::QuadEdgeMeshLineCell::CellFeatureCount
typename Superclass::CellFeatureIdentifier CellFeatureCount
Definition: itkQuadEdgeMeshLineCell.h:69
itk::QuadEdgeMeshLineCell::CellType
typename Superclass::CellType CellType
Definition: itkQuadEdgeMeshLineCell.h:58
itk::QuadEdgeMeshLineCell::Superclass
TCellInterface Superclass
Definition: itkQuadEdgeMeshLineCell.h:56
itk::QuadEdgeMeshLineCell::MultiVisitor
typename CellType::MultiVisitor MultiVisitor
Definition: itkQuadEdgeMeshLineCell.h:79
itk::QuadEdgeMeshLineCell::VertexRefType
typename QEType::OriginRefType VertexRefType
Definition: itkQuadEdgeMeshLineCell.h:89
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::QuadEdgeMeshLineCell::FaceRefType
typename QEType::DualOriginRefType FaceRefType
Definition: itkQuadEdgeMeshLineCell.h:90
itk::QuadEdgeMeshLineCell::PointIdsEnd
PointIdIterator PointIdsEnd() override
Definition: itkQuadEdgeMeshLineCell.h:176
itk::QuadEdgeMeshLineCell::DualDataType
typename QEType::DualDataType DualDataType
Definition: itkQuadEdgeMeshLineCell.h:92
itk::QuadEdgeMeshLineCell::PointIdsBegin
PointIdIterator PointIdsBegin() override
Definition: itkQuadEdgeMeshLineCell.h:169
itk::QuadEdgeMeshLineCell::CellTraits
typename Superclass::CellTraits CellTraits
Definition: itkQuadEdgeMeshLineCell.h:63
itk::QuadEdgeMeshLineCell::PointIdInternalIterator
typename CellTraits::PointIdInternalIterator PointIdInternalIterator
Definition: itkQuadEdgeMeshLineCell.h:84
itk::QuadEdgeMeshLineCell::QEType
typename CellTraits::QuadEdgeType QEType
Definition: itkQuadEdgeMeshLineCell.h:88