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  vtkMTimeType GetMTime() override;
179 
180  void SetImplementation(ImplementationType *impl);
181  ImplementationType *GetImplementation();
182 
183 protected:
185  ~vtkMappedUnstructuredGrid() override;
186 
187  // For convenience...
189 
191 
192  vtkIdType InternalInsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[]) override;
193  vtkIdType InternalInsertNextCell(int type, vtkIdList *ptIds) override;
194  vtkIdType InternalInsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[],
195  vtkIdType nfaces, const vtkIdType faces[]) override;
196  void InternalReplaceCell(vtkIdType cellId, int npts, const vtkIdType pts[]) override;
197 
198 private:
200  void operator=(const vtkMappedUnstructuredGrid &) = delete;
201 
202  vtkNew<vtkGenericCell> TempCell;
203 };
204 
205 #include "vtkMappedUnstructuredGrid.txx"
206 
207 // We need to fake the superclass for the wrappers, otherwise they will choke on
208 // the template:
209 #ifndef __VTK_WRAP__
210 
211 #define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl) \
212 class _exportDecl _className : \
213  public vtkMappedUnstructuredGrid<_impl> \
214 { \
215 public: \
216  vtkTypeMacro(_className, \
217  vtkMappedUnstructuredGrid<_impl>) \
218  static _className* New(); \
219 protected: \
220  _className() \
221  { \
222  _impl *i = _impl::New(); \
223  this->SetImplementation(i); \
224  i->Delete(); \
225  } \
226  ~_className() override {} \
227 private: \
228  _className(const _className&); \
229  void operator=(const _className&); \
230 };
231 
232 #define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
233 class _exportDecl _className : \
234  public vtkMappedUnstructuredGrid<_impl, _cIter> \
235 { \
236 public: \
237  vtkTypeMacro(_className, \
238  vtkMappedUnstructuredGrid<_impl, _cIter>) \
239  static _className* New(); \
240 protected: \
241  _className() \
242  { \
243  _impl *i = _impl::New(); \
244  this->SetImplementation(i); \
245  i->Delete(); \
246  } \
247  ~_className() override {} \
248 private: \
249  _className(const _className&); \
250  void operator=(const _className&); \
251 };
252 
253 #else // __VTK_WRAP__
254 
255 #define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl) \
256  class _exportDecl _className : \
257  public vtkUnstructuredGridBase \
258  { \
259 public: \
260  vtkTypeMacro(_className, vtkUnstructuredGridBase) \
261  static _className* New(); \
262 protected: \
263  _className() {} \
264  ~_className() override {} \
265 private: \
266  _className(const _className&); \
267  void operator=(const _className&); \
268  };
269 
270 #define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
271  class _exportDecl _className : \
272  public vtkUnstructuredGridBase \
273  { \
274 public: \
275  vtkTypeMacro(_className, vtkUnstructuredGridBase) \
276  static _className* New(); \
277 protected: \
278  _className() {} \
279  ~_className() override {} \
280 private: \
281  _className(const _className&); \
282  void operator=(const _className&); \
283  };
284 
285 #endif // __VTK_WRAP__
286 
287 #define vtkMakeMappedUnstructuredGrid(_className, _impl) \
288  vtkMakeExportedMappedUnstructuredGrid(_className, _impl, )
289 
290 #define vtkMakeMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
291  vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, )
292 
293 #endif //vtkMappedUnstructuredGrid_h
294 
295 // 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: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: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: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.
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: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.