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 
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
394 
395  // points inherited
396  // point data (i.e., scalars, vectors, normals, tcoords) inherited
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,...).
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 vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds)=0
Insert/create cell in object by type and list of point ids defining cell topology.
vtkIdTypeArray * Faces
virtual void Allocate(vtkIdType numCells=1000, int extSize=1000)=0
Allocate memory for the number of cells indicated.
static vtkUnstructuredGridBase * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
virtual vtkIdType GetNumberOfCells()=0
Determine the number of cells composing the dataset.
virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)=0
Topological inquiry to get cells using point.
vtkTriangleStrip * TriangleStrip
static vtkDataObject * New()
cell represents a parabolic, 13-node isoparametric pyramid
vtkTriQuadraticHexahedron * TriQuadraticHexahedron
Store vtkAlgorithm input/output information.
vtkCellLinks * GetCellLinks()
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
vtkQuadraticWedge * QuadraticWedge
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
vtkQuadraticTriangle * QuadraticTriangle
vtkPentagonalPrism * PentagonalPrism
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
vtkQuadraticHexahedron * QuadraticHexahedron
int vtkIdType
Definition: vtkType.h:345
cell represents a set of 0D vertices
Definition: vtkPolyVertex.h:32
void Squeeze() override
Reclaim any unused memory.
vtkQuadraticTetra * QuadraticTetra
cell represents a parabolic, 18-node isoparametric wedge
provides thread-safe access to cells
vtkPolyhedron * Polyhedron
cell represents a biquadratic, 24-node isoparametric hexahedron
a 3D cell that represents a prism with hexagonal base
vtkHexagonalPrism * HexagonalPrism
cell represents a cubic , isoparametric 1D line
Definition: vtkCubicLine.h:42
vtkBiQuadraticQuad * BiQuadraticQuad
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
vtkIdTypeArray * FaceLocations
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
virtual void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array)=0
Fill vtkIdTypeArray container with list of cell Ids.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkQuadraticQuad * QuadraticQuad
virtual int GetMaxCellSize()=0
Convenience method returns largest cell size in dataset.
vtkIdTypeArray * GetFaces()
Get pointer to faces and facelocations.
list of point or cell ids
Definition: vtkIdList.h:30
void Initialize() override
Reset to an empty state and free any memory.
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
Topological inquiry to get points defining cell.
dataset represents arbitrary combinations of all possible cell types
vtkBiQuadraticTriangle * BiQuadraticTriangle
vtkHexahedron * Hexahedron
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
vtkQuadraticLinearWedge * QuadraticLinearWedge
vtkUnsignedCharArray * GetCellTypesArray()
vtkBiQuadraticQuadraticWedge * BiQuadraticQuadraticWedge
object to represent cell connectivity
Definition: vtkCellArray.h:44
vtkBiQuadraticQuadraticHexahedron * BiQuadraticQuadraticHexahedron
cell represents a parabolic, 27-node isoparametric hexahedron
vtkCellIterator * NewCellIterator() override
Return an iterator that traverses the cells in this data set.
a cell that represents a parabolic n-sided polygon
cell represents a parabolic, isoparametric edge
virtual int IsHomogeneous()=0
Traverse cells and determine if cells are all of the same type.
a cell that represents a triangle
Definition: vtkTriangle.h:35
cell represents a parabolic, 20-node isoparametric hexahedron
int GetDataObjectType() override
Standard vtkDataSet API methods.
vtkUnsignedCharArray * Types
void DeepCopy(vtkDataObject *src) override
Shallow and Deep copy.
cell represents a parabolic, isoparametric triangle
cell represents a parabolic, 15-node isoparametric wedge
vtkQuadraticLinearQuad * QuadraticLinearQuad
vtkConvexPointSet * ConvexPointSet
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.
vtkPolyVertex * PolyVertex
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
void ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
vtkIdTypeArray * GetFaceLocations()
Get pointer to faces and facelocations.
vtkCellArray * Connectivity
void CopyStructure(vtkDataSet *pd) override
Copy the geometric structure of an input point set object.
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
vtkQuadraticPolygon * QuadraticPolygon
dataset represents arbitrary combinations of all possible cell types.
vtkQuadraticEdge * QuadraticEdge
a 3D cell that represents a linear wedge
Definition: vtkWedge.h:43
vtkIdTypeArray * Locations
virtual vtkCell * GetCell(vtkIdType cellId)=0
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
virtual void GetCellBounds(vtkIdType cellId, double bounds[6])
Get the bounds of the cell with cellId such that: 0 <= cellId < NumberOfCells.
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:95
vtkQuadraticPyramid * QuadraticPyramid
cell represents a set of 1D lines
Definition: vtkPolyLine.h:36
virtual int GetCellType(vtkIdType cellId)=0
Get type of cell with cellId such that: 0 <= cellId < NumberOfCells.
vtkIdTypeArray * GetCellLocationsArray()