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 "vtkPointSet.h"
36 
37 class vtkCellArray;
38 class vtkCellLinks;
39 class vtkConvexPointSet;
40 class vtkEmptyCell;
41 class vtkHexahedron;
42 class vtkIdList;
43 class vtkIdTypeArray;
44 class vtkLine;
45 class vtkPixel;
46 class vtkPolyLine;
47 class vtkPolyVertex;
48 class vtkPolygon;
49 class vtkPyramid;
50 class vtkPentagonalPrism;
51 class vtkHexagonalPrism;
52 class vtkQuad;
53 class vtkQuadraticEdge;
55 class vtkQuadraticWedge;
57 class vtkQuadraticQuad;
58 class vtkQuadraticTetra;
60 class vtkTetra;
61 class vtkTriangle;
62 class vtkTriangleStrip;
64 class vtkVertex;
65 class vtkVoxel;
66 class vtkWedge;
70 class vtkBiQuadraticQuad;
74 class vtkCubicLine;
75 class vtkPolyhedron;
76 class vtkIdTypeArray;
77 
79 {
80 public:
81  static vtkUnstructuredGrid *New();
82 
84  void PrintSelf(ostream& os, vtkIndent indent);
85 
87 
89  virtual void Allocate(vtkIdType numCells=1000, int extSize=1000);
91 
100  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds);
101 
108  vtkIdType InsertNextCell(int type, vtkIdList *ptIds);
109 
110  // Desciption:
111  // Insert/create a polyhedron cell. npts is the number of unique points in
112  // the cell. pts is the list of the unique cell point Ids. nfaces is the
113  // number of faces in the cell. faces is the face-stream
114  // [numFace0Pts, id1, id2, id3, numFace1Pts,id1, id2, id3, ...].
115  // All point Ids are global.
116  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds,
117  vtkIdType nfaces, vtkIdType *faces);
118 
120 
121  void Reset();
122  virtual void CopyStructure(vtkDataSet *ds);
124  virtual vtkCell *GetCell(vtkIdType cellId);
125  virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell);
126  virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
127  virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
128  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds);
130 
131  int GetCellType(vtkIdType cellId);
132  vtkUnsignedCharArray* GetCellTypesArray() { return this->Types; }
133  vtkIdTypeArray* GetCellLocationsArray() { return this->Locations; }
134  void Squeeze();
135  void Initialize();
136  int GetMaxCellSize();
137  void BuildLinks();
138  vtkCellLinks *GetCellLinks() {return this->Links;};
139  virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts,
140  vtkIdType* &pts);
141 
147  void GetFaceStream(vtkIdType cellId, vtkIdList *ptIds);
148 
154  void GetFaceStream(vtkIdType cellId, vtkIdType& nfaces, vtkIdType* &ptIds);
155 
157 
169  void SetCells(int type, vtkCellArray *cells);
170  void SetCells(int *types, vtkCellArray *cells);
171  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
172  vtkCellArray *cells);
173  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
174  vtkCellArray *cells, vtkIdTypeArray *faceLocations,
175  vtkIdTypeArray *faces);
177 
178  vtkCellArray *GetCells() {return this->Connectivity;};
179  void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts);
180  vtkIdType InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
181  void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId);
182  void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId);
183  void ResizeCellList(vtkIdType ptId, int size);
184 
186 
189  virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
190  vtkIdList *cellIds);
192 
196  void GetUpdateExtent(int &piece, int &numPieces, int &ghostLevel);
197 
199 
200  virtual int* GetUpdateExtent();
201  virtual void GetUpdateExtent(int& x0, int& x1, int& y0, int& y1,
202  int& z0, int& z1);
203  virtual void GetUpdateExtent(int extent[6]);
205 
207 
209  virtual int GetPiece();
210  virtual int GetNumberOfPieces();
212 
214  virtual int GetGhostLevel();
215 
221  unsigned long GetActualMemorySize();
222 
224 
225  virtual void ShallowCopy(vtkDataObject *src);
226  virtual void DeepCopy(vtkDataObject *src);
228 
232  void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array);
233 
235  int IsHomogeneous();
236 
239  void RemoveGhostCells(int level);
240 
241  //BTX
243 
245  static vtkUnstructuredGrid* GetData(vtkInformationVector* v, int i=0);
246  //ETX
248 
250  vtkIdType *GetFaces(vtkIdType cellId);
251 
253 
254  vtkIdTypeArray* GetFaces(){return this->Faces;};
255  vtkIdTypeArray* GetFaceLocations(){return this->FaceLocations;};
257 
264  int InitializeFacesRepresentation(vtkIdType numPrevCells);
265 
267 
276  static void DecomposeAPolyhedronCell(vtkCellArray *polyhedronCellArray,
277  vtkIdType & nCellpts,
278  vtkIdType & nCellfaces,
279  vtkCellArray *cellArray,
280  vtkIdTypeArray *faces);
282 
283  static void DecomposeAPolyhedronCell(vtkIdType * polyhedronCellStream,
284  vtkIdType & nCellpts,
285  vtkIdType & nCellfaces,
286  vtkCellArray *cellArray,
287  vtkIdTypeArray *faces);
288 
290 
299  static void DecomposeAPolyhedronCell(vtkIdType nCellFaces,
300  vtkIdType * inFaceStream,
301  vtkIdType & nCellpts,
302  vtkCellArray * cellArray,
303  vtkIdTypeArray * faces);
305 
307 
311  static void ConvertFaceStreamPointIds(vtkIdList * faceStream,
312  vtkIdType * idMap);
314 
316 
320  static void ConvertFaceStreamPointIds(vtkIdType nfaces,
321  vtkIdType * faceStream,
322  vtkIdType * idMap);
324 
325 
326 protected:
329 
330  // used by GetCell method
331  vtkVertex *Vertex;
345  vtkPentagonalPrism *PentagonalPrism;
364  vtkEmptyCell *EmptyCell;
365 
366  // points inherited
367  // point data (i.e., scalars, vectors, normals, tcoords) inherited
372 
373  // Special support for polyhedra/cells with explicit face representations.
374  // The Faces class represents polygonal faces using a modified vtkCellArray
375  // structure. Each cell face list begins with the total number of faces in
376  // the cell, followed by a vtkCellArray data organization
377  // (n,i,j,k,n,i,j,k,...).
380 
381 private:
382  // Hide these from the user and the compiler.
383  vtkUnstructuredGrid(const vtkUnstructuredGrid&); // Not implemented.
384  void operator=(const vtkUnstructuredGrid&); // Not implemented.
385 
386  void Cleanup();
387 
389 
390  VTK_LEGACY(void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds));
391 };
393 
394 #endif
vtkIdTypeArray * Faces
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()
#define VTK_FILTERING_EXPORT
abstract class to specify dataset behavior
Definition: vtkDataSet.h:58
a 3D cell that represents a linear pyramid
Definition: vtkPyramid.h:47
vtkQuadraticWedge * QuadraticWedge
a cell that represents an orthogonal quadrilateral
Definition: vtkPixel.h:38
cell represents a parabolic, 9-node isoparametric quad
virtual int * GetUpdateExtent()
vtkQuadraticTriangle * QuadraticTriangle
static vtkPointSet * GetData(vtkInformation *info)
vtkPentagonalPrism * PentagonalPrism
void CopyStructure(vtkDataSet *pd)
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:39
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:40
dynamic, self-adjusting array of vtkIdType
void Initialize()
unsigned long GetActualMemorySize()
vtkQuadraticHexahedron * QuadraticHexahedron
int vtkIdType
Definition: vtkType.h:255
cell represents a set of 0D vertices
Definition: vtkPolyVertex.h:36
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:43
vtkBiQuadraticQuad * BiQuadraticQuad
a cell that represents a triangle strip
a 3D cell that represents a tetrahedron
Definition: vtkTetra.h:45
vtkIdTypeArray * FaceLocations
cell represents a 1D line
Definition: vtkLine.h:33
abstract class to specify cell behavior
Definition: vtkCell.h:57
a cell that represents a 3D orthogonal parallelepiped
Definition: vtkVoxel.h:42
cell represents a parabolic, 8-node isoparametric quad
a simple class to control print indentation
Definition: vtkIndent.h:37
vtkQuadraticQuad * QuadraticQuad
virtual int GetMaxCellSize()=0
vtkIdTypeArray * GetFaces()
list of point or cell ids
Definition: vtkIdList.h:34
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:43
cell represents a parabolic, isoparametric triangle
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:45
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
void PrintSelf(ostream &os, vtkIndent indent)
vtkUnsignedCharArray * GetCellTypesArray()
vtkBiQuadraticQuadraticWedge * BiQuadraticQuadraticWedge
object to represent cell connectivity
Definition: vtkCellArray.h:48
void DeepCopy(vtkDataObject *src)
vtkBiQuadraticQuadraticHexahedron * BiQuadraticQuadraticHexahedron
cell represents a parabolic, 27-node isoparametric hexahedron
cell represents a parabolic, isoparametric edge
a cell that represents a triangle
Definition: vtkTriangle.h:39
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:58
vtkCellArray * GetCells()
vtkPolyVertex * PolyVertex
vtkIdTypeArray * GetFaceLocations()
vtkCellArray * Connectivity
void ShallowCopy(vtkDataObject *src)
general representation of visualization data
Definition: vtkDataObject.h:70
cell represents a, 12-node isoparametric wedge
cell represents a quadratic-linear, 6-node isoparametric quad
vtkQuadraticEdge * QuadraticEdge
a 3D cell that represents a linear wedge
Definition: vtkWedge.h:47
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:40
virtual int GetCellType(vtkIdType cellId)=0
vtkIdTypeArray * GetCellLocationsArray()