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 =========================================================================*/
32 #ifndef vtkUnstructuredGrid_h
33 #define vtkUnstructuredGrid_h
34 
35 #include "vtkCommonDataModelModule.h" // For export macro
37 
38 class vtkCellArray;
39 class vtkCellLinks;
40 class vtkConvexPointSet;
41 class vtkEmptyCell;
42 class vtkHexahedron;
43 class vtkIdList;
44 class vtkIdTypeArray;
45 class vtkLine;
46 class vtkPixel;
47 class vtkPolyLine;
48 class vtkPolyVertex;
49 class vtkPolygon;
50 class vtkPyramid;
51 class vtkPentagonalPrism;
52 class vtkHexagonalPrism;
53 class vtkQuad;
54 class vtkQuadraticEdge;
56 class vtkQuadraticWedge;
59 class vtkQuadraticQuad;
60 class vtkQuadraticTetra;
62 class vtkTetra;
63 class vtkTriangle;
64 class vtkTriangleStrip;
66 class vtkVertex;
67 class vtkVoxel;
68 class vtkWedge;
72 class vtkBiQuadraticQuad;
76 class vtkCubicLine;
77 class vtkPolyhedron;
78 class vtkIdTypeArray;
79 
82 {
83 public:
84  static vtkUnstructuredGrid *New();
85 
87  void PrintSelf(ostream& os, vtkIndent indent);
88 
90  int GetDataObjectType() {return VTK_UNSTRUCTURED_GRID;};
91 
96  virtual void Allocate(vtkIdType numCells=1000, int extSize=1000);
97 
107  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds);
108 
116  vtkIdType InsertNextCell(int type, vtkIdList *ptIds);
117 
118  // Desciption:
119  // Insert/create a polyhedron cell. npts is the number of unique points in
120  // the cell. pts is the list of the unique cell point Ids. nfaces is the
121  // number of faces in the cell. faces is the face-stream
122  // [numFace0Pts, id1, id2, id3, numFace1Pts,id1, id2, id3, ...].
123  // All point Ids are global.
124  // Make sure you have called Allocate() before calling this method
125  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds,
126  vtkIdType nfaces, vtkIdType *faces);
127 
129 
130  void Reset();
131  virtual void CopyStructure(vtkDataSet *ds);
133  virtual vtkCell *GetCell(vtkIdType cellId);
134  virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell);
135  virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
136  virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
137  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds);
140 
141  int GetCellType(vtkIdType cellId);
142  vtkUnsignedCharArray* GetCellTypesArray() { return this->Types; }
143  vtkIdTypeArray* GetCellLocationsArray() { return this->Locations; }
144  void Squeeze();
145  void Initialize();
146  int GetMaxCellSize();
147  void BuildLinks();
148  vtkCellLinks *GetCellLinks() {return this->Links;};
149  virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts,
150  vtkIdType* &pts);
151 
157  void GetFaceStream(vtkIdType cellId, vtkIdList *ptIds);
158 
164  void GetFaceStream(vtkIdType cellId, vtkIdType& nfaces, vtkIdType* &ptIds);
165 
167 
179  void SetCells(int type, vtkCellArray *cells);
180  void SetCells(int *types, vtkCellArray *cells);
181  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
182  vtkCellArray *cells);
183  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
184  vtkCellArray *cells, vtkIdTypeArray *faceLocations,
185  vtkIdTypeArray *faces);
187 
188  vtkCellArray *GetCells() {return this->Connectivity;};
189  void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts);
190  vtkIdType InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
191  void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId);
192  void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId);
193  void ResizeCellList(vtkIdType ptId, int size);
194 
196 
199  virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
200  vtkIdList *cellIds);
202 
204 
206  virtual int GetPiece();
207  virtual int GetNumberOfPieces();
209 
211  virtual int GetGhostLevel();
212 
218  unsigned long GetActualMemorySize();
219 
221 
222  virtual void ShallowCopy(vtkDataObject *src);
223  virtual void DeepCopy(vtkDataObject *src);
225 
229  void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array);
230 
232  int IsHomogeneous();
233 
236  void RemoveGhostCells();
237 
238  //BTX
240 
242  static vtkUnstructuredGrid* GetData(vtkInformationVector* v, int i=0);
243  //ETX
245 
247  vtkIdType *GetFaces(vtkIdType cellId);
248 
250 
251  vtkIdTypeArray* GetFaces(){return this->Faces;};
252  vtkIdTypeArray* GetFaceLocations(){return this->FaceLocations;};
254 
261  int InitializeFacesRepresentation(vtkIdType numPrevCells);
262 
264 
273  static void DecomposeAPolyhedronCell(vtkCellArray *polyhedronCellArray,
274  vtkIdType & nCellpts,
275  vtkIdType & nCellfaces,
276  vtkCellArray *cellArray,
277  vtkIdTypeArray *faces);
279 
280  static void DecomposeAPolyhedronCell(vtkIdType * polyhedronCellStream,
281  vtkIdType & nCellpts,
282  vtkIdType & nCellfaces,
283  vtkCellArray *cellArray,
284  vtkIdTypeArray *faces);
285 
287 
296  static void DecomposeAPolyhedronCell(vtkIdType nCellFaces,
297  vtkIdType * inFaceStream,
298  vtkIdType & nCellpts,
299  vtkCellArray * cellArray,
300  vtkIdTypeArray * faces);
302 
304 
308  static void ConvertFaceStreamPointIds(vtkIdList * faceStream,
309  vtkIdType * idMap);
311 
313 
317  static void ConvertFaceStreamPointIds(vtkIdType nfaces,
318  vtkIdType * faceStream,
319  vtkIdType * idMap);
321 
322 
323 protected:
326 
327  // used by GetCell method
363 
364  // points inherited
365  // point data (i.e., scalars, vectors, normals, tcoords) inherited
370 
371  // Special support for polyhedra/cells with explicit face representations.
372  // The Faces class represents polygonal faces using a modified vtkCellArray
373  // structure. Each cell face list begins with the total number of faces in
374  // the cell, followed by a vtkCellArray data organization
375  // (n,i,j,k,n,i,j,k,...).
378 
379 private:
380  // Hide these from the user and the compiler.
381  vtkUnstructuredGrid(const vtkUnstructuredGrid&); // Not implemented.
382  void operator=(const vtkUnstructuredGrid&); // Not implemented.
383 
384  void Cleanup();
385 };
386 
387 #endif
virtual vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds)=0
vtkIdTypeArray * Faces
virtual void Allocate(vtkIdType numCells=1000, int extSize=1000)=0
static vtkUnstructuredGridBase * GetData(vtkInformation *info)
virtual vtkIdType GetNumberOfCells()=0
virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)=0
vtkTriangleStrip * TriangleStrip
static vtkDataObject * New()
cell represents a parabolic, 13-node isoparametric pyramid
vtkTriQuadraticHexahedron * TriQuadraticHexahedron
Store vtkAlgorithm input/output information.
vtkCellLinks * GetCellLinks()
void DeepCopy(vtkDataObject *src)
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
a cell that represents a 3D point
Definition: vtkVertex.h:35
a 3D cell that represents a linear pyramid
Definition: vtkPyramid.h:48
vtkQuadraticWedge * QuadraticWedge
virtual void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts)=0
a cell that represents an orthogonal quadrilateral
Definition: vtkPixel.h:39
cell represents a parabolic, 9-node isoparametric quad
vtkQuadraticTriangle * QuadraticTriangle
vtkPentagonalPrism * PentagonalPrism
void CopyStructure(vtkDataSet *pd)
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:40
dynamic, self-adjusting array of vtkIdType
void Initialize()
unsigned long GetActualMemorySize()
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:31
vtkQuadraticHexahedron * QuadraticHexahedron
int vtkIdType
Definition: vtkType.h:275
cell represents a set of 0D vertices
Definition: vtkPolyVertex.h:37
void Squeeze()
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:44
vtkBiQuadraticQuad * BiQuadraticQuad
a cell that represents a triangle strip
a 3D cell that represents a tetrahedron
Definition: vtkTetra.h:46
a 3D cell that represents a prism with pentagonal base
vtkIdTypeArray * FaceLocations
cell represents a 1D line
Definition: vtkLine.h:34
abstract class to specify cell behavior
Definition: vtkCell.h:61
a cell that represents a 3D orthogonal parallelepiped
Definition: vtkVoxel.h:43
cell represents a parabolic, 8-node isoparametric quad
virtual void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array)=0
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkQuadraticQuad * QuadraticQuad
virtual int GetMaxCellSize()=0
vtkIdTypeArray * GetFaces()
list of point or cell ids
Definition: vtkIdList.h:35
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
dataset represents arbitrary combinations of all possible cell types
vtkBiQuadraticTriangle * BiQuadraticTriangle
vtkHexahedron * Hexahedron
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:44
cell represents a parabolic, isoparametric triangle
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:46
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)
dynamic, self-adjusting array of unsigned char
vtkQuadraticLinearWedge * QuadraticLinearWedge
vtkUnsignedCharArray * GetCellTypesArray()
vtkCellIterator * NewCellIterator()
vtkBiQuadraticQuadraticWedge * BiQuadraticQuadraticWedge
object to represent cell connectivity
Definition: vtkCellArray.h:49
vtkBiQuadraticQuadraticHexahedron * BiQuadraticQuadraticHexahedron
cell represents a parabolic, 27-node isoparametric hexahedron
a cell that represents a parabolic n-sided polygon
cell represents a parabolic, isoparametric edge
virtual int IsHomogeneous()=0
a cell that represents a triangle
Definition: vtkTriangle.h:40
cell represents a parabolic, 20-node isoparametric hexahedron
vtkUnsignedCharArray * Types
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:59
vtkCellArray * GetCells()
Efficient cell iterator for vtkDataSet topologies.
vtkPolyVertex * PolyVertex
vtkIdTypeArray * GetFaceLocations()
vtkCellArray * Connectivity
void ShallowCopy(vtkDataObject *src)
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. May be mapped onto a non-standa...
vtkQuadraticEdge * QuadraticEdge
#define VTKCOMMONDATAMODEL_EXPORT
a 3D cell that represents a linear wedge
Definition: vtkWedge.h:48
vtkIdTypeArray * Locations
virtual vtkCell * GetCell(vtkIdType cellId)=0
virtual void GetCellBounds(vtkIdType cellId, double bounds[6])
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:70
vtkQuadraticPyramid * QuadraticPyramid
cell represents a set of 1D lines
Definition: vtkPolyLine.h:41
virtual int GetCellType(vtkIdType cellId)=0
vtkIdTypeArray * GetCellLocationsArray()