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
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:62
a cell that represents a 3D point
Definition: vtkVertex.h:36
a 3D cell that represents a linear pyramid
Definition: vtkPyramid.h:49
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:40
cell represents a parabolic, 9-node isoparametric quad
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:41
dynamic, self-adjusting array of vtkIdType
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:32
int vtkIdType
Definition: vtkType.h:287
cell represents a set of 0D vertices
Definition: vtkPolyVertex.h:38
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:45
a cell that represents a triangle strip
a 3D cell that represents a tetrahedron
Definition: vtkTetra.h:47
a 3D cell that represents a convex prism with pentagonal base
cell represents a 1D line
Definition: vtkLine.h:35
abstract class to specify cell behavior
Definition: vtkCell.h:59
a cell that represents a 3D orthogonal parallelepiped
Definition: vtkVoxel.h:44
cell represents a parabolic, 8-node isoparametric quad
a simple class to control print indentation
Definition: vtkIndent.h:39
list of point or cell ids
Definition: vtkIdList.h:36
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:45
cell represents a parabolic, isoparametric triangle
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:47
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:50
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:41
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:60
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:64
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:49
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:91
cell represents a set of 1D lines
Definition: vtkPolyLine.h:42
vtkIdTypeArray * GetCellLocationsArray()