VTK  9.2.6
vtkMappedUnstructuredGrid.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMappedUnstructuredGrid.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
143 #ifndef vtkMappedUnstructuredGrid_h
144 #define vtkMappedUnstructuredGrid_h
145 
146 #include "vtkUnstructuredGridBase.h"
147 
148 #include "vtkMappedUnstructuredGridCellIterator.h" // For default cell iterator
149 #include "vtkNew.h" // For vtkNew
150 #include "vtkSmartPointer.h" // For vtkSmartPointer
151 
152 template <class Implementation,
155 {
157 
158 public:
160  typedef Implementation ImplementationType;
161  typedef CellIterator CellIteratorType;
162 
163  // Virtuals from various base classes:
164  void PrintSelf(ostream& os, vtkIndent indent) override;
165  void CopyStructure(vtkDataSet* pd) override;
166  void ShallowCopy(vtkDataObject* src) override;
167  vtkIdType GetNumberOfCells() override;
168  using vtkDataSet::GetCell;
169  vtkCell* GetCell(vtkIdType cellId) override;
170  void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
171  int GetCellType(vtkIdType cellId) override;
172  void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override;
173  vtkCellIterator* NewCellIterator() override;
174  void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override;
175  int GetMaxCellSize() override;
176  void GetIdsOfCellsOfType(int type, vtkIdTypeArray* array) override;
177  int IsHomogeneous() override;
178  void Allocate(vtkIdType numCells, int extSize = 1000) override;
179  vtkMTimeType GetMTime() override;
180 
181  void SetImplementation(ImplementationType* impl);
182  ImplementationType* GetImplementation();
183 
184 protected:
186  ~vtkMappedUnstructuredGrid() override;
187 
188  // For convenience...
190 
192 
193  vtkIdType InternalInsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[]) override;
194  vtkIdType InternalInsertNextCell(int type, vtkIdList* ptIds) override;
195  vtkIdType InternalInsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[],
196  vtkIdType nfaces, const vtkIdType faces[]) override;
197  void InternalReplaceCell(vtkIdType cellId, int npts, const vtkIdType pts[]) override;
198 
199 private:
201  void operator=(const vtkMappedUnstructuredGrid&) = delete;
202 
203  vtkNew<vtkGenericCell> TempCell;
204 };
205 
206 #include "vtkMappedUnstructuredGrid.txx"
207 
208 // We need to fake the superclass for the wrappers, otherwise they will choke on
209 // the template:
210 #ifndef __VTK_WRAP__
211 
212 #define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl) \
213  class _exportDecl _className : public vtkMappedUnstructuredGrid<_impl> \
214  { \
215  public: \
216  vtkTypeMacro(_className, vtkMappedUnstructuredGrid<_impl>); \
217  static _className* New(); \
218  \
219  protected: \
220  _className() \
221  { \
222  _impl* i = _impl::New(); \
223  this->SetImplementation(i); \
224  i->Delete(); \
225  } \
226  ~_className() override {} \
227  \
228  private: \
229  _className(const _className&); \
230  void operator=(const _className&); \
231  }
232 
233 #define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
234  class _exportDecl _className : public vtkMappedUnstructuredGrid<_impl, _cIter> \
235  { \
236  public: \
237  typedef vtkMappedUnstructuredGrid<_impl, _cIter> SelfType; \
238  vtkTypeMacro(_className, SelfType); \
239  static _className* New(); \
240  \
241  protected: \
242  _className() \
243  { \
244  _impl* i = _impl::New(); \
245  this->SetImplementation(i); \
246  i->Delete(); \
247  } \
248  ~_className() override {} \
249  \
250  private: \
251  _className(const _className&); \
252  void operator=(const _className&); \
253  }
254 
255 #else // __VTK_WRAP__
256 
257 #define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl) \
258  class _exportDecl _className : public vtkUnstructuredGridBase \
259  { \
260  public: \
261  vtkTypeMacro(_className, vtkUnstructuredGridBase); \
262  static _className* New(); \
263  \
264  protected: \
265  _className() {} \
266  ~_className() override {} \
267  \
268  private: \
269  _className(const _className&); \
270  void operator=(const _className&); \
271  }
272 
273 #define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
274  class _exportDecl _className : public vtkUnstructuredGridBase \
275  { \
276  public: \
277  vtkTypeMacro(_className, vtkUnstructuredGridBase); \
278  static _className* New(); \
279  \
280  protected: \
281  _className() {} \
282  ~_className() override {} \
283  \
284  private: \
285  _className(const _className&); \
286  void operator=(const _className&); \
287  }
288 
289 #endif // __VTK_WRAP__
290 
291 #define vtkMakeMappedUnstructuredGrid(_className, _impl) \
292  vtkMakeExportedMappedUnstructuredGrid(_className, _impl, )
293 
294 #define vtkMakeMappedUnstructuredGridWithIter(_className, _impl, _cIter) \
295  vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, )
296 
297 #endif // vtkMappedUnstructuredGrid_h
298 
299 // VTK-HeaderTest-Exclude: vtkMappedUnstructuredGrid.h
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Default cell iterator for vtkMappedUnstructuredGrid.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkCell * GetCell(vtkIdType cellId) override
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
void Allocate(vtkIdType numCells, int extSize=1000) override
Allocate memory for the number of cells indicated.
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:332
void SetImplementation(ImplementationType *impl)
void InternalReplaceCell(vtkIdType cellId, int npts, const vtkIdType pts[]) override
~vtkMappedUnstructuredGrid() override
provides thread-safe access to cells
vtkIdType GetNumberOfCells() override
Determine the number of cells composing the dataset.
vtkMTimeType GetMTime() override
Datasets are composite objects and need to check each part for MTime THIS METHOD IS THREAD SAFE...
int IsHomogeneous() override
Traverse cells and determine if cells are all of the same type.
abstract class to specify cell behavior
Definition: vtkCell.h:60
vtkCellIterator * NewCellIterator() override
Return an iterator that traverses the cells in this data set.
a simple class to control print indentation
Definition: vtkIndent.h:39
ImplementationType * GetImplementation()
list of point or cell ids
Definition: vtkIdList.h:33
void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) override
Topological inquiry to get points defining cell.
void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array) override
Fill vtkIdTypeArray container with list of cell Ids.
vtkMappedUnstructuredGrid< Implementation, CellIterator > ThisType
void ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
vtkIdType InternalInsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[]) override
vtkTemplateTypeMacro(SelfType, vtkUnstructuredGridBase)
vtkSmartPointer< ImplementationType > Impl
Efficient cell iterator for vtkDataSet topologies.
void CopyStructure(vtkDataSet *pd) override
Copy the geometric and topological structure of an object.
int GetCellType(vtkIdType cellId) override
Get type of cell with cellId such that: 0 <= cellId < NumberOfCells.
general representation of visualization data
Definition: vtkDataObject.h:65
int GetMaxCellSize() override
Convenience method returns largest cell size in dataset.
dataset represents arbitrary combinations of all possible cell types.
virtual vtkCell * GetCell(vtkIdType cellId)=0
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
Allows datasets with arbitrary storage layouts to be used with VTK.
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override
Topological inquiry to get cells using point.