VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
36 #include "vtkPointSet.h"
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;
57 class vtkQuadraticPyramid;
58 class vtkQuadraticQuad;
59 class vtkQuadraticTetra;
60 class vtkQuadraticTriangle;
61 class vtkTetra;
62 class vtkTriangle;
63 class vtkTriangleStrip;
65 class vtkVertex;
66 class vtkVoxel;
67 class vtkWedge;
69 class vtkQuadraticLinearWedge;
70 class vtkQuadraticLinearQuad;
71 class vtkBiQuadraticQuad;
73 class vtkBiQuadraticQuadraticHexahedron;
75 class vtkCubicLine;
76 class vtkPolyhedron;
77 class vtkIdTypeArray;
78 
79 class VTKCOMMONDATAMODEL_EXPORT vtkUnstructuredGrid : public vtkPointSet
80 {
81 public:
82  static vtkUnstructuredGrid *New();
83 
85  void PrintSelf(ostream& os, vtkIndent indent);
86 
89 
94  virtual void Allocate(vtkIdType numCells=1000, int extSize=1000);
95 
104  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds);
105 
112  vtkIdType InsertNextCell(int type, vtkIdList *ptIds);
113 
114  // Desciption:
115  // Insert/create a polyhedron cell. npts is the number of unique points in
116  // the cell. pts is the list of the unique cell point Ids. nfaces is the
117  // number of faces in the cell. faces is the face-stream
118  // [numFace0Pts, id1, id2, id3, numFace1Pts,id1, id2, id3, ...].
119  // All point Ids are global.
120  vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds,
121  vtkIdType nfaces, vtkIdType *faces);
122 
124 
125  void Reset();
126  virtual void CopyStructure(vtkDataSet *ds);
127  vtkIdType GetNumberOfCells();
128  virtual vtkCell *GetCell(vtkIdType cellId);
129  virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell);
130  virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
131  virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
132  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds);
134 
135  int GetCellType(vtkIdType cellId);
136  vtkUnsignedCharArray* GetCellTypesArray() { return this->Types; }
137  vtkIdTypeArray* GetCellLocationsArray() { return this->Locations; }
138  void Squeeze();
139  void Initialize();
140  int GetMaxCellSize();
141  void BuildLinks();
142  vtkCellLinks *GetCellLinks() {return this->Links;};
143  virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts,
144  vtkIdType* &pts);
145 
151  void GetFaceStream(vtkIdType cellId, vtkIdList *ptIds);
152 
158  void GetFaceStream(vtkIdType cellId, vtkIdType& nfaces, vtkIdType* &ptIds);
159 
161 
173  void SetCells(int type, vtkCellArray *cells);
174  void SetCells(int *types, vtkCellArray *cells);
175  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
176  vtkCellArray *cells);
177  void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
178  vtkCellArray *cells, vtkIdTypeArray *faceLocations,
179  vtkIdTypeArray *faces);
181 
182  vtkCellArray *GetCells() {return this->Connectivity;};
183  void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts);
184  vtkIdType InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
185  void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId);
186  void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId);
187  void ResizeCellList(vtkIdType ptId, int size);
188 
190 
193  virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
194  vtkIdList *cellIds);
196 
198 
200  virtual int GetPiece();
201  virtual int GetNumberOfPieces();
203 
205  virtual int GetGhostLevel();
206 
212  unsigned long GetActualMemorySize();
213 
215 
216  virtual void ShallowCopy(vtkDataObject *src);
217  virtual void DeepCopy(vtkDataObject *src);
219 
223  void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array);
224 
226  int IsHomogeneous();
227 
230  void RemoveGhostCells(int level);
231 
232  //BTX
234 
236  static vtkUnstructuredGrid* GetData(vtkInformationVector* v, int i=0);
237  //ETX
239 
241  vtkIdType *GetFaces(vtkIdType cellId);
242 
244 
245  vtkIdTypeArray* GetFaces(){return this->Faces;};
246  vtkIdTypeArray* GetFaceLocations(){return this->FaceLocations;};
248 
255  int InitializeFacesRepresentation(vtkIdType numPrevCells);
256 
258 
267  static void DecomposeAPolyhedronCell(vtkCellArray *polyhedronCellArray,
268  vtkIdType & nCellpts,
269  vtkIdType & nCellfaces,
270  vtkCellArray *cellArray,
271  vtkIdTypeArray *faces);
273 
274  static void DecomposeAPolyhedronCell(vtkIdType * polyhedronCellStream,
275  vtkIdType & nCellpts,
276  vtkIdType & nCellfaces,
277  vtkCellArray *cellArray,
278  vtkIdTypeArray *faces);
279 
281 
290  static void DecomposeAPolyhedronCell(vtkIdType nCellFaces,
291  vtkIdType * inFaceStream,
292  vtkIdType & nCellpts,
293  vtkCellArray * cellArray,
294  vtkIdTypeArray * faces);
296 
298 
302  static void ConvertFaceStreamPointIds(vtkIdList * faceStream,
303  vtkIdType * idMap);
305 
307 
311  static void ConvertFaceStreamPointIds(vtkIdType nfaces,
312  vtkIdType * faceStream,
313  vtkIdType * idMap);
315 
316 
317 protected:
320 
321  // used by GetCell method
322  vtkVertex *Vertex;
325  vtkPolyLine *PolyLine;
326  vtkTriangle *Triangle;
328  vtkPixel *Pixel;
330  vtkPolygon *Polygon;
332  vtkVoxel *Voxel;
334  vtkWedge *Wedge;
336  vtkPentagonalPrism *PentagonalPrism;
337  vtkHexagonalPrism *HexagonalPrism;
339  vtkQuadraticTriangle *QuadraticTriangle;
340  vtkQuadraticQuad *QuadraticQuad;
343  vtkQuadraticWedge *QuadraticWedge;
344  vtkQuadraticPyramid *QuadraticPyramid;
345  vtkQuadraticLinearQuad *QuadraticLinearQuad;
346  vtkBiQuadraticQuad *BiQuadraticQuad;
348  vtkQuadraticLinearWedge *QuadraticLinearWedge;
350  vtkBiQuadraticQuadraticHexahedron *BiQuadraticQuadraticHexahedron;
353  vtkConvexPointSet *ConvexPointSet;
354  vtkPolyhedron *Polyhedron;
356 
357  // points inherited
358  // point data (i.e., scalars, vectors, normals, tcoords) inherited
359  vtkCellArray *Connectivity;
360  vtkCellLinks *Links;
363 
364  // Special support for polyhedra/cells with explicit face representations.
365  // The Faces class represents polygonal faces using a modified vtkCellArray
366  // structure. Each cell face list begins with the total number of faces in
367  // the cell, followed by a vtkCellArray data organization
368  // (n,i,j,k,n,i,j,k,...).
371 
372 private:
373  // Hide these from the user and the compiler.
374  vtkUnstructuredGrid(const vtkUnstructuredGrid&); // Not implemented.
375  void operator=(const vtkUnstructuredGrid&); // Not implemented.
376 
377  void Cleanup();
378 
380 
381  VTK_LEGACY(void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds));
382 };
384 
385 #endif
vtkIdTypeArray * Faces
vtkTriangleStrip * TriangleStrip
vtkTriQuadraticHexahedron * TriQuadraticHexahedron
Store vtkAlgorithm input/output information.
vtkCellLinks * GetCellLinks()
a 3D cell that represents a linear pyramid
Definition: vtkPyramid.h:48
vtkQuadraticWedge * QuadraticWedge
vtkQuadraticTriangle * QuadraticTriangle
static vtkPointSet * GetData(vtkInformation *info)
vtkPentagonalPrism * PentagonalPrism
void CopyStructure(vtkDataSet *pd)
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:40
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:41
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:268
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
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
vtkIdTypeArray * FaceLocations
cell represents a 1D line
Definition: vtkLine.h:34
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkQuadraticQuad * QuadraticQuad
vtkIdTypeArray * GetFaces()
list of point or cell ids
Definition: vtkIdList.h:35
dataset represents arbitrary combinations of all possible cell types
vtkBiQuadraticTriangle * BiQuadraticTriangle
vtkHexahedron * Hexahedron
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
dynamic, self-adjusting array of unsigned char
vtkQuadraticLinearWedge * QuadraticLinearWedge
void PrintSelf(ostream &os, vtkIndent indent)
vtkUnsignedCharArray * GetCellTypesArray()
vtkBiQuadraticQuadraticWedge * BiQuadraticQuadraticWedge
void DeepCopy(vtkDataObject *src)
vtkBiQuadraticQuadraticHexahedron * BiQuadraticQuadraticHexahedron
cell represents a parabolic, 27-node isoparametric hexahedron
cell represents a parabolic, isoparametric edge
cell represents a parabolic, 20-node isoparametric hexahedron
vtkUnsignedCharArray * Types
vtkQuadraticLinearQuad * QuadraticLinearQuad
vtkConvexPointSet * ConvexPointSet
Store zero or more vtkInformation instances.
vtkCellArray * GetCells()
vtkPolyVertex * PolyVertex
vtkIdTypeArray * GetFaceLocations()
vtkCellArray * Connectivity
void ShallowCopy(vtkDataObject *src)
helper class to get VTK data object types as string and instantiate them
vtkQuadraticEdge * QuadraticEdge
vtkIdTypeArray * Locations
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:70
vtkQuadraticPyramid * QuadraticPyramid
vtkIdTypeArray * GetCellLocationsArray()