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