VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkUnstructuredGrid.h,v $ 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00027 #ifndef __vtkUnstructuredGrid_h 00028 #define __vtkUnstructuredGrid_h 00029 00030 #include "vtkPointSet.h" 00031 00032 class vtkCellArray; 00033 class vtkCellLinks; 00034 class vtkConvexPointSet; 00035 class vtkEmptyCell; 00036 class vtkHexahedron; 00037 class vtkIdList; 00038 class vtkIdTypeArray; 00039 class vtkLine; 00040 class vtkPixel; 00041 class vtkPolyLine; 00042 class vtkPolyVertex; 00043 class vtkPolygon; 00044 class vtkPyramid; 00045 class vtkPentagonalPrism; 00046 class vtkHexagonalPrism; 00047 class vtkQuad; 00048 class vtkQuadraticEdge; 00049 class vtkQuadraticHexahedron; 00050 class vtkQuadraticWedge; 00051 class vtkQuadraticPyramid; 00052 class vtkQuadraticQuad; 00053 class vtkQuadraticTetra; 00054 class vtkQuadraticTriangle; 00055 class vtkTetra; 00056 class vtkTriangle; 00057 class vtkTriangleStrip; 00058 class vtkUnsignedCharArray; 00059 class vtkVertex; 00060 class vtkVoxel; 00061 class vtkWedge; 00062 class vtkTriQuadraticHexahedron; 00063 class vtkQuadraticLinearWedge; 00064 class vtkQuadraticLinearQuad; 00065 class vtkBiQuadraticQuad; 00066 class vtkBiQuadraticQuadraticWedge; 00067 class vtkBiQuadraticQuadraticHexahedron; 00068 00069 00070 class VTK_FILTERING_EXPORT vtkUnstructuredGrid : public vtkPointSet 00071 { 00072 public: 00073 static vtkUnstructuredGrid *New(); 00074 00075 vtkTypeRevisionMacro(vtkUnstructuredGrid,vtkPointSet); 00076 void PrintSelf(ostream& os, vtkIndent indent); 00077 00079 00080 int GetDataObjectType() {return VTK_UNSTRUCTURED_GRID;}; 00081 virtual void Allocate(vtkIdType numCells=1000, int extSize=1000); 00083 00085 00087 vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *pts); 00088 vtkIdType InsertNextCell(int type, vtkIdList *ptIds); 00090 00091 void Reset(); 00092 virtual void CopyStructure(vtkDataSet *ds); 00093 vtkIdType GetNumberOfCells(); 00094 virtual vtkCell *GetCell(vtkIdType cellId); 00095 virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell); 00096 virtual void GetCellBounds(vtkIdType cellId, double bounds[6]); 00097 virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds); 00098 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds); 00099 00100 int GetCellType(vtkIdType cellId); 00101 vtkUnsignedCharArray* GetCellTypesArray() { return this->Types; } 00102 vtkIdTypeArray* GetCellLocationsArray() { return this->Locations; } 00103 void Squeeze(); 00104 void Initialize(); 00105 int GetMaxCellSize(); 00106 void BuildLinks(); 00107 vtkCellLinks *GetCellLinks() {return this->Links;}; 00108 virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts, 00109 vtkIdType* &pts); 00110 00112 00114 void SetCells(int type, vtkCellArray *cells); 00115 void SetCells(int *types, vtkCellArray *cells); 00116 void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations, 00117 vtkCellArray *cells); 00118 vtkCellArray *GetCells() {return this->Connectivity;}; 00119 void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts); 00120 int InsertNextLinkedCell(int type, int npts, vtkIdType *pts); 00121 void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId); 00122 void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId); 00123 void ResizeCellList(vtkIdType ptId, int size); 00125 00127 00130 virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, 00131 vtkIdList *cellIds); 00133 00137 void GetUpdateExtent(int &piece, int &numPieces, int &ghostLevel); 00138 00140 00141 virtual int* GetUpdateExtent(); 00142 virtual void GetUpdateExtent(int& x0, int& x1, int& y0, int& y1, 00143 int& z0, int& z1); 00144 virtual void GetUpdateExtent(int extent[6]); 00146 00148 00150 virtual int GetPiece(); 00151 virtual int GetNumberOfPieces(); 00153 00155 virtual int GetGhostLevel(); 00156 00162 unsigned long GetActualMemorySize(); 00163 00165 00166 virtual void ShallowCopy(vtkDataObject *src); 00167 virtual void DeepCopy(vtkDataObject *src); 00169 00173 void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array); 00174 00176 int IsHomogeneous(); 00177 00180 void RemoveGhostCells(int level); 00181 00182 //BTX 00184 00185 static vtkUnstructuredGrid* GetData(vtkInformation* info); 00186 static vtkUnstructuredGrid* GetData(vtkInformationVector* v, int i=0); 00187 //ETX 00189 00190 protected: 00191 vtkUnstructuredGrid(); 00192 ~vtkUnstructuredGrid(); 00193 00194 // used by GetCell method 00195 vtkVertex *Vertex; 00196 vtkPolyVertex *PolyVertex; 00197 vtkLine *Line; 00198 vtkPolyLine *PolyLine; 00199 vtkTriangle *Triangle; 00200 vtkTriangleStrip *TriangleStrip; 00201 vtkPixel *Pixel; 00202 vtkQuad *Quad; 00203 vtkPolygon *Polygon; 00204 vtkTetra *Tetra; 00205 vtkVoxel *Voxel; 00206 vtkHexahedron *Hexahedron; 00207 vtkWedge *Wedge; 00208 vtkPyramid *Pyramid; 00209 vtkPentagonalPrism *PentagonalPrism; 00210 vtkHexagonalPrism *HexagonalPrism; 00211 vtkQuadraticEdge *QuadraticEdge; 00212 vtkQuadraticTriangle *QuadraticTriangle; 00213 vtkQuadraticQuad *QuadraticQuad; 00214 vtkQuadraticTetra *QuadraticTetra; 00215 vtkQuadraticHexahedron *QuadraticHexahedron; 00216 vtkQuadraticWedge *QuadraticWedge; 00217 vtkQuadraticPyramid *QuadraticPyramid; 00218 vtkQuadraticLinearQuad *QuadraticLinearQuad; 00219 vtkBiQuadraticQuad *BiQuadraticQuad; 00220 vtkTriQuadraticHexahedron *TriQuadraticHexahedron; 00221 vtkQuadraticLinearWedge *QuadraticLinearWedge; 00222 vtkBiQuadraticQuadraticWedge *BiQuadraticQuadraticWedge; 00223 vtkBiQuadraticQuadraticHexahedron *BiQuadraticQuadraticHexahedron; 00224 vtkConvexPointSet *ConvexPointSet; 00225 vtkEmptyCell *EmptyCell; 00226 00227 // points inherited 00228 // point data (i.e., scalars, vectors, normals, tcoords) inherited 00229 vtkCellArray *Connectivity; 00230 vtkCellLinks *Links; 00231 vtkUnsignedCharArray *Types; 00232 vtkIdTypeArray *Locations; 00233 00234 private: 00235 // Hide these from the user and the compiler. 00236 00238 VTK_LEGACY(void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)); 00239 00240 vtkUnstructuredGrid(const vtkUnstructuredGrid&); // Not implemented. 00241 void operator=(const vtkUnstructuredGrid&); // Not implemented. 00242 }; 00243 00244 #endif 00245 00246 00247 00248 00249 00250 00251