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) VTK_OVERRIDE;
161  void CopyStructure(vtkDataSet *pd) VTK_OVERRIDE;
162  void ShallowCopy(vtkDataObject *src) VTK_OVERRIDE;
163  vtkIdType GetNumberOfCells() VTK_OVERRIDE;
164  using vtkDataSet::GetCell;
165  vtkCell* GetCell(vtkIdType cellId) VTK_OVERRIDE;
166  void GetCell(vtkIdType cellId, vtkGenericCell *cell) VTK_OVERRIDE;
167  int GetCellType(vtkIdType cellId) VTK_OVERRIDE;
168  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) VTK_OVERRIDE;
169  vtkCellIterator* NewCellIterator() VTK_OVERRIDE;
170  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) VTK_OVERRIDE;
171  int GetMaxCellSize() VTK_OVERRIDE;
172  void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array) VTK_OVERRIDE;
173  int IsHomogeneous() VTK_OVERRIDE;
174  void Allocate(vtkIdType numCells, int extSize = 1000) VTK_OVERRIDE;
175  vtkIdType InsertNextCell(int type, vtkIdList *ptIds) VTK_OVERRIDE;
176  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds) VTK_OVERRIDE;
177  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds,
178  vtkIdType nfaces, vtkIdType *faces) VTK_OVERRIDE;
179  void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts) VTK_OVERRIDE;
180  vtkMTimeType GetMTime() VTK_OVERRIDE;
181 
182  void SetImplementation(ImplementationType *impl);
183  ImplementationType *GetImplementation();
184 
185 protected:
187  ~vtkMappedUnstructuredGrid() VTK_OVERRIDE;
188 
189  // For convenience...
190  typedef vtkMappedUnstructuredGrid<Implementation, CellIterator> ThisType;
191 
192  vtkSmartPointer<ImplementationType> Impl;
193 
194 private:
195  vtkMappedUnstructuredGrid(const vtkMappedUnstructuredGrid &) VTK_DELETE_FUNCTION;
196  void operator=(const vtkMappedUnstructuredGrid &) VTK_DELETE_FUNCTION;
197 
198  vtkNew<vtkGenericCell> TempCell;
199 };
200 
201 #include "vtkMappedUnstructuredGrid.txx"
202 
203 // We need to fake the superclass for the wrappers, otherwise they will choke on
204 // the template:
205 #ifndef __VTK_WRAP__
206 
207 #define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl) \
208 class _exportDecl _className : \
209  public vtkMappedUnstructuredGrid<_impl> \
210 { \
211 public: \
212  vtkTypeMacro(_className, \
213  vtkMappedUnstructuredGrid<_impl>) \
214  static _className* New(); \
215 protected: \
216  _className() \
217  { \
218  _impl *i = _impl::New(); \
219  this->SetImplementation(i); \
220  i->Delete(); \
221  } \
222  ~_className() {} \
223 private: \
224  _className(const _className&); \
225  void operator=(const _className&); \
226 };
227 
228 #define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
229 class _exportDecl _className : \
230  public vtkMappedUnstructuredGrid<_impl, _cIter> \
231 { \
232 public: \
233  vtkTypeMacro(_className, \
234  vtkMappedUnstructuredGrid<_impl, _cIter>) \
235  static _className* New(); \
236 protected: \
237  _className() \
238  { \
239  _impl *i = _impl::New(); \
240  this->SetImplementation(i); \
241  i->Delete(); \
242  } \
243  ~_className() {} \
244 private: \
245  _className(const _className&); \
246  void operator=(const _className&); \
247 };
248 
249 #else // __VTK_WRAP__
250 
251 #define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl) \
252  class _exportDecl _className : \
253  public vtkUnstructuredGridBase \
254  { \
255 public: \
256  vtkTypeMacro(_className, vtkUnstructuredGridBase) \
257  static _className* New(); \
258 protected: \
259  _className() {} \
260  ~_className() {} \
261 private: \
262  _className(const _className&); \
263  void operator=(const _className&); \
264  };
265 
266 #define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
267  class _exportDecl _className : \
268  public vtkUnstructuredGridBase \
269  { \
270 public: \
271  vtkTypeMacro(_className, vtkUnstructuredGridBase) \
272  static _className* New(); \
273 protected: \
274  _className() {} \
275  ~_className() {} \
276 private: \
277  _className(const _className&); \
278  void operator=(const _className&); \
279  };
280 
281 #endif // __VTK_WRAP__
282 
283 #define vtkMakeMappedUnstructuredGrid(_className, _impl) \
284  vtkMakeExportedMappedUnstructuredGrid(_className, _impl, )
285 
286 #define vtkMakeMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
287  vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, )
288 
289 #endif //vtkMappedUnstructuredGrid_h
290 
291 // 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: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
Hold a reference to a vtkObjectBase instance.
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.
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.
void ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
Allocate and hold a VTK object.
Definition: vtkNew.h:61
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.
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.