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 =========================================================================*/
135  @endcode
136 
137  The vtkCPExodusIIElementBlock class provides an example of
138  vtkMappedUnstructuredGrid usage, adapting the Exodus II data structures for
139  the VTK pipeline.
140 */
141 
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 #include "vtkTypeTemplate.h" // For vtkTypeTemplate
151 
152 template <class Implementation,
155  public vtkTypeTemplate<vtkMappedUnstructuredGrid<Implementation, CellIterator>,
156  vtkUnstructuredGridBase>
157 {
158 public:
159  typedef
162  typedef Implementation ImplementationType;
163  typedef CellIterator CellIteratorType;
164 
165  // Virtuals from various base classes:
166  void PrintSelf(ostream &os, vtkIndent indent);
167  void CopyStructure(vtkDataSet *pd);
168  void ShallowCopy(vtkDataObject *src);
170  vtkCell* GetCell(vtkIdType cellId);
171  void GetCell(vtkIdType cellId, vtkGenericCell *cell);
172  int GetCellType(vtkIdType cellId);
173  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
175  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds);
176  int GetMaxCellSize();
177  void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array);
178  int IsHomogeneous();
179  void Allocate(vtkIdType numCells, int extSize = 1000);
180  vtkIdType InsertNextCell(int type, vtkIdList *ptIds);
181  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds);
182  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds,
183  vtkIdType nfaces, vtkIdType *faces);
184  void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts);
185  unsigned long GetMTime();
186 
187  void SetImplementation(ImplementationType *impl);
188  ImplementationType *GetImplementation();
189 
190 protected:
193 
194  // For convenience...
196 
198 
199 private:
200  vtkMappedUnstructuredGrid(const vtkMappedUnstructuredGrid &); // Not implemented.
201  void operator=(const vtkMappedUnstructuredGrid &); // Not implemented.
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 __WRAP__
211 
212 #define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl) \
213 class _exportDecl _className : \
214  public vtkMappedUnstructuredGrid<_impl> \
215 { \
216 public: \
217  vtkTypeMacro(_className, \
218  vtkMappedUnstructuredGrid<_impl>) \
219  static _className* New(); \
220 protected: \
221  _className() \
222  { \
223  _impl *i = _impl::New(); \
224  this->SetImplementation(i); \
225  i->Delete(); \
226  } \
227  ~_className() {} \
228 private: \
229  _className(const _className&); \
230  void operator=(const _className&); \
231 };
232 
233 #define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
234 class _exportDecl _className : \
235  public vtkMappedUnstructuredGrid<_impl, _cIter> \
236 { \
237 public: \
238  vtkTypeMacro(_className, \
239  vtkMappedUnstructuredGrid<_impl, _cIter>) \
240  static _className* New(); \
241 protected: \
242  _className() \
243  { \
244  _impl *i = _impl::New(); \
245  this->SetImplementation(i); \
246  i->Delete(); \
247  } \
248  ~_className() {} \
249 private: \
250  _className(const _className&); \
251  void operator=(const _className&); \
252 };
253 
254 #else // __WRAP__
255 
256 #define vtkMakeExportedMappedUnstructuredGrid(_className, _impl, _exportDecl) \
257  class _exportDecl _className : \
258  public vtkUnstructuredGridBase \
259 { \
260 public: \
261  vtkTypeMacro(_className, vtkUnstructuredGridBase) \
262  static _className* New(); \
263 protected: \
264  _className() {} \
265  ~_className() {} \
266 private: \
267  _className(const _className&); \
268  void operator=(const _className&); \
269 };
270 
271 #define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
272  class _exportDecl _className : \
273  public vtkUnstructuredGridBase \
274 { \
275 public: \
276  vtkTypeMacro(_className, vtkUnstructuredGridBase) \
277  static _className* New(); \
278 protected: \
279  _className() {} \
280  ~_className() {} \
281 private: \
282  _className(const _className&); \
283  void operator=(const _className&); \
284 };
285 
286 #endif // __WRAP__
287 
288 #define vtkMakeMappedUnstructuredGrid(_className, _impl) \
289  vtkMakeExportedMappedUnstructuredGrid(_className, _impl, )
290 
291 #define vtkMakeMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
292  vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, )
293 
294 #endif //vtkMappedUnstructuredGrid_h
295 
296 // VTK-HeaderTest-Exclude: vtkMappedUnstructuredGrid.h
Provides the equivalent of vtkTypeMacro for use with template classes.
void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
void CopyStructure(vtkDataSet *pd)
Default cell iterator for vtkMappedUnstructuredGrid.
unsigned long GetMTime()
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array)
vtkTypeTemplate< vtkMappedUnstructuredGrid< Implementation, CellIterator >, vtkUnstructuredGridBase > Superclass
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:275
void SetImplementation(ImplementationType *impl)
vtkCellIterator * NewCellIterator()
vtkIdType InsertNextCell(int type, vtkIdList *ptIds)
provides thread-safe access to cells
void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts)
abstract class to specify cell behavior
Definition: vtkCell.h:61
a simple class to control print indentation
Definition: vtkIndent.h:38
ImplementationType * GetImplementation()
list of point or cell ids
Definition: vtkIdList.h:35
int GetCellType(vtkIdType cellId)
vtkMappedUnstructuredGrid< Implementation, CellIterator > ThisType
Uses an Exodus II element block as a vtkMappedUnstructuredGrid's implementation.
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
void ShallowCopy(vtkDataObject *src)
vtkSmartPointer< ImplementationType > Impl
void PrintSelf(ostream &os, vtkIndent indent)
Efficient cell iterator for vtkDataSet topologies.
vtkCell * GetCell(vtkIdType cellId)
general representation of visualization data
Definition: vtkDataObject.h:64
dataset represents arbitrary combinations of all possible cell types. May be mapped onto a non-standa...
void Allocate(vtkIdType numCells, int extSize=1000)
Allows datasets with arbitrary storage layouts to be used with VTK.