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 vtkLagrangeCurve;
50 class vtkLagrangeTetra;
51 class vtkLagrangeWedge;
52 class vtkLine;
53 class vtkPixel;
54 class vtkPolyLine;
55 class vtkPolyVertex;
56 class vtkPolygon;
57 class vtkPyramid;
58 class vtkPentagonalPrism;
59 class vtkHexagonalPrism;
60 class vtkQuad;
61 class vtkQuadraticEdge;
63 class vtkQuadraticWedge;
66 class vtkQuadraticQuad;
67 class vtkQuadraticTetra;
69 class vtkTetra;
70 class vtkTriangle;
71 class vtkTriangleStrip;
73 class vtkVertex;
74 class vtkVoxel;
75 class vtkWedge;
79 class vtkBiQuadraticQuad;
83 class vtkCubicLine;
84 class vtkPolyhedron;
85 class vtkIdTypeArray;
86 
87 class VTKCOMMONDATAMODEL_EXPORT vtkUnstructuredGrid :
89 {
90 public:
91  static vtkUnstructuredGrid *New();
92 
94  void PrintSelf(ostream& os, vtkIndent indent) override;
95 
99  int GetDataObjectType() override {return VTK_UNSTRUCTURED_GRID;};
100 
107  void Allocate(vtkIdType numCells=1000, int extSize=1000) override;
108 
110 
113  void Reset();
114  void CopyStructure(vtkDataSet *ds) override;
115  vtkIdType GetNumberOfCells() override;
116  using vtkDataSet::GetCell;
117  vtkCell *GetCell(vtkIdType cellId) override;
118  void GetCell(vtkIdType cellId, vtkGenericCell *cell) override;
119  void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
120  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) override;
121  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override;
122  vtkCellIterator* NewCellIterator() override;
124 
125  int GetCellType(vtkIdType cellId) override;
126  vtkUnsignedCharArray* GetCellTypesArray() { return this->Types; }
127  vtkIdTypeArray* GetCellLocationsArray() { return this->Locations; }
128  void Squeeze() override;
129  void Initialize() override;
130  int GetMaxCellSize() override;
131  void BuildLinks();
132  vtkCellLinks *GetCellLinks() {return this->Links;};
133  virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts,
134  vtkIdType* &pts);
135 
142  void GetFaceStream(vtkIdType cellId, vtkIdList *ptIds);
143 
152  void GetFaceStream(vtkIdType cellId, vtkIdType& nfaces, vtkIdType* &ptIds);
153 
155 
168  void SetCells(int type, vtkCellArray *cells);
169  void SetCells(int *types, vtkCellArray *cells);
170  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
171  vtkCellArray *cells);
172  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
173  vtkCellArray *cells, vtkIdTypeArray *faceLocations,
174  vtkIdTypeArray *faces);
176 
177  vtkCellArray *GetCells() {return this->Connectivity;};
178  vtkIdType InsertNextLinkedCell(int type, int npts, const vtkIdType pts[]) VTK_SIZEHINT(pts, npts);
179  void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId);
180  void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId);
181  void ResizeCellList(vtkIdType ptId, int size);
182 
189  void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
190  vtkIdList *cellIds) override;
191 
193 
196  virtual int GetPiece();
197  virtual int GetNumberOfPieces();
199 
203  virtual int GetGhostLevel();
204 
213  unsigned long GetActualMemorySize() override;
214 
216 
219  void ShallowCopy(vtkDataObject *src) override;
220  void DeepCopy(vtkDataObject *src) override;
222 
228  void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array) override;
229 
233  int IsHomogeneous() override;
234 
239  void RemoveGhostCells();
240 
242 
246  static vtkUnstructuredGrid* GetData(vtkInformationVector* v, int i=0);
248 
252  vtkIdType *GetFaces(vtkIdType cellId);
253 
255 
258  vtkIdTypeArray* GetFaces(){return this->Faces;};
259  vtkIdTypeArray* GetFaceLocations(){return this->FaceLocations;};
261 
269  int InitializeFacesRepresentation(vtkIdType numPrevCells);
270 
278  virtual vtkMTimeType GetMeshMTime();
279 
292  static void DecomposeAPolyhedronCell(vtkCellArray *polyhedronCellArray,
293  vtkIdType & nCellpts,
294  vtkIdType & nCellfaces,
295  vtkCellArray *cellArray,
296  vtkIdTypeArray *faces);
297 
298  static void DecomposeAPolyhedronCell(vtkIdType * polyhedronCellStream,
299  vtkIdType & nCellpts,
300  vtkIdType & nCellfaces,
301  vtkCellArray *cellArray,
302  vtkIdTypeArray *faces);
303 
316  static void DecomposeAPolyhedronCell(vtkIdType nCellFaces,
317  const vtkIdType * inFaceStream,
318  vtkIdType & nCellpts,
319  vtkCellArray * cellArray,
320  vtkIdTypeArray * faces);
321 
328  static void ConvertFaceStreamPointIds(vtkIdList * faceStream,
329  vtkIdType * idMap);
330 
336  static void ConvertFaceStreamPointIds(vtkIdType nfaces,
337  vtkIdType * faceStream,
338  vtkIdType * idMap);
339 
340 
341 protected:
343  ~vtkUnstructuredGrid() override;
344 
345  // used by GetCell method
387 
388  // points inherited
389  // point data (i.e., scalars, vectors, normals, tcoords) inherited
394 
395  // Special support for polyhedra/cells with explicit face representations.
396  // The Faces class represents polygonal faces using a modified vtkCellArray
397  // structure. Each cell face list begins with the total number of faces in
398  // the cell, followed by a vtkCellArray data organization
399  // (n,i,j,k,n,i,j,k,...).
402 
403  vtkIdType InternalInsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[]) override;
404  vtkIdType InternalInsertNextCell(int type, vtkIdList *ptIds) override;
405  vtkIdType InternalInsertNextCell(int type, vtkIdType npts, const vtkIdType ptIds[],
406  vtkIdType nfaces, const vtkIdType faces[]) override;
407  void InternalReplaceCell(vtkIdType cellId, int npts, const vtkIdType pts[]) override;
408 
409 private:
410  // Hide these from the user and the compiler.
411  vtkUnstructuredGrid(const vtkUnstructuredGrid&) = delete;
412  void operator=(const vtkUnstructuredGrid&) = delete;
413 
414  void Cleanup();
415 };
416 
417 #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:62
a cell that represents a 3D point
Definition: vtkVertex.h:36
a 3D cell that represents a linear pyramid
Definition: vtkPyramid.h:49
vtkQuadraticWedge * QuadraticWedge
a cell that represents an orthogonal quadrilateral
Definition: vtkPixel.h:40
cell represents a parabolic, 9-node isoparametric quad
vtkQuadraticTriangle * QuadraticTriangle
vtkPentagonalPrism * PentagonalPrism
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
vtkQuadraticHexahedron * QuadraticHexahedron
int vtkIdType
Definition: vtkType.h:347
cell represents a set of 0D vertices
Definition: vtkPolyVertex.h:38
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:45
vtkBiQuadraticQuad * BiQuadraticQuad
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
vtkIdTypeArray * FaceLocations
cell represents a 1D line
Definition: vtkLine.h:35
abstract class to specify cell behavior
Definition: vtkCell.h:59
A 3D cell that represents an arbitrary order Lagrange wedge.
a cell that represents a 3D orthogonal parallelepiped
Definition: vtkVoxel.h:44
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.
a simple class to control print indentation
Definition: vtkIndent.h:39
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:36
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:45
vtkLagrangeTetra * LagrangeTetra
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...
#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:50
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:41
cell represents a parabolic, 20-node isoparametric hexahedron
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:60
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:64
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:49
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:42
virtual int GetCellType(vtkIdType cellId)=0
Get type of cell with cellId such that: 0 <= cellId < NumberOfCells.
vtkIdTypeArray * GetCellLocationsArray()