VTK
dox/Filtering/vtkUnstructuredGrid.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkUnstructuredGrid.h
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 =========================================================================*/
00030 #ifndef __vtkUnstructuredGrid_h
00031 #define __vtkUnstructuredGrid_h
00032 
00033 #include "vtkPointSet.h"
00034 
00035 class vtkCellArray;
00036 class vtkCellLinks;
00037 class vtkConvexPointSet;
00038 class vtkEmptyCell;
00039 class vtkHexahedron;
00040 class vtkIdList;
00041 class vtkIdTypeArray;
00042 class vtkLine;
00043 class vtkPixel;
00044 class vtkPolyLine;
00045 class vtkPolyVertex;
00046 class vtkPolygon;
00047 class vtkPyramid;
00048 class vtkPentagonalPrism;
00049 class vtkHexagonalPrism;
00050 class vtkQuad;
00051 class vtkQuadraticEdge;
00052 class vtkQuadraticHexahedron;
00053 class vtkQuadraticWedge;
00054 class vtkQuadraticPyramid;
00055 class vtkQuadraticQuad;
00056 class vtkQuadraticTetra;
00057 class vtkQuadraticTriangle;
00058 class vtkTetra;
00059 class vtkTriangle;
00060 class vtkTriangleStrip;
00061 class vtkUnsignedCharArray;
00062 class vtkVertex;
00063 class vtkVoxel;
00064 class vtkWedge;
00065 class vtkTriQuadraticHexahedron;
00066 class vtkQuadraticLinearWedge;
00067 class vtkQuadraticLinearQuad;
00068 class vtkBiQuadraticQuad;
00069 class vtkBiQuadraticQuadraticWedge;
00070 class vtkBiQuadraticQuadraticHexahedron;
00071 class vtkBiQuadraticTriangle;
00072 class vtkCubicLine;
00073 
00074 
00075 class VTK_FILTERING_EXPORT vtkUnstructuredGrid : public vtkPointSet 
00076 {
00077 public:
00078   static vtkUnstructuredGrid *New();
00079 
00080   vtkTypeMacro(vtkUnstructuredGrid,vtkPointSet);
00081   void PrintSelf(ostream& os, vtkIndent indent);
00082 
00084 
00085   int GetDataObjectType() {return VTK_UNSTRUCTURED_GRID;};
00086   virtual void Allocate(vtkIdType numCells=1000, int extSize=1000);
00088   
00090 
00092   vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *pts);
00093   vtkIdType InsertNextCell(int type, vtkIdList *ptIds);
00095   
00096   void Reset();
00097   virtual void CopyStructure(vtkDataSet *ds);
00098   vtkIdType GetNumberOfCells();
00099   virtual vtkCell *GetCell(vtkIdType cellId);
00100   virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00101   virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
00102   virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
00103   void GetPointCells(vtkIdType ptId, vtkIdList *cellIds);
00104 
00105   int GetCellType(vtkIdType cellId);
00106   vtkUnsignedCharArray* GetCellTypesArray() { return this->Types; }
00107   vtkIdTypeArray* GetCellLocationsArray() { return this->Locations; }
00108   void Squeeze();
00109   void Initialize();
00110   int GetMaxCellSize();
00111   void BuildLinks();
00112   vtkCellLinks *GetCellLinks() {return this->Links;};
00113   virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts,
00114                              vtkIdType* &pts);
00115 
00117 
00119   void SetCells(int type, vtkCellArray *cells);
00120   void SetCells(int *types, vtkCellArray *cells);
00121   void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations, 
00122                 vtkCellArray *cells);
00123   vtkCellArray *GetCells() {return this->Connectivity;};
00124   void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts);
00125   int InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
00126   void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId);
00127   void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId);
00128   void ResizeCellList(vtkIdType ptId, int size);
00130 
00132 
00135   virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, 
00136                                 vtkIdList *cellIds);
00138 
00142   void GetUpdateExtent(int &piece, int &numPieces, int &ghostLevel);
00143 
00145 
00146   virtual int* GetUpdateExtent();
00147   virtual void GetUpdateExtent(int& x0, int& x1, int& y0, int& y1,
00148                                int& z0, int& z1);
00149   virtual void GetUpdateExtent(int extent[6]);
00151 
00153 
00155   virtual int GetPiece();
00156   virtual int GetNumberOfPieces();
00158 
00160   virtual int GetGhostLevel();
00161   
00167   unsigned long GetActualMemorySize();
00168     
00170 
00171   virtual void ShallowCopy(vtkDataObject *src);  
00172   virtual void DeepCopy(vtkDataObject *src);
00174 
00178   void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array);
00179 
00181   int IsHomogeneous();
00182 
00185   void RemoveGhostCells(int level);
00186 
00187   //BTX
00189 
00190   static vtkUnstructuredGrid* GetData(vtkInformation* info);
00191   static vtkUnstructuredGrid* GetData(vtkInformationVector* v, int i=0);
00192   //ETX
00194 
00195 protected:
00196   vtkUnstructuredGrid();
00197   ~vtkUnstructuredGrid();
00198 
00199   // used by GetCell method
00200   vtkVertex                         *Vertex;
00201   vtkPolyVertex                     *PolyVertex;
00202   vtkLine                           *Line;
00203   vtkPolyLine                       *PolyLine;
00204   vtkTriangle                       *Triangle;
00205   vtkTriangleStrip                  *TriangleStrip;
00206   vtkPixel                          *Pixel;
00207   vtkQuad                           *Quad;
00208   vtkPolygon                        *Polygon;
00209   vtkTetra                          *Tetra;
00210   vtkVoxel                          *Voxel;
00211   vtkHexahedron                     *Hexahedron;
00212   vtkWedge                          *Wedge;
00213   vtkPyramid                        *Pyramid;
00214   vtkPentagonalPrism                *PentagonalPrism;
00215   vtkHexagonalPrism                 *HexagonalPrism;
00216   vtkQuadraticEdge                  *QuadraticEdge;
00217   vtkQuadraticTriangle              *QuadraticTriangle;
00218   vtkQuadraticQuad                  *QuadraticQuad;
00219   vtkQuadraticTetra                 *QuadraticTetra;
00220   vtkQuadraticHexahedron            *QuadraticHexahedron;
00221   vtkQuadraticWedge                 *QuadraticWedge;
00222   vtkQuadraticPyramid               *QuadraticPyramid;
00223   vtkQuadraticLinearQuad            *QuadraticLinearQuad;
00224   vtkBiQuadraticQuad                *BiQuadraticQuad;
00225   vtkTriQuadraticHexahedron         *TriQuadraticHexahedron;
00226   vtkQuadraticLinearWedge           *QuadraticLinearWedge;
00227   vtkBiQuadraticQuadraticWedge      *BiQuadraticQuadraticWedge;
00228   vtkBiQuadraticQuadraticHexahedron *BiQuadraticQuadraticHexahedron;
00229   vtkBiQuadraticTriangle            *BiQuadraticTriangle;
00230   vtkCubicLine                      *CubicLine;
00231   vtkConvexPointSet                 *ConvexPointSet;
00232   vtkEmptyCell                      *EmptyCell;
00233   
00234   // points inherited
00235   // point data (i.e., scalars, vectors, normals, tcoords) inherited
00236   vtkCellArray *Connectivity;
00237   vtkCellLinks *Links;
00238   vtkUnsignedCharArray *Types;
00239   vtkIdTypeArray *Locations;
00240 
00241  private:
00242   void Cleanup();
00243   
00244   // Hide these from the user and the compiler.
00245   
00247   VTK_LEGACY(void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds));
00248 
00249   vtkUnstructuredGrid(const vtkUnstructuredGrid&);  // Not implemented.
00250   void operator=(const vtkUnstructuredGrid&);  // Not implemented.
00251 };
00252 
00253 #endif
00254 
00255 
00256 
00257 
00258 
00259 
00260