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 
119  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds) override;
120 
130  vtkIdType InsertNextCell(int type, vtkIdList *ptIds) override;
131 
132  // Description:
133  // Insert/create a polyhedron cell. npts is the number of unique points in
134  // the cell. pts is the list of the unique cell point Ids. nfaces is the
135  // number of faces in the cell. faces is the face-stream
136  // [numFace0Pts, id1, id2, id3, numFace1Pts,id1, id2, id3, ...].
137  // All point Ids are global.
138  // Make sure you have called Allocate() before calling this method
139  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds,
140  vtkIdType nfaces, vtkIdType *faces) override;
141 
143 
146  void Reset();
147  void CopyStructure(vtkDataSet *ds) override;
148  vtkIdType GetNumberOfCells() override;
149  using vtkDataSet::GetCell;
150  vtkCell *GetCell(vtkIdType cellId) override;
151  void GetCell(vtkIdType cellId, vtkGenericCell *cell) override;
152  void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
153  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) override;
154  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override;
155  vtkCellIterator* NewCellIterator() override;
157 
158  int GetCellType(vtkIdType cellId) override;
159  vtkUnsignedCharArray* GetCellTypesArray() { return this->Types; }
160  vtkIdTypeArray* GetCellLocationsArray() { return this->Locations; }
161  void Squeeze() override;
162  void Initialize() override;
163  int GetMaxCellSize() override;
164  void BuildLinks();
165  vtkCellLinks *GetCellLinks() {return this->Links;};
166  virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts,
167  vtkIdType* &pts);
168 
175  void GetFaceStream(vtkIdType cellId, vtkIdList *ptIds);
176 
185  void GetFaceStream(vtkIdType cellId, vtkIdType& nfaces, vtkIdType* &ptIds);
186 
188 
201  void SetCells(int type, vtkCellArray *cells);
202  void SetCells(int *types, vtkCellArray *cells);
203  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
204  vtkCellArray *cells);
205  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
206  vtkCellArray *cells, vtkIdTypeArray *faceLocations,
207  vtkIdTypeArray *faces);
209 
210  vtkCellArray *GetCells() {return this->Connectivity;};
211  void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts) override;
212  vtkIdType InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
213  void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId);
214  void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId);
215  void ResizeCellList(vtkIdType ptId, int size);
216 
223  void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
224  vtkIdList *cellIds) override;
225 
227 
230  virtual int GetPiece();
231  virtual int GetNumberOfPieces();
233 
237  virtual int GetGhostLevel();
238 
247  unsigned long GetActualMemorySize() override;
248 
250 
253  void ShallowCopy(vtkDataObject *src) override;
254  void DeepCopy(vtkDataObject *src) override;
256 
262  void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array) override;
263 
267  int IsHomogeneous() override;
268 
273  void RemoveGhostCells();
274 
276 
280  static vtkUnstructuredGrid* GetData(vtkInformationVector* v, int i=0);
282 
286  vtkIdType *GetFaces(vtkIdType cellId);
287 
289 
292  vtkIdTypeArray* GetFaces(){return this->Faces;};
293  vtkIdTypeArray* GetFaceLocations(){return this->FaceLocations;};
295 
303  int InitializeFacesRepresentation(vtkIdType numPrevCells);
304 
312  virtual vtkMTimeType GetMeshMTime();
313 
326  static void DecomposeAPolyhedronCell(vtkCellArray *polyhedronCellArray,
327  vtkIdType & nCellpts,
328  vtkIdType & nCellfaces,
329  vtkCellArray *cellArray,
330  vtkIdTypeArray *faces);
331 
332  static void DecomposeAPolyhedronCell(vtkIdType * polyhedronCellStream,
333  vtkIdType & nCellpts,
334  vtkIdType & nCellfaces,
335  vtkCellArray *cellArray,
336  vtkIdTypeArray *faces);
337 
350  static void DecomposeAPolyhedronCell(vtkIdType nCellFaces,
351  vtkIdType * inFaceStream,
352  vtkIdType & nCellpts,
353  vtkCellArray * cellArray,
354  vtkIdTypeArray * faces);
355 
362  static void ConvertFaceStreamPointIds(vtkIdList * faceStream,
363  vtkIdType * idMap);
364 
370  static void ConvertFaceStreamPointIds(vtkIdType nfaces,
371  vtkIdType * faceStream,
372  vtkIdType * idMap);
373 
374 
375 protected:
377  ~vtkUnstructuredGrid() override;
378 
379  // used by GetCell method
421 
422  // points inherited
423  // point data (i.e., scalars, vectors, normals, tcoords) inherited
428 
429  // Special support for polyhedra/cells with explicit face representations.
430  // The Faces class represents polygonal faces using a modified vtkCellArray
431  // structure. Each cell face list begins with the total number of faces in
432  // the cell, followed by a vtkCellArray data organization
433  // (n,i,j,k,n,i,j,k,...).
436 
437 private:
438  // Hide these from the user and the compiler.
439  vtkUnstructuredGrid(const vtkUnstructuredGrid&) = delete;
440  void operator=(const vtkUnstructuredGrid&) = delete;
441 
442  void Cleanup();
443 };
444 
445 #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
vtkLagrangeTriangle * LagrangeTriangle
Store vtkAlgorithm input/output information.
vtkCellLinks * GetCellLinks()
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
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
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
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:345
cell represents a set of 0D vertices
Definition: vtkPolyVertex.h:38
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: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 cell that represents a 3D orthogonal parallelepiped
Definition: vtkVoxel.h:44
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: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...
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
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
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: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
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()