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);
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);
179  void Allocate(vtkIdType numCells, int extSize = 1000);
183  vtkIdType nfaces, vtkIdType *faces);
184  void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts);
185  unsigned long GetMTime();
186 
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
vtkgl::data
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: vtkgl.h:11339
vtkUnstructuredGridBase.h
vtkMappedUnstructuredGrid::InsertNextCell
vtkIdType InsertNextCell(int type, vtkIdList *ptIds)
vtkMappedUnstructuredGrid
Allows datasets with arbitrary storage layouts to be used with VTK.
Definition: vtkMappedUnstructuredGrid.h:157
vtkMappedUnstructuredGrid::ShallowCopy
void ShallowCopy(vtkDataObject *src)
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkCPExodusIIElementBlock
Uses an Exodus II element block as a vtkMappedUnstructuredGrid's implementation.
vtkMappedUnstructuredGrid::GetMTime
unsigned long GetMTime()
vtkMappedUnstructuredGrid::GetCellPoints
void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
vtkMappedUnstructuredGrid::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkUnstructuredGridBase
dataset represents arbitrary combinations of all possible cell types. May be mapped onto a non-standa...
Definition: vtkUnstructuredGridBase.h:37
vtkMappedUnstructuredGrid::GetNumberOfCells
vtkIdType GetNumberOfCells()
vtkSmartPointer< ImplementationType >
vtkMappedUnstructuredGrid::GetMaxCellSize
int GetMaxCellSize()
vtkMappedUnstructuredGrid::CellIteratorType
CellIterator CellIteratorType
Definition: vtkMappedUnstructuredGrid.h:163
vtkMappedUnstructuredGridCellIterator.h
vtkMappedUnstructuredGrid::SetImplementation
void SetImplementation(ImplementationType *impl)
vtkMappedUnstructuredGrid::NewCellIterator
vtkCellIterator * NewCellIterator()
vtkMappedUnstructuredGrid::GetPointCells
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
vtkTypeTemplate.h
vtkMappedUnstructuredGrid::ThisType
vtkMappedUnstructuredGrid< Implementation, CellIterator > ThisType
Definition: vtkMappedUnstructuredGrid.h:195
vtkMappedUnstructuredGrid::GetCell
void GetCell(vtkIdType cellId, vtkGenericCell *cell)
vtkMappedUnstructuredGridCellIterator
Default cell iterator for vtkMappedUnstructuredGrid.
Definition: vtkMappedUnstructuredGridCellIterator.h:40
vtkMappedUnstructuredGrid::Impl
vtkSmartPointer< ImplementationType > Impl
Definition: vtkMappedUnstructuredGrid.h:197
vtkMappedUnstructuredGrid::GetCell
vtkCell * GetCell(vtkIdType cellId)
vtkgl::usage
GLsizeiptr const GLvoid GLenum usage
Definition: vtkgl.h:11843
vtkMappedUnstructuredGrid::GetImplementation
ImplementationType * GetImplementation()
vtkgl::src
GLenum src
Definition: vtkgl.h:12525
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:62
vtkMappedUnstructuredGrid::IsHomogeneous
int IsHomogeneous()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkMappedUnstructuredGrid::vtkMappedUnstructuredGrid
vtkMappedUnstructuredGrid()
vtkMappedUnstructuredGrid::Superclass
vtkTypeTemplate< vtkMappedUnstructuredGrid< Implementation, CellIterator >, vtkUnstructuredGridBase > Superclass
Definition: vtkMappedUnstructuredGrid.h:161
vtkSmartPointer.h
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkMappedUnstructuredGrid::InsertNextCell
vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds, vtkIdType nfaces, vtkIdType *faces)
vtkNew< vtkGenericCell >
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkMappedUnstructuredGrid::ImplementationType
Implementation ImplementationType
Definition: vtkMappedUnstructuredGrid.h:162
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:49
vtkNew.h
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:42
vtkMappedUnstructuredGrid::~vtkMappedUnstructuredGrid
~vtkMappedUnstructuredGrid()
vtkMappedUnstructuredGrid::GetCellType
int GetCellType(vtkIdType cellId)
vtkMappedUnstructuredGrid::CopyStructure
void CopyStructure(vtkDataSet *pd)
vtkCellIterator
Efficient cell iterator for vtkDataSet topologies.
Definition: vtkCellIterator.h:79
vtkMappedUnstructuredGrid::GetIdsOfCellsOfType
void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array)
vtkMappedUnstructuredGrid::Allocate
void Allocate(vtkIdType numCells, int extSize=1000)
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
vtkgl::type
GLuint GLuint GLsizei GLenum type
Definition: vtkgl.h:11315
vtkMappedUnstructuredGrid::ReplaceCell
void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts)
vtkMappedUnstructuredGrid::InsertNextCell
vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds)
vtkUnstructuredGridBase::indent
vtkIndent indent
Definition: vtkUnstructuredGridBase.h:41
vtkTypeTemplate
Provides the equivalent of vtkTypeMacro for use with template classes.
Definition: vtkTypeTemplate.h:40