VTK
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 =========================================================================*/
139 #ifndef vtkMappedUnstructuredGrid_h
140 #define vtkMappedUnstructuredGrid_h
141 
142 #include "vtkUnstructuredGridBase.h"
143 
144 #include "vtkMappedUnstructuredGridCellIterator.h" // For default cell iterator
145 #include "vtkNew.h" // For vtkNew
146 #include "vtkSmartPointer.h" // For vtkSmartPointer
147 
148 template <class Implementation,
152 {
154 public:
156  typedef Implementation ImplementationType;
157  typedef CellIterator CellIteratorType;
158 
159  // Virtuals from various base classes:
160  void PrintSelf(ostream &os, vtkIndent indent) override;
161  void CopyStructure(vtkDataSet *pd) override;
162  void ShallowCopy(vtkDataObject *src) override;
163  vtkIdType GetNumberOfCells() override;
164  using vtkDataSet::GetCell;
165  vtkCell* GetCell(vtkIdType cellId) override;
166  void GetCell(vtkIdType cellId, vtkGenericCell *cell) override;
167  int GetCellType(vtkIdType cellId) override;
168  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) override;
169  vtkCellIterator* NewCellIterator() override;
170  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override;
171  int GetMaxCellSize() override;
172  void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array) override;
173  int IsHomogeneous() override;
174  void Allocate(vtkIdType numCells, int extSize = 1000) override;
175  vtkMTimeType GetMTime() override;
176 
177  void SetImplementation(ImplementationType *impl);
178  ImplementationType *GetImplementation();
179 
180 protected:
182  ~vtkMappedUnstructuredGrid() override;
183 
184  // For convenience...
186 
188 
189  vtkIdType InternalInsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[]) override;
190  vtkIdType InternalInsertNextCell(int type, vtkIdList *ptIds) override;
191  vtkIdType InternalInsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[],
192  vtkIdType nfaces, const vtkIdType faces[]) override;
193  void InternalReplaceCell(vtkIdType cellId, int npts, const vtkIdType pts[]) override;
194 
195 private:
197  void operator=(const vtkMappedUnstructuredGrid &) = delete;
198 
199  vtkNew<vtkGenericCell> TempCell;
200 };
201 
202 #include "vtkMappedUnstructuredGrid.txx"
203 
204 // We need to fake the superclass for the wrappers, otherwise they will choke on
205 // the template:
206 #ifndef __VTK_WRAP__
207 
208 #define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl) \
209 class _exportDecl _className : \
210  public vtkMappedUnstructuredGrid<_impl> \
211 { \
212 public: \
213  vtkTypeMacro(_className, \
214  vtkMappedUnstructuredGrid<_impl>) \
215  static _className* New(); \
216 protected: \
217  _className() \
218  { \
219  _impl *i = _impl::New(); \
220  this->SetImplementation(i); \
221  i->Delete(); \
222  } \
223  ~_className() override {} \
224 private: \
225  _className(const _className&); \
226  void operator=(const _className&); \
227 };
228 
229 #define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
230 class _exportDecl _className : \
231  public vtkMappedUnstructuredGrid<_impl, _cIter> \
232 { \
233 public: \
234  vtkTypeMacro(_className, \
235  vtkMappedUnstructuredGrid<_impl, _cIter>) \
236  static _className* New(); \
237 protected: \
238  _className() \
239  { \
240  _impl *i = _impl::New(); \
241  this->SetImplementation(i); \
242  i->Delete(); \
243  } \
244  ~_className() override {} \
245 private: \
246  _className(const _className&); \
247  void operator=(const _className&); \
248 };
249 
250 #else // __VTK_WRAP__
251 
252 #define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl) \
253  class _exportDecl _className : \
254  public vtkUnstructuredGridBase \
255  { \
256 public: \
257  vtkTypeMacro(_className, vtkUnstructuredGridBase) \
258  static _className* New(); \
259 protected: \
260  _className() {} \
261  ~_className() override {} \
262 private: \
263  _className(const _className&); \
264  void operator=(const _className&); \
265  };
266 
267 #define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
268  class _exportDecl _className : \
269  public vtkUnstructuredGridBase \
270  { \
271 public: \
272  vtkTypeMacro(_className, vtkUnstructuredGridBase) \
273  static _className* New(); \
274 protected: \
275  _className() {} \
276  ~_className() override {} \
277 private: \
278  _className(const _className&); \
279  void operator=(const _className&); \
280  };
281 
282 #endif // __VTK_WRAP__
283 
284 #define vtkMakeMappedUnstructuredGrid(_className, _impl) \
285  vtkMakeExportedMappedUnstructuredGrid(_className, _impl, )
286 
287 #define vtkMakeMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
288  vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, )
289 
290 #endif //vtkMappedUnstructuredGrid_h
291 
292 // 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:302
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkTemplateTypeMacro(SelfType, vtkUnstructuredGridBase) typedef Implementation ImplementationType
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:347
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:56
vtkCellIterator * NewCellIterator() override
Return an iterator that traverses the cells in this data set.
a simple class to control print indentation
Definition: vtkIndent.h:33
ImplementationType * GetImplementation()
list of point or cell ids
Definition: vtkIdList.h:30
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
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:58
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.