VTK
vtkUnstructuredGrid.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkUnstructuredGrid.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 =========================================================================*/
33 #ifndef vtkUnstructuredGrid_h
34 #define vtkUnstructuredGrid_h
35 
36 #include "vtkCommonDataModelModule.h" // For export macro
38 
39 class vtkCellArray;
40 class vtkCellLinks;
41 class vtkConvexPointSet;
42 class vtkEmptyCell;
43 class vtkHexahedron;
44 class vtkIdList;
45 class vtkIdTypeArray;
46 class vtkLine;
47 class vtkPixel;
48 class vtkPolyLine;
49 class vtkPolyVertex;
50 class vtkPolygon;
51 class vtkPyramid;
52 class vtkPentagonalPrism;
53 class vtkHexagonalPrism;
54 class vtkQuad;
55 class vtkQuadraticEdge;
57 class vtkQuadraticWedge;
60 class vtkQuadraticQuad;
61 class vtkQuadraticTetra;
63 class vtkTetra;
64 class vtkTriangle;
65 class vtkTriangleStrip;
67 class vtkVertex;
68 class vtkVoxel;
69 class vtkWedge;
73 class vtkBiQuadraticQuad;
77 class vtkCubicLine;
78 class vtkPolyhedron;
79 class vtkIdTypeArray;
80 
81 class VTKCOMMONDATAMODEL_EXPORT vtkUnstructuredGrid :
83 {
84 public:
85  static vtkUnstructuredGrid *New();
86 
88  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
89 
93  int GetDataObjectType() VTK_OVERRIDE {return VTK_UNSTRUCTURED_GRID;};
94 
101  void Allocate(vtkIdType numCells=1000, int extSize=1000) VTK_OVERRIDE;
102 
113  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds) VTK_OVERRIDE;
114 
124  vtkIdType InsertNextCell(int type, vtkIdList *ptIds) VTK_OVERRIDE;
125 
126  // Desciption:
127  // Insert/create a polyhedron cell. npts is the number of unique points in
128  // the cell. pts is the list of the unique cell point Ids. nfaces is the
129  // number of faces in the cell. faces is the face-stream
130  // [numFace0Pts, id1, id2, id3, numFace1Pts,id1, id2, id3, ...].
131  // All point Ids are global.
132  // Make sure you have called Allocate() before calling this method
133  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds,
134  vtkIdType nfaces, vtkIdType *faces) VTK_OVERRIDE;
135 
137 
140  void Reset();
141  void CopyStructure(vtkDataSet *ds) VTK_OVERRIDE;
142  vtkIdType GetNumberOfCells() VTK_OVERRIDE;
143  vtkCell *GetCell(vtkIdType cellId) VTK_OVERRIDE;
144  void GetCell(vtkIdType cellId, vtkGenericCell *cell) VTK_OVERRIDE;
145  void GetCellBounds(vtkIdType cellId, double bounds[6]) VTK_OVERRIDE;
146  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) VTK_OVERRIDE;
147  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) VTK_OVERRIDE;
148  vtkCellIterator* NewCellIterator() VTK_OVERRIDE;
150 
151  int GetCellType(vtkIdType cellId) VTK_OVERRIDE;
152  vtkUnsignedCharArray* GetCellTypesArray() { return this->Types; }
153  vtkIdTypeArray* GetCellLocationsArray() { return this->Locations; }
154  void Squeeze() VTK_OVERRIDE;
155  void Initialize() VTK_OVERRIDE;
156  int GetMaxCellSize() VTK_OVERRIDE;
157  void BuildLinks();
158  vtkCellLinks *GetCellLinks() {return this->Links;};
159  virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts,
160  vtkIdType* &pts);
161 
168  void GetFaceStream(vtkIdType cellId, vtkIdList *ptIds);
169 
178  void GetFaceStream(vtkIdType cellId, vtkIdType& nfaces, vtkIdType* &ptIds);
179 
181 
194  void SetCells(int type, vtkCellArray *cells);
195  void SetCells(int *types, vtkCellArray *cells);
196  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
197  vtkCellArray *cells);
198  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
199  vtkCellArray *cells, vtkIdTypeArray *faceLocations,
200  vtkIdTypeArray *faces);
202 
203  vtkCellArray *GetCells() {return this->Connectivity;};
204  void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts) VTK_OVERRIDE;
205  vtkIdType InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
206  void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId);
207  void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId);
208  void ResizeCellList(vtkIdType ptId, int size);
209 
216  void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
217  vtkIdList *cellIds) VTK_OVERRIDE;
218 
220 
223  virtual int GetPiece();
224  virtual int GetNumberOfPieces();
226 
230  virtual int GetGhostLevel();
231 
240  unsigned long GetActualMemorySize() VTK_OVERRIDE;
241 
243 
246  void ShallowCopy(vtkDataObject *src) VTK_OVERRIDE;
247  void DeepCopy(vtkDataObject *src) VTK_OVERRIDE;
249 
255  void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array) VTK_OVERRIDE;
256 
260  int IsHomogeneous() VTK_OVERRIDE;
261 
266  void RemoveGhostCells();
267 
269 
272  static vtkUnstructuredGrid* GetData(vtkInformation* info);
273  static vtkUnstructuredGrid* GetData(vtkInformationVector* v, int i=0);
275 
279  vtkIdType *GetFaces(vtkIdType cellId);
280 
282 
285  vtkIdTypeArray* GetFaces(){return this->Faces;};
286  vtkIdTypeArray* GetFaceLocations(){return this->FaceLocations;};
288 
296  int InitializeFacesRepresentation(vtkIdType numPrevCells);
297 
310  static void DecomposeAPolyhedronCell(vtkCellArray *polyhedronCellArray,
311  vtkIdType & nCellpts,
312  vtkIdType & nCellfaces,
313  vtkCellArray *cellArray,
314  vtkIdTypeArray *faces);
315 
316  static void DecomposeAPolyhedronCell(vtkIdType * polyhedronCellStream,
317  vtkIdType & nCellpts,
318  vtkIdType & nCellfaces,
319  vtkCellArray *cellArray,
320  vtkIdTypeArray *faces);
321 
334  static void DecomposeAPolyhedronCell(vtkIdType nCellFaces,
335  vtkIdType * inFaceStream,
336  vtkIdType & nCellpts,
337  vtkCellArray * cellArray,
338  vtkIdTypeArray * faces);
339 
346  static void ConvertFaceStreamPointIds(vtkIdList * faceStream,
347  vtkIdType * idMap);
348 
354  static void ConvertFaceStreamPointIds(vtkIdType nfaces,
355  vtkIdType * faceStream,
356  vtkIdType * idMap);
357 
358 
359 protected:
361  ~vtkUnstructuredGrid() VTK_OVERRIDE;
362 
363  // used by GetCell method
364  vtkVertex *Vertex;
365  vtkPolyVertex *PolyVertex;
366  vtkLine *Line;
367  vtkPolyLine *PolyLine;
368  vtkTriangle *Triangle;
369  vtkTriangleStrip *TriangleStrip;
370  vtkPixel *Pixel;
371  vtkQuad *Quad;
372  vtkPolygon *Polygon;
373  vtkTetra *Tetra;
374  vtkVoxel *Voxel;
375  vtkHexahedron *Hexahedron;
376  vtkWedge *Wedge;
377  vtkPyramid *Pyramid;
378  vtkPentagonalPrism *PentagonalPrism;
379  vtkHexagonalPrism *HexagonalPrism;
380  vtkQuadraticEdge *QuadraticEdge;
381  vtkQuadraticTriangle *QuadraticTriangle;
382  vtkQuadraticQuad *QuadraticQuad;
383  vtkQuadraticPolygon *QuadraticPolygon;
384  vtkQuadraticTetra *QuadraticTetra;
385  vtkQuadraticHexahedron *QuadraticHexahedron;
386  vtkQuadraticWedge *QuadraticWedge;
387  vtkQuadraticPyramid *QuadraticPyramid;
388  vtkQuadraticLinearQuad *QuadraticLinearQuad;
389  vtkBiQuadraticQuad *BiQuadraticQuad;
390  vtkTriQuadraticHexahedron *TriQuadraticHexahedron;
391  vtkQuadraticLinearWedge *QuadraticLinearWedge;
392  vtkBiQuadraticQuadraticWedge *BiQuadraticQuadraticWedge;
393  vtkBiQuadraticQuadraticHexahedron *BiQuadraticQuadraticHexahedron;
394  vtkBiQuadraticTriangle *BiQuadraticTriangle;
395  vtkCubicLine *CubicLine;
396  vtkConvexPointSet *ConvexPointSet;
397  vtkPolyhedron *Polyhedron;
398  vtkEmptyCell *EmptyCell;
399 
400  // points inherited
401  // point data (i.e., scalars, vectors, normals, tcoords) inherited
402  vtkCellArray *Connectivity;
403  vtkCellLinks *Links;
405  vtkIdTypeArray *Locations;
406 
407  // Special support for polyhedra/cells with explicit face representations.
408  // The Faces class represents polygonal faces using a modified vtkCellArray
409  // structure. Each cell face list begins with the total number of faces in
410  // the cell, followed by a vtkCellArray data organization
411  // (n,i,j,k,n,i,j,k,...).
413  vtkIdTypeArray *FaceLocations;
414 
415 private:
416  // Hide these from the user and the compiler.
417  vtkUnstructuredGrid(const vtkUnstructuredGrid&) VTK_DELETE_FUNCTION;
418  void operator=(const vtkUnstructuredGrid&) VTK_DELETE_FUNCTION;
419 
420  void Cleanup();
421 };
422 
423 #endif
vtkpiston::DeepCopy
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
vtkUnstructuredGridBase.h
vtkHexagonalPrism
a 3D cell that represents a prism with hexagonal base
Definition: vtkHexagonalPrism.h:48
vtkHexahedron
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:47
vtkUnstructuredGrid::GetDataObjectType
int GetDataObjectType() override
Standard vtkDataSet API methods.
Definition: vtkUnstructuredGrid.h:93
vtkConvexPointSet
a 3D cell defined by a set of convex points
Definition: vtkConvexPointSet.h:45
vtkX3D::type
Definition: vtkX3D.h:516
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkPolygon
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:45
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkEmptyCell
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:32
vtkBiQuadraticTriangle
cell represents a parabolic, isoparametric triangle
Definition: vtkBiQuadraticTriangle.h:51
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:41
vtkUnstructuredGridBase
dataset represents arbitrary combinations of all possible cell types. May be mapped onto a non-standa...
Definition: vtkUnstructuredGridBase.h:37
vtkQuadraticTriangle
cell represents a parabolic, isoparametric triangle
Definition: vtkQuadraticTriangle.h:46
vtkPointSet::Squeeze
void Squeeze() override
Reclaim any unused memory.
vtkQuadraticHexahedron
cell represents a parabolic, 20-node isoparametric hexahedron
Definition: vtkQuadraticHexahedron.h:48
vtkPyramid
a 3D cell that represents a linear pyramid
Definition: vtkPyramid.h:49
vtkBiQuadraticQuadraticHexahedron
cell represents a biquadratic, 24-node isoparametric hexahedron
Definition: vtkBiQuadraticQuadraticHexahedron.h:83
vtkQuadraticQuad
cell represents a parabolic, 8-node isoparametric quad
Definition: vtkQuadraticQuad.h:46
vtkVertex
a cell that represents a 3D point
Definition: vtkVertex.h:36
vtkUnstructuredGrid::GetFaceLocations
vtkIdTypeArray * GetFaceLocations()
Definition: vtkUnstructuredGrid.h:286
vtkUnstructuredGridBase::ReplaceCell
virtual void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts)=0
Replace the points defining cell "cellId" with a new set of points.
vtkLine
cell represents a 1D line
Definition: vtkLine.h:35
vtkQuadraticPyramid
cell represents a parabolic, 13-node isoparametric pyramid
Definition: vtkQuadraticPyramid.h:55
vtkPointSet::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPentagonalPrism
a 3D cell that represents a convex prism with pentagonal base
Definition: vtkPentagonalPrism.h:56
vtkPolyLine
cell represents a set of 1D lines
Definition: vtkPolyLine.h:42
vtkBiQuadraticQuad
cell represents a parabolic, 9-node isoparametric quad
Definition: vtkBiQuadraticQuad.h:54
vtkDataSet::GetCellNeighbors
virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds)
Topological inquiry to get all cells using list of points exclusive of cell specified (e....
vtkQuadraticTetra
cell represents a parabolic, 10-node isoparametric tetrahedron
Definition: vtkQuadraticTetra.h:51
vtkWedge
a 3D cell that represents a linear wedge
Definition: vtkWedge.h:49
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:59
vtkQuadraticWedge
cell represents a parabolic, 15-node isoparametric wedge
Definition: vtkQuadraticWedge.h:51
vtkQuadraticPolygon
a cell that represents a parabolic n-sided polygon
Definition: vtkQuadraticPolygon.h:46
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCubicLine
cell represents a cubic , isoparametric 1D line
Definition: vtkCubicLine.h:45
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:50
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkX3D::size
Definition: vtkX3D.h:253
vtkQuadraticLinearWedge
cell represents a, 12-node isoparametric wedge
Definition: vtkQuadraticLinearWedge.h:55
vtkTriangle
a cell that represents a triangle
Definition: vtkTriangle.h:41
vtkTriQuadraticHexahedron
cell represents a parabolic, 27-node isoparametric hexahedron
Definition: vtkTriQuadraticHexahedron.h:85
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkDataSet::GetCellPoints
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
Topological inquiry to get points defining cell.
vtkX3D::info
Definition: vtkX3D.h:376
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:41
vtkPixel
a cell that represents an orthogonal quadrilateral
Definition: vtkPixel.h:40
vtkQuadraticLinearQuad
cell represents a quadratic-linear, 6-node isoparametric quad
Definition: vtkQuadraticLinearQuad.h:50
vtkBiQuadraticQuadraticWedge
cell represents a parabolic, 18-node isoparametric wedge
Definition: vtkBiQuadraticQuadraticWedge.h:56
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:39
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:81
vtkUnstructuredGrid::GetCellLocationsArray
vtkIdTypeArray * GetCellLocationsArray()
Definition: vtkUnstructuredGrid.h:153
vtkCellIterator
Efficient cell iterator for vtkDataSet topologies.
Definition: vtkCellIterator.h:80
vtkTetra
a 3D cell that represents a tetrahedron
Definition: vtkTetra.h:47
VTK_UNSTRUCTURED_GRID
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:91
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkUnstructuredGridBase::Allocate
virtual void Allocate(vtkIdType numCells=1000, int extSize=1000)=0
Allocate memory for the number of cells indicated.
vtkPointSet::GetActualMemorySize
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
vtkQuadraticEdge
cell represents a parabolic, isoparametric edge
Definition: vtkQuadraticEdge.h:43
vtkUnstructuredGrid::GetCells
vtkCellArray * GetCells()
Definition: vtkUnstructuredGrid.h:203
vtkPolyhedron
a 3D cell defined by a set of polygonal faces
Definition: vtkPolyhedron.h:60
vtkTriangleStrip
a cell that represents a triangle strip
Definition: vtkTriangleStrip.h:43
vtkQuad
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:41
vtkDataObject::New
static vtkDataObject * New()
vtkPolyVertex
cell represents a set of 0D vertices
Definition: vtkPolyVertex.h:38
vtkVoxel
a cell that represents a 3D orthogonal parallelepiped
Definition: vtkVoxel.h:44