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 =========================================================================*/
27 #ifndef vtkUnstructuredGrid_h
28 #define vtkUnstructuredGrid_h
29 
30 #include "vtkCommonDataModelModule.h" // For export macro
32 
33 class vtkCellArray;
34 class vtkCellLinks;
35 class vtkConvexPointSet;
36 class vtkEmptyCell;
37 class vtkHexahedron;
38 class vtkIdList;
39 class vtkIdTypeArray;
40 class vtkLine;
41 class vtkPixel;
42 class vtkPolyLine;
43 class vtkPolyVertex;
44 class vtkPolygon;
45 class vtkPyramid;
46 class vtkPentagonalPrism;
47 class vtkHexagonalPrism;
48 class vtkQuad;
49 class vtkQuadraticEdge;
51 class vtkQuadraticWedge;
54 class vtkQuadraticQuad;
55 class vtkQuadraticTetra;
57 class vtkTetra;
58 class vtkTriangle;
59 class vtkTriangleStrip;
61 class vtkVertex;
62 class vtkVoxel;
63 class vtkWedge;
67 class vtkBiQuadraticQuad;
71 class vtkCubicLine;
72 class vtkPolyhedron;
73 class vtkIdTypeArray;
74 
75 class VTKCOMMONDATAMODEL_EXPORT vtkUnstructuredGrid :
77 {
78 public:
79  static vtkUnstructuredGrid *New();
80 
82  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
83 
87  int GetDataObjectType() VTK_OVERRIDE {return VTK_UNSTRUCTURED_GRID;};
88 
95  void Allocate(vtkIdType numCells=1000, int extSize=1000) VTK_OVERRIDE;
96 
107  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds) VTK_OVERRIDE;
108 
118  vtkIdType InsertNextCell(int type, vtkIdList *ptIds) VTK_OVERRIDE;
119 
120  // Desciption:
121  // Insert/create a polyhedron cell. npts is the number of unique points in
122  // the cell. pts is the list of the unique cell point Ids. nfaces is the
123  // number of faces in the cell. faces is the face-stream
124  // [numFace0Pts, id1, id2, id3, numFace1Pts,id1, id2, id3, ...].
125  // All point Ids are global.
126  // Make sure you have called Allocate() before calling this method
127  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds,
128  vtkIdType nfaces, vtkIdType *faces) VTK_OVERRIDE;
129 
131 
134  void Reset();
135  void CopyStructure(vtkDataSet *ds) VTK_OVERRIDE;
136  vtkIdType GetNumberOfCells() VTK_OVERRIDE;
137  using vtkDataSet::GetCell;
138  vtkCell *GetCell(vtkIdType cellId) VTK_OVERRIDE;
139  void GetCell(vtkIdType cellId, vtkGenericCell *cell) VTK_OVERRIDE;
140  void GetCellBounds(vtkIdType cellId, double bounds[6]) VTK_OVERRIDE;
141  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) VTK_OVERRIDE;
142  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) VTK_OVERRIDE;
143  vtkCellIterator* NewCellIterator() VTK_OVERRIDE;
145 
146  int GetCellType(vtkIdType cellId) VTK_OVERRIDE;
147  vtkUnsignedCharArray* GetCellTypesArray() { return this->Types; }
148  vtkIdTypeArray* GetCellLocationsArray() { return this->Locations; }
149  void Squeeze() VTK_OVERRIDE;
150  void Initialize() VTK_OVERRIDE;
151  int GetMaxCellSize() VTK_OVERRIDE;
152  void BuildLinks();
153  vtkCellLinks *GetCellLinks() {return this->Links;};
154  virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts,
155  vtkIdType* &pts);
156 
163  void GetFaceStream(vtkIdType cellId, vtkIdList *ptIds);
164 
173  void GetFaceStream(vtkIdType cellId, vtkIdType& nfaces, vtkIdType* &ptIds);
174 
176 
189  void SetCells(int type, vtkCellArray *cells);
190  void SetCells(int *types, vtkCellArray *cells);
191  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
192  vtkCellArray *cells);
193  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
194  vtkCellArray *cells, vtkIdTypeArray *faceLocations,
195  vtkIdTypeArray *faces);
197 
198  vtkCellArray *GetCells() {return this->Connectivity;};
199  void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts) VTK_OVERRIDE;
200  vtkIdType InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
201  void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId);
202  void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId);
203  void ResizeCellList(vtkIdType ptId, int size);
204 
211  void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
212  vtkIdList *cellIds) VTK_OVERRIDE;
213 
215 
218  virtual int GetPiece();
219  virtual int GetNumberOfPieces();
221 
225  virtual int GetGhostLevel();
226 
235  unsigned long GetActualMemorySize() VTK_OVERRIDE;
236 
238 
241  void ShallowCopy(vtkDataObject *src) VTK_OVERRIDE;
242  void DeepCopy(vtkDataObject *src) VTK_OVERRIDE;
244 
250  void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array) VTK_OVERRIDE;
251 
255  int IsHomogeneous() VTK_OVERRIDE;
256 
261  void RemoveGhostCells();
262 
264 
267  static vtkUnstructuredGrid* GetData(vtkInformation* info);
268  static vtkUnstructuredGrid* GetData(vtkInformationVector* v, int i=0);
270 
274  vtkIdType *GetFaces(vtkIdType cellId);
275 
277 
280  vtkIdTypeArray* GetFaces(){return this->Faces;};
281  vtkIdTypeArray* GetFaceLocations(){return this->FaceLocations;};
283 
291  int InitializeFacesRepresentation(vtkIdType numPrevCells);
292 
305  static void DecomposeAPolyhedronCell(vtkCellArray *polyhedronCellArray,
306  vtkIdType & nCellpts,
307  vtkIdType & nCellfaces,
308  vtkCellArray *cellArray,
309  vtkIdTypeArray *faces);
310 
311  static void DecomposeAPolyhedronCell(vtkIdType * polyhedronCellStream,
312  vtkIdType & nCellpts,
313  vtkIdType & nCellfaces,
314  vtkCellArray *cellArray,
315  vtkIdTypeArray *faces);
316 
329  static void DecomposeAPolyhedronCell(vtkIdType nCellFaces,
330  vtkIdType * inFaceStream,
331  vtkIdType & nCellpts,
332  vtkCellArray * cellArray,
333  vtkIdTypeArray * faces);
334 
341  static void ConvertFaceStreamPointIds(vtkIdList * faceStream,
342  vtkIdType * idMap);
343 
349  static void ConvertFaceStreamPointIds(vtkIdType nfaces,
350  vtkIdType * faceStream,
351  vtkIdType * idMap);
352 
353 
354 protected:
356  ~vtkUnstructuredGrid() VTK_OVERRIDE;
357 
358  // used by GetCell method
359  vtkVertex *Vertex;
360  vtkPolyVertex *PolyVertex;
361  vtkLine *Line;
362  vtkPolyLine *PolyLine;
363  vtkTriangle *Triangle;
364  vtkTriangleStrip *TriangleStrip;
365  vtkPixel *Pixel;
366  vtkQuad *Quad;
367  vtkPolygon *Polygon;
368  vtkTetra *Tetra;
369  vtkVoxel *Voxel;
370  vtkHexahedron *Hexahedron;
371  vtkWedge *Wedge;
372  vtkPyramid *Pyramid;
373  vtkPentagonalPrism *PentagonalPrism;
374  vtkHexagonalPrism *HexagonalPrism;
375  vtkQuadraticEdge *QuadraticEdge;
376  vtkQuadraticTriangle *QuadraticTriangle;
377  vtkQuadraticQuad *QuadraticQuad;
378  vtkQuadraticPolygon *QuadraticPolygon;
379  vtkQuadraticTetra *QuadraticTetra;
380  vtkQuadraticHexahedron *QuadraticHexahedron;
381  vtkQuadraticWedge *QuadraticWedge;
382  vtkQuadraticPyramid *QuadraticPyramid;
383  vtkQuadraticLinearQuad *QuadraticLinearQuad;
384  vtkBiQuadraticQuad *BiQuadraticQuad;
385  vtkTriQuadraticHexahedron *TriQuadraticHexahedron;
386  vtkQuadraticLinearWedge *QuadraticLinearWedge;
387  vtkBiQuadraticQuadraticWedge *BiQuadraticQuadraticWedge;
388  vtkBiQuadraticQuadraticHexahedron *BiQuadraticQuadraticHexahedron;
389  vtkBiQuadraticTriangle *BiQuadraticTriangle;
390  vtkCubicLine *CubicLine;
391  vtkConvexPointSet *ConvexPointSet;
392  vtkPolyhedron *Polyhedron;
393  vtkEmptyCell *EmptyCell;
394 
395  // points inherited
396  // point data (i.e., scalars, vectors, normals, tcoords) inherited
397  vtkCellArray *Connectivity;
398  vtkCellLinks *Links;
400  vtkIdTypeArray *Locations;
401 
402  // Special support for polyhedra/cells with explicit face representations.
403  // The Faces class represents polygonal faces using a modified vtkCellArray
404  // structure. Each cell face list begins with the total number of faces in
405  // the cell, followed by a vtkCellArray data organization
406  // (n,i,j,k,n,i,j,k,...).
408  vtkIdTypeArray *FaceLocations;
409 
410 private:
411  // Hide these from the user and the compiler.
412  vtkUnstructuredGrid(const vtkUnstructuredGrid&) VTK_DELETE_FUNCTION;
413  void operator=(const vtkUnstructuredGrid&) VTK_DELETE_FUNCTION;
414 
415  void Cleanup();
416 };
417 
418 #endif
virtual void Allocate(vtkIdType numCells=1000, int extSize=1000)=0
Allocate memory for the number of cells indicated.
static vtkDataObject * New()
cell represents a parabolic, 13-node isoparametric pyramid
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
a cell that represents a 3D point
Definition: vtkVertex.h:30
a 3D cell that represents a linear pyramid
Definition: vtkPyramid.h:43
virtual void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts)=0
Replace the points defining cell "cellId" with a new set of points.
a cell that represents an orthogonal quadrilateral
Definition: vtkPixel.h:34
cell represents a parabolic, 9-node isoparametric quad
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:35
dynamic, self-adjusting array of vtkIdType
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:29
int vtkIdType
Definition: vtkType.h:345
cell represents a set of 0D vertices
Definition: vtkPolyVertex.h:32
void Squeeze() override
Reclaim any unused memory.
cell represents a parabolic, 18-node isoparametric wedge
provides thread-safe access to cells
cell represents a biquadratic, 24-node isoparametric hexahedron
a 3D cell that represents a prism with hexagonal base
cell represents a cubic , isoparametric 1D line
Definition: vtkCubicLine.h:42
a cell that represents a triangle strip
a 3D cell that represents a tetrahedron
Definition: vtkTetra.h:41
a 3D cell that represents a convex prism with pentagonal base
cell represents a 1D line
Definition: vtkLine.h:29
abstract class to specify cell behavior
Definition: vtkCell.h:56
a cell that represents a 3D orthogonal parallelepiped
Definition: vtkVoxel.h:38
cell represents a parabolic, 8-node isoparametric quad
a simple class to control print indentation
Definition: vtkIndent.h:33
list of point or cell ids
Definition: vtkIdList.h:30
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
Topological inquiry to get points defining cell.
dataset represents arbitrary combinations of all possible cell types
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:39
cell represents a parabolic, isoparametric triangle
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:41
cell represents a parabolic, 10-node isoparametric tetrahedron
a 3D cell defined by a set of convex points
virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds)
Topological inquiry to get all cells using list of points exclusive of cell specified (e...
dynamic, self-adjusting array of unsigned char
object to represent cell connectivity
Definition: vtkCellArray.h:44
cell represents a parabolic, 27-node isoparametric hexahedron
a cell that represents a parabolic n-sided polygon
cell represents a parabolic, isoparametric edge
a cell that represents a triangle
Definition: vtkTriangle.h:35
cell represents a parabolic, 20-node isoparametric hexahedron
cell represents a parabolic, isoparametric triangle
cell represents a parabolic, 15-node isoparametric wedge
Store zero or more vtkInformation instances.
a 3D cell defined by a set of polygonal faces
Definition: vtkPolyhedron.h:57
vtkCellArray * GetCells()
Efficient cell iterator for vtkDataSet topologies.
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
vtkIdTypeArray * GetFaceLocations()
Get pointer to faces and facelocations.
general representation of visualization data
Definition: vtkDataObject.h:58
cell represents a, 12-node isoparametric wedge
cell represents a quadratic-linear, 6-node isoparametric quad
dataset represents arbitrary combinations of all possible cell types.
a 3D cell that represents a linear wedge
Definition: vtkWedge.h:43
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:95
cell represents a set of 1D lines
Definition: vtkPolyLine.h:36
vtkIdTypeArray * GetCellLocationsArray()