VTK  9.3.0
vtkMappedUnstructuredGrid.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
131 #ifndef vtkMappedUnstructuredGrid_h
132 #define vtkMappedUnstructuredGrid_h
133 
134 #include "vtkUnstructuredGridBase.h"
135 
136 #include "vtkMappedUnstructuredGridCellIterator.h" // For default cell iterator
137 #include "vtkNew.h" // For vtkNew
138 #include "vtkSmartPointer.h" // For vtkSmartPointer
139 
140 VTK_ABI_NAMESPACE_BEGIN
141 template <class Implementation,
144 {
146 
147 public:
149  typedef Implementation ImplementationType;
150  typedef CellIterator CellIteratorType;
151 
152  // Virtuals from various base classes:
153  void PrintSelf(ostream& os, vtkIndent indent) override;
154  void CopyStructure(vtkDataSet* pd) override;
155  void ShallowCopy(vtkDataObject* src) override;
157  using vtkDataSet::GetCell;
158  vtkCell* GetCell(vtkIdType cellId) override;
159  void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
160  int GetCellType(vtkIdType cellId) override;
161  void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override;
163  void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override;
164  int GetMaxCellSize() override;
165  void GetIdsOfCellsOfType(int type, vtkIdTypeArray* array) override;
166  int IsHomogeneous() override;
167  void Allocate(vtkIdType numCells, int extSize = 1000) override;
168  vtkMTimeType GetMTime() override;
169 
172 
173 protected:
176 
177  // For convenience...
179 
181 
182  vtkIdType InternalInsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[]) override;
185  vtkIdType nfaces, const vtkIdType faces[]) override;
186  void InternalReplaceCell(vtkIdType cellId, int npts, const vtkIdType pts[]) override;
187 
188 private:
190  void operator=(const vtkMappedUnstructuredGrid&) = delete;
191 
192  vtkNew<vtkGenericCell> TempCell;
193 };
194 
195 VTK_ABI_NAMESPACE_END
196 #include "vtkMappedUnstructuredGrid.txx"
197 
198 // We need to fake the superclass for the wrappers, otherwise they will choke on
199 // the template:
200 #ifndef __VTK_WRAP__
201 
202 #define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl) \
203  class _exportDecl _className : public vtkMappedUnstructuredGrid<_impl> \
204  { \
205  public: \
206  vtkTypeMacro(_className, vtkMappedUnstructuredGrid<_impl>); \
207  static _className* New(); \
208  \
209  protected: \
210  _className() \
211  { \
212  _impl* i = _impl::New(); \
213  this->SetImplementation(i); \
214  i->Delete(); \
215  } \
216  ~_className() override {} \
217  \
218  private: \
219  _className(const _className&); \
220  void operator=(const _className&); \
221  }
222 
223 #define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
224  class _exportDecl _className : public vtkMappedUnstructuredGrid<_impl, _cIter> \
225  { \
226  public: \
227  typedef vtkMappedUnstructuredGrid<_impl, _cIter> SelfType; \
228  vtkTypeMacro(_className, SelfType); \
229  static _className* New(); \
230  \
231  protected: \
232  _className() \
233  { \
234  _impl* i = _impl::New(); \
235  this->SetImplementation(i); \
236  i->Delete(); \
237  } \
238  ~_className() override {} \
239  \
240  private: \
241  _className(const _className&); \
242  void operator=(const _className&); \
243  }
244 
245 #else // __VTK_WRAP__
246 
247 #define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl) \
248  class _exportDecl _className : public vtkUnstructuredGridBase \
249  { \
250  public: \
251  vtkTypeMacro(_className, vtkUnstructuredGridBase); \
252  static _className* New(); \
253  \
254  protected: \
255  _className() {} \
256  ~_className() override {} \
257  \
258  private: \
259  _className(const _className&); \
260  void operator=(const _className&); \
261  }
262 
263 #define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
264  class _exportDecl _className : public vtkUnstructuredGridBase \
265  { \
266  public: \
267  vtkTypeMacro(_className, vtkUnstructuredGridBase); \
268  static _className* New(); \
269  \
270  protected: \
271  _className() {} \
272  ~_className() override {} \
273  \
274  private: \
275  _className(const _className&); \
276  void operator=(const _className&); \
277  }
278 
279 #endif // __VTK_WRAP__
280 
281 #define vtkMakeMappedUnstructuredGrid(_className, _impl) \
282  vtkMakeExportedMappedUnstructuredGrid(_className, _impl, )
283 
284 #define vtkMakeMappedUnstructuredGridWithIter(_className, _impl, _cIter) \
285  vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, )
286 
287 #endif // vtkMappedUnstructuredGrid_h
288 
289 // VTK-HeaderTest-Exclude: vtkMappedUnstructuredGrid.h
Efficient cell iterator for vtkDataSet topologies.
abstract class to specify cell behavior
Definition: vtkCell.h:50
general representation of visualization data
Definition: vtkDataObject.h:55
abstract class to specify dataset behavior
Definition: vtkDataSet.h:53
virtual vtkCell * GetCell(vtkIdType cellId)=0
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:23
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:29
Default cell iterator for vtkMappedUnstructuredGrid.
Allows datasets with arbitrary storage layouts to be used with VTK.
void ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
void SetImplementation(ImplementationType *impl)
void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) override
Topological inquiry to get points defining cell.
vtkIdType InternalInsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[]) override
vtkIdType InternalInsertNextCell(int type, vtkIdList *ptIds) override
int GetMaxCellSize() override
Convenience method returns largest cell size in dataset.
vtkCell * GetCell(vtkIdType cellId) override
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override
Topological inquiry to get cells using point.
vtkSmartPointer< ImplementationType > Impl
vtkIdType InternalInsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[], vtkIdType nfaces, const vtkIdType faces[]) override
void CopyStructure(vtkDataSet *pd) override
Copy the geometric and topological structure of an object.
ImplementationType * GetImplementation()
vtkCellIterator * NewCellIterator() override
Return an iterator that traverses the cells in this data set.
void InternalReplaceCell(vtkIdType cellId, int npts, const vtkIdType pts[]) override
int IsHomogeneous() override
Traverse cells and determine if cells are all of the same type.
vtkIdType GetNumberOfCells() override
Determine the number of cells composing the dataset.
void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array) override
Fill vtkIdTypeArray container with list of cell Ids.
vtkMappedUnstructuredGrid< Implementation, CellIterator > ThisType
vtkTemplateTypeMacro(SelfType, vtkUnstructuredGridBase)
~vtkMappedUnstructuredGrid() override
void Allocate(vtkIdType numCells, int extSize=1000) override
Allocate memory for the number of cells indicated.
void GetCell(vtkIdType cellId, vtkGenericCell *cell) override
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetCellType(vtkIdType cellId) override
Get type of cell with cellId such that: 0 <= cellId < NumberOfCells.
vtkMTimeType GetMTime() override
Datasets are composite objects and need to check each part for MTime THIS METHOD IS THREAD SAFE.
dataset represents arbitrary combinations of all possible cell types.
@ type
Definition: vtkX3D.h:516
int vtkIdType
Definition: vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270