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 
113  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds) override;
114 
124  vtkIdType InsertNextCell(int type, vtkIdList *ptIds) override;
125 
126  // Description:
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) override;
135 
137 
140  void Reset();
141  void CopyStructure(vtkDataSet *ds) override;
142  vtkIdType GetNumberOfCells() override;
143  using vtkDataSet::GetCell;
144  vtkCell *GetCell(vtkIdType cellId) override;
145  void GetCell(vtkIdType cellId, vtkGenericCell *cell) override;
146  void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
147  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) override;
148  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override;
149  vtkCellIterator* NewCellIterator() override;
151 
152  int GetCellType(vtkIdType cellId) override;
153  vtkUnsignedCharArray* GetCellTypesArray() { return this->Types; }
154  vtkIdTypeArray* GetCellLocationsArray() { return this->Locations; }
155  void Squeeze() override;
156  void Initialize() override;
157  int GetMaxCellSize() override;
158  void BuildLinks();
159  vtkCellLinks *GetCellLinks() {return this->Links;};
160  virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts,
161  vtkIdType* &pts);
162 
169  void GetFaceStream(vtkIdType cellId, vtkIdList *ptIds);
170 
179  void GetFaceStream(vtkIdType cellId, vtkIdType& nfaces, vtkIdType* &ptIds);
180 
182 
195  void SetCells(int type, vtkCellArray *cells);
196  void SetCells(int *types, vtkCellArray *cells);
197  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
198  vtkCellArray *cells);
199  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
200  vtkCellArray *cells, vtkIdTypeArray *faceLocations,
201  vtkIdTypeArray *faces);
203 
204  vtkCellArray *GetCells() {return this->Connectivity;};
205  void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts) override;
206  vtkIdType InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
207  void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId);
208  void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId);
209  void ResizeCellList(vtkIdType ptId, int size);
210 
217  void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
218  vtkIdList *cellIds) override;
219 
221 
224  virtual int GetPiece();
225  virtual int GetNumberOfPieces();
227 
231  virtual int GetGhostLevel();
232 
241  unsigned long GetActualMemorySize() override;
242 
244 
247  void ShallowCopy(vtkDataObject *src) override;
248  void DeepCopy(vtkDataObject *src) override;
250 
256  void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array) override;
257 
261  int IsHomogeneous() override;
262 
267  void RemoveGhostCells();
268 
270 
274  static vtkUnstructuredGrid* GetData(vtkInformationVector* v, int i=0);
276 
280  vtkIdType *GetFaces(vtkIdType cellId);
281 
283 
286  vtkIdTypeArray* GetFaces(){return this->Faces;};
287  vtkIdTypeArray* GetFaceLocations(){return this->FaceLocations;};
289 
297  int InitializeFacesRepresentation(vtkIdType numPrevCells);
298 
306  virtual vtkMTimeType GetMeshMTime();
307 
320  static void DecomposeAPolyhedronCell(vtkCellArray *polyhedronCellArray,
321  vtkIdType & nCellpts,
322  vtkIdType & nCellfaces,
323  vtkCellArray *cellArray,
324  vtkIdTypeArray *faces);
325 
326  static void DecomposeAPolyhedronCell(vtkIdType * polyhedronCellStream,
327  vtkIdType & nCellpts,
328  vtkIdType & nCellfaces,
329  vtkCellArray *cellArray,
330  vtkIdTypeArray *faces);
331 
344  static void DecomposeAPolyhedronCell(vtkIdType nCellFaces,
345  vtkIdType * inFaceStream,
346  vtkIdType & nCellpts,
347  vtkCellArray * cellArray,
348  vtkIdTypeArray * faces);
349 
356  static void ConvertFaceStreamPointIds(vtkIdList * faceStream,
357  vtkIdType * idMap);
358 
364  static void ConvertFaceStreamPointIds(vtkIdType nfaces,
365  vtkIdType * faceStream,
366  vtkIdType * idMap);
367 
368 
369 protected:
371  ~vtkUnstructuredGrid() override;
372 
373  // used by GetCell method
415 
416  // points inherited
417  // point data (i.e., scalars, vectors, normals, tcoords) inherited
422 
423  // Special support for polyhedra/cells with explicit face representations.
424  // The Faces class represents polygonal faces using a modified vtkCellArray
425  // structure. Each cell face list begins with the total number of faces in
426  // the cell, followed by a vtkCellArray data organization
427  // (n,i,j,k,n,i,j,k,...).
430 
431 private:
432  // Hide these from the user and the compiler.
433  vtkUnstructuredGrid(const vtkUnstructuredGrid&) = delete;
434  void operator=(const vtkUnstructuredGrid&) = delete;
435 
436  void Cleanup();
437 };
438 
439 #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: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.
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....
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
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
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()