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 vtkLagrangeCurve;
44 class vtkLagrangeTetra;
45 class vtkLagrangeWedge;
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) override;
89 
93  int GetDataObjectType() override {return VTK_UNSTRUCTURED_GRID;};
94 
101  void Allocate(vtkIdType numCells=1000, int extSize=1000) override;
102 
104 
107  void Reset();
108  void CopyStructure(vtkDataSet *ds) override;
109  vtkIdType GetNumberOfCells() override;
110  using vtkDataSet::GetCell;
111  vtkCell *GetCell(vtkIdType cellId) override;
112  void GetCell(vtkIdType cellId, vtkGenericCell *cell) override;
113  void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
114  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) override;
115  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override;
116  vtkCellIterator* NewCellIterator() override;
118 
119  int GetCellType(vtkIdType cellId) override;
120  vtkUnsignedCharArray* GetCellTypesArray() { return this->Types; }
121  vtkIdTypeArray* GetCellLocationsArray() { return this->Locations; }
122  void Squeeze() override;
123  void Initialize() override;
124  int GetMaxCellSize() override;
125  void BuildLinks();
126  vtkCellLinks *GetCellLinks() {return this->Links;};
127  virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts,
128  vtkIdType* &pts);
129 
136  void GetFaceStream(vtkIdType cellId, vtkIdList *ptIds);
137 
146  void GetFaceStream(vtkIdType cellId, vtkIdType& nfaces, vtkIdType* &ptIds);
147 
149 
162  void SetCells(int type, vtkCellArray *cells);
163  void SetCells(int *types, vtkCellArray *cells);
164  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
165  vtkCellArray *cells);
166  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
167  vtkCellArray *cells, vtkIdTypeArray *faceLocations,
168  vtkIdTypeArray *faces);
170 
171  vtkCellArray *GetCells() {return this->Connectivity;};
172  vtkIdType InsertNextLinkedCell(int type, int npts, const vtkIdType pts[]) VTK_SIZEHINT(pts, npts);
173  void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId);
174  void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId);
175  void ResizeCellList(vtkIdType ptId, int size);
176 
183  void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
184  vtkIdList *cellIds) override;
185 
187 
190  virtual int GetPiece();
191  virtual int GetNumberOfPieces();
193 
197  virtual int GetGhostLevel();
198 
207  unsigned long GetActualMemorySize() override;
208 
210 
213  void ShallowCopy(vtkDataObject *src) override;
214  void DeepCopy(vtkDataObject *src) override;
216 
222  void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array) override;
223 
227  int IsHomogeneous() override;
228 
233  void RemoveGhostCells();
234 
236 
240  static vtkUnstructuredGrid* GetData(vtkInformationVector* v, int i=0);
242 
246  vtkIdType *GetFaces(vtkIdType cellId);
247 
249 
252  vtkIdTypeArray* GetFaces(){return this->Faces;};
253  vtkIdTypeArray* GetFaceLocations(){return this->FaceLocations;};
255 
263  int InitializeFacesRepresentation(vtkIdType numPrevCells);
264 
272  virtual vtkMTimeType GetMeshMTime();
273 
286  static void DecomposeAPolyhedronCell(vtkCellArray *polyhedronCellArray,
287  vtkIdType & nCellpts,
288  vtkIdType & nCellfaces,
289  vtkCellArray *cellArray,
290  vtkIdTypeArray *faces);
291 
292  static void DecomposeAPolyhedronCell(vtkIdType * polyhedronCellStream,
293  vtkIdType & nCellpts,
294  vtkIdType & nCellfaces,
295  vtkCellArray *cellArray,
296  vtkIdTypeArray *faces);
297 
310  static void DecomposeAPolyhedronCell(vtkIdType nCellFaces,
311  const vtkIdType * inFaceStream,
312  vtkIdType & nCellpts,
313  vtkCellArray * cellArray,
314  vtkIdTypeArray * faces);
315 
322  static void ConvertFaceStreamPointIds(vtkIdList * faceStream,
323  vtkIdType * idMap);
324 
330  static void ConvertFaceStreamPointIds(vtkIdType nfaces,
331  vtkIdType * faceStream,
332  vtkIdType * idMap);
333 
334 
335 protected:
337  ~vtkUnstructuredGrid() override;
338 
339  // used by GetCell method
381 
382  // points inherited
383  // point data (i.e., scalars, vectors, normals, tcoords) inherited
388 
389  // Special support for polyhedra/cells with explicit face representations.
390  // The Faces class represents polygonal faces using a modified vtkCellArray
391  // structure. Each cell face list begins with the total number of faces in
392  // the cell, followed by a vtkCellArray data organization
393  // (n,i,j,k,n,i,j,k,...).
396 
397  vtkIdType InternalInsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[]) override;
398  vtkIdType InternalInsertNextCell(int type, vtkIdList *ptIds) override;
399  vtkIdType InternalInsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[],
400  vtkIdType nfaces, const vtkIdType faces[]) override;
401  void InternalReplaceCell(vtkIdType cellId, int npts, const vtkIdType pts[]) override;
402 
403 private:
404  // Hide these from the user and the compiler.
405  vtkUnstructuredGrid(const vtkUnstructuredGrid&) = delete;
406  void operator=(const vtkUnstructuredGrid&) = delete;
407 
408  void Cleanup();
409 };
410 
411 #endif
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
vtkLagrangeTriangle * LagrangeTriangle
Store vtkAlgorithm input/output information.
vtkCellLinks * GetCellLinks()
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
vtkLagrangeWedge * LagrangeWedge
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
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:347
cell represents a set of 0D vertices
Definition: vtkPolyVertex.h:32
void Squeeze() override
Reclaim any unused memory.
A 3D cell that represents an arbitrary order Lagrange tetrahedron.
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
virtual vtkIdType InternalInsertNextCell(int type, vtkIdList *ptIds)=0
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 3D cell that represents an arbitrary order Lagrange wedge.
a cell that represents a 3D orthogonal parallelepiped
Definition: vtkVoxel.h:38
A 2D cell that represents an arbitrary order Lagrange triangle.
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.
vtkLagrangeHexahedron * LagrangeHexahedron
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
vtkLagrangeTetra * LagrangeTetra
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....
#define VTK_SIZEHINT(...)
dynamic, self-adjusting array of unsigned char
vtkQuadraticLinearWedge * QuadraticLinearWedge
vtkLagrangeQuadrilateral * LagrangeQuadrilateral
vtkUnsignedCharArray * GetCellTypesArray()
vtkBiQuadraticQuadraticWedge * BiQuadraticQuadraticWedge
object to represent cell connectivity
Definition: vtkCellArray.h:44
vtkBiQuadraticQuadraticHexahedron * BiQuadraticQuadraticHexahedron
virtual void InternalReplaceCell(vtkIdType cellId, int npts, const vtkIdType pts[])=0
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
vtkLagrangeCurve * LagrangeCurve
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
A 3D cell that represents an arbitrary order Lagrange hex.
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()