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
39class vtkCellArray;
40class vtkCellLinks;
42class vtkEmptyCell;
43class vtkHexahedron;
44class vtkIdList;
45class vtkIdTypeArray;
46class vtkLine;
47class vtkPixel;
48class vtkPolyLine;
49class vtkPolyVertex;
50class vtkPolygon;
51class vtkPyramid;
54class vtkQuad;
63class vtkTetra;
64class vtkTriangle;
67class vtkVertex;
68class vtkVoxel;
69class vtkWedge;
77class vtkCubicLine;
78class vtkPolyhedron;
79class vtkIdTypeArray;
80
81class VTKCOMMONDATAMODEL_EXPORT vtkUnstructuredGrid :
83{
84public:
86
88 void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
89
93 int GetDataObjectType() VTK_OVERRIDE {return VTK_UNSTRUCTURED_GRID;};
94
101 void Allocate(vtkIdType numCells=1000, int extSize=1000) VTK_OVERRIDE;
102
113 vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds) VTK_OVERRIDE;
114
124 vtkIdType InsertNextCell(int type, vtkIdList *ptIds) VTK_OVERRIDE;
125
126 // Desciption:
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) VTK_OVERRIDE;
135
137
140 void Reset();
141 void CopyStructure(vtkDataSet *ds) VTK_OVERRIDE;
142 vtkIdType GetNumberOfCells() VTK_OVERRIDE;
143 vtkCell *GetCell(vtkIdType cellId) VTK_OVERRIDE;
144 void GetCell(vtkIdType cellId, vtkGenericCell *cell) VTK_OVERRIDE;
145 void GetCellBounds(vtkIdType cellId, double bounds[6]) VTK_OVERRIDE;
146 void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) VTK_OVERRIDE;
147 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) VTK_OVERRIDE;
148 vtkCellIterator* NewCellIterator() VTK_OVERRIDE;
150
151 int GetCellType(vtkIdType cellId) VTK_OVERRIDE;
152 vtkUnsignedCharArray* GetCellTypesArray() { return this->Types; }
153 vtkIdTypeArray* GetCellLocationsArray() { return this->Locations; }
154 void Squeeze() VTK_OVERRIDE;
155 void Initialize() VTK_OVERRIDE;
156 int GetMaxCellSize() VTK_OVERRIDE;
157 void BuildLinks();
158 vtkCellLinks *GetCellLinks() {return this->Links;};
159 virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts,
160 vtkIdType* &pts);
161
168 void GetFaceStream(vtkIdType cellId, vtkIdList *ptIds);
169
178 void GetFaceStream(vtkIdType cellId, vtkIdType& nfaces, vtkIdType* &ptIds);
179
181
194 void SetCells(int type, vtkCellArray *cells);
195 void SetCells(int *types, vtkCellArray *cells);
196 void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
197 vtkCellArray *cells);
198 void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
199 vtkCellArray *cells, vtkIdTypeArray *faceLocations,
200 vtkIdTypeArray *faces);
202
203 vtkCellArray *GetCells() {return this->Connectivity;};
204 void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts) VTK_OVERRIDE;
209
217 vtkIdList *cellIds) VTK_OVERRIDE;
218
220
223 virtual int GetPiece();
224 virtual int GetNumberOfPieces();
226
230 virtual int GetGhostLevel();
231
240 unsigned long GetActualMemorySize() VTK_OVERRIDE;
241
243
246 void ShallowCopy(vtkDataObject *src) VTK_OVERRIDE;
247 void DeepCopy(vtkDataObject *src) VTK_OVERRIDE;
249
255 void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array) VTK_OVERRIDE;
256
260 int IsHomogeneous() VTK_OVERRIDE;
261
266 void RemoveGhostCells();
267
269
273 static vtkUnstructuredGrid* GetData(vtkInformationVector* v, int i=0);
275
279 vtkIdType *GetFaces(vtkIdType cellId);
280
282
285 vtkIdTypeArray* GetFaces(){return this->Faces;};
286 vtkIdTypeArray* GetFaceLocations(){return this->FaceLocations;};
288
297
310 static void DecomposeAPolyhedronCell(vtkCellArray *polyhedronCellArray,
311 vtkIdType & nCellpts,
312 vtkIdType & nCellfaces,
313 vtkCellArray *cellArray,
314 vtkIdTypeArray *faces);
315
316 static void DecomposeAPolyhedronCell(vtkIdType * polyhedronCellStream,
317 vtkIdType & nCellpts,
318 vtkIdType & nCellfaces,
319 vtkCellArray *cellArray,
320 vtkIdTypeArray *faces);
321
334 static void DecomposeAPolyhedronCell(vtkIdType nCellFaces,
335 vtkIdType * inFaceStream,
336 vtkIdType & nCellpts,
337 vtkCellArray * cellArray,
338 vtkIdTypeArray * faces);
339
346 static void ConvertFaceStreamPointIds(vtkIdList * faceStream,
347 vtkIdType * idMap);
348
355 vtkIdType * faceStream,
356 vtkIdType * idMap);
357
358
359protected:
361 ~vtkUnstructuredGrid() VTK_OVERRIDE;
362
363 // used by GetCell method
364 vtkVertex *Vertex;
365 vtkPolyVertex *PolyVertex;
366 vtkLine *Line;
367 vtkPolyLine *PolyLine;
368 vtkTriangle *Triangle;
369 vtkTriangleStrip *TriangleStrip;
370 vtkPixel *Pixel;
371 vtkQuad *Quad;
372 vtkPolygon *Polygon;
373 vtkTetra *Tetra;
374 vtkVoxel *Voxel;
375 vtkHexahedron *Hexahedron;
376 vtkWedge *Wedge;
377 vtkPyramid *Pyramid;
378 vtkPentagonalPrism *PentagonalPrism;
379 vtkHexagonalPrism *HexagonalPrism;
380 vtkQuadraticEdge *QuadraticEdge;
381 vtkQuadraticTriangle *QuadraticTriangle;
382 vtkQuadraticQuad *QuadraticQuad;
383 vtkQuadraticPolygon *QuadraticPolygon;
384 vtkQuadraticTetra *QuadraticTetra;
385 vtkQuadraticHexahedron *QuadraticHexahedron;
386 vtkQuadraticWedge *QuadraticWedge;
387 vtkQuadraticPyramid *QuadraticPyramid;
388 vtkQuadraticLinearQuad *QuadraticLinearQuad;
389 vtkBiQuadraticQuad *BiQuadraticQuad;
390 vtkTriQuadraticHexahedron *TriQuadraticHexahedron;
391 vtkQuadraticLinearWedge *QuadraticLinearWedge;
392 vtkBiQuadraticQuadraticWedge *BiQuadraticQuadraticWedge;
393 vtkBiQuadraticQuadraticHexahedron *BiQuadraticQuadraticHexahedron;
394 vtkBiQuadraticTriangle *BiQuadraticTriangle;
395 vtkCubicLine *CubicLine;
396 vtkConvexPointSet *ConvexPointSet;
397 vtkPolyhedron *Polyhedron;
398 vtkEmptyCell *EmptyCell;
399
400 // points inherited
401 // point data (i.e., scalars, vectors, normals, tcoords) inherited
402 vtkCellArray *Connectivity;
405 vtkIdTypeArray *Locations;
406
407 // Special support for polyhedra/cells with explicit face representations.
408 // The Faces class represents polygonal faces using a modified vtkCellArray
409 // structure. Each cell face list begins with the total number of faces in
410 // the cell, followed by a vtkCellArray data organization
411 // (n,i,j,k,n,i,j,k,...).
413 vtkIdTypeArray *FaceLocations;
414
415private:
416 // Hide these from the user and the compiler.
417 vtkUnstructuredGrid(const vtkUnstructuredGrid&) VTK_DELETE_FUNCTION;
418 void operator=(const vtkUnstructuredGrid&) VTK_DELETE_FUNCTION;
419
420 void Cleanup();
421};
422
423#endif
cell represents a parabolic, 9-node isoparametric quad
cell represents a biquadratic, 24-node isoparametric hexahedron
cell represents a parabolic, 18-node isoparametric wedge
cell represents a parabolic, isoparametric triangle
object to represent cell connectivity
Definition: vtkCellArray.h:51
Efficient cell iterator for vtkDataSet topologies.
abstract class to specify cell behavior
Definition: vtkCell.h:60
a 3D cell defined by a set of convex points
cell represents a cubic , isoparametric 1D line
Definition: vtkCubicLine.h:46
general representation of visualization data
Definition: vtkDataObject.h:65
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:33
provides thread-safe access to cells
a 3D cell that represents a prism with hexagonal base
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:48
list of point or cell ids
Definition: vtkIdList.h:37
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
cell represents a 1D line
Definition: vtkLine.h:36
a 3D cell that represents a convex prism with pentagonal base
a cell that represents an orthogonal quadrilateral
Definition: vtkPixel.h:41
cell represents a set of 1D lines
Definition: vtkPolyLine.h:43
cell represents a set of 0D vertices
Definition: vtkPolyVertex.h:39
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:46
a 3D cell defined by a set of polygonal faces
Definition: vtkPolyhedron.h:61
a 3D cell that represents a linear pyramid
Definition: vtkPyramid.h:50
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:42
cell represents a parabolic, isoparametric edge
cell represents a parabolic, 20-node isoparametric hexahedron
cell represents a quadratic-linear, 6-node isoparametric quad
cell represents a, 12-node isoparametric wedge
a cell that represents a parabolic n-sided polygon
cell represents a parabolic, 13-node isoparametric pyramid
cell represents a parabolic, 8-node isoparametric quad
cell represents a parabolic, 10-node isoparametric tetrahedron
cell represents a parabolic, isoparametric triangle
cell represents a parabolic, 15-node isoparametric wedge
a 3D cell that represents a tetrahedron
Definition: vtkTetra.h:48
cell represents a parabolic, 27-node isoparametric hexahedron
a cell that represents a triangle strip
a cell that represents a triangle
Definition: vtkTriangle.h:42
dynamic, self-adjusting array of unsigned char
dataset represents arbitrary combinations of all possible cell types.
dataset represents arbitrary combinations of all possible cell types
void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId)
void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations, vtkCellArray *cells)
void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations, vtkCellArray *cells, vtkIdTypeArray *faceLocations, vtkIdTypeArray *faces)
static void DecomposeAPolyhedronCell(vtkIdType nCellFaces, vtkIdType *inFaceStream, vtkIdType &nCellpts, vtkCellArray *cellArray, vtkIdTypeArray *faces)
A static method for converting an input polyhedron cell stream of format [nFace0Pts,...
void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts) override
Replace the points defining cell "cellId" with a new set of points.
void Allocate(vtkIdType numCells=1000, int extSize=1000) override
Method allocates initial storage for the cell connectivity.
vtkCellArray * GetCells()
void SetCells(int *types, vtkCellArray *cells)
void Squeeze() override
Reclaim any unused memory.
vtkIdType InsertNextLinkedCell(int type, int npts, vtkIdType *pts)
virtual void GetCellPoints(vtkIdType cellId, vtkIdType &npts, vtkIdType *&pts)
static void ConvertFaceStreamPointIds(vtkIdList *faceStream, vtkIdType *idMap)
Convert pid in a face stream into idMap[pid].
void ResizeCellList(vtkIdType ptId, int size)
int InitializeFacesRepresentation(vtkIdType numPrevCells)
Special function used by vtkUnstructuredGridReader.
void GetFaceStream(vtkIdType cellId, vtkIdType &nfaces, vtkIdType *&ptIds)
Get the number of faces and the face stream of a polyhedral cell.
void SetCells(int type, vtkCellArray *cells)
Special methods specific to vtkUnstructuredGrid for defining the cells composing the dataset.
vtkIdTypeArray * GetCellLocationsArray()
static void DecomposeAPolyhedronCell(vtkIdType *polyhedronCellStream, vtkIdType &nCellpts, vtkIdType &nCellfaces, vtkCellArray *cellArray, vtkIdTypeArray *faces)
void GetFaceStream(vtkIdType cellId, vtkIdList *ptIds)
Get the face stream of a polyhedron cell in the following format: (numCellFaces, numFace0Pts,...
void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds) override
Topological inquiry to get all cells using list of points exclusive of cell specified (e....
~vtkUnstructuredGrid() override
static void DecomposeAPolyhedronCell(vtkCellArray *polyhedronCellArray, vtkIdType &nCellpts, vtkIdType &nCellfaces, vtkCellArray *cellArray, vtkIdTypeArray *faces)
A static method for converting a polyhedron vtkCellArray of format [nCellFaces, nFace0Pts,...
virtual int GetGhostLevel()
Get the ghost level.
static void ConvertFaceStreamPointIds(vtkIdType nfaces, vtkIdType *faceStream, vtkIdType *idMap)
Convert pid in a face stream into idMap[pid].
virtual int GetPiece()
Set / Get the piece and the number of pieces.
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
virtual int GetNumberOfPieces()
void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId)
vtkIdTypeArray * GetFaceLocations()
static vtkUnstructuredGrid * New()
a cell that represents a 3D point
Definition: vtkVertex.h:37
a cell that represents a 3D orthogonal parallelepiped
Definition: vtkVoxel.h:45
a 3D cell that represents a linear wedge
Definition: vtkWedge.h:50
@ info
Definition: vtkX3D.h:376
@ type
Definition: vtkX3D.h:516
@ size
Definition: vtkX3D.h:253
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
int vtkIdType
Definition: vtkType.h:287
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:91