Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkUnstructuredGrid.h

Go to the documentation of this file.
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 =========================================================================*/
00040 #ifndef __vtkUnstructuredGrid_h
00041 #define __vtkUnstructuredGrid_h
00042 
00043 #include "vtkPointSet.h"
00044 
00045 class vtkCellArray;
00046 class vtkCellLinks;
00047 class vtkConvexPointSet;
00048 class vtkEmptyCell;
00049 class vtkHexahedron;
00050 class vtkIdList;
00051 class vtkIdTypeArray;
00052 class vtkLine;
00053 class vtkPixel;
00054 class vtkPolyLine;
00055 class vtkPolyVertex;
00056 class vtkPolygon;
00057 class vtkPyramid;
00058 class vtkPentagonalPrism;
00059 class vtkHexagonalPrism;
00060 class vtkQuad;
00061 class vtkQuadraticEdge;
00062 class vtkQuadraticHexahedron;
00063 class vtkQuadraticWedge;
00064 class vtkQuadraticPyramid;
00065 class vtkQuadraticQuad;
00066 class vtkQuadraticTetra;
00067 class vtkQuadraticTriangle;
00068 class vtkTetra;
00069 class vtkTriangle;
00070 class vtkTriangleStrip;
00071 class vtkUnsignedCharArray;
00072 class vtkVertex;
00073 class vtkVoxel;
00074 class vtkWedge;
00075 
00076 class VTK_FILTERING_EXPORT vtkUnstructuredGrid : public vtkPointSet 
00077 {
00078 public:
00079   static vtkUnstructuredGrid *New();
00080 
00081   vtkTypeRevisionMacro(vtkUnstructuredGrid,vtkPointSet);
00082   void PrintSelf(ostream& os, vtkIndent indent);
00083 
00085 
00086   int GetDataObjectType() {return VTK_UNSTRUCTURED_GRID;};
00087   virtual void Allocate(vtkIdType numCells=1000, int extSize=1000);
00088   vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *pts);
00089   vtkIdType InsertNextCell(int type, vtkIdList *ptIds);
00090   void Reset();
00091   virtual void CopyStructure(vtkDataSet *ds);
00092   vtkIdType GetNumberOfCells();
00093   virtual vtkCell *GetCell(vtkIdType cellId);
00094   virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00095   virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
00096   virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
00097   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 
00135 
00138   void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00139   void SetUpdateExtent(int piece, int numPieces)
00140     {this->SetUpdateExtent(piece, numPieces, 0);}
00141   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 
00157   void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00158     { this->Superclass::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00159   void SetUpdateExtent( int ext[6] )
00160     { this->Superclass::SetUpdateExtent( ext ); };
00162 
00163 
00165 
00167   virtual int GetPiece();
00168   virtual int GetNumberOfPieces();
00170 
00172   virtual int GetGhostLevel();
00173   
00179   unsigned long GetActualMemorySize();
00180     
00182 
00183   virtual void ShallowCopy(vtkDataObject *src);  
00184   virtual void DeepCopy(vtkDataObject *src);
00186 
00190   void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array);
00191 
00193   int IsHomogeneous();
00194 
00197   void RemoveGhostCells(int level);
00198 
00199 protected:
00200   vtkUnstructuredGrid();
00201   ~vtkUnstructuredGrid();
00202 
00203   // used by GetCell method
00204   vtkVertex              *Vertex;
00205   vtkPolyVertex          *PolyVertex;
00206   vtkLine                *Line;
00207   vtkPolyLine            *PolyLine;
00208   vtkTriangle            *Triangle;
00209   vtkTriangleStrip       *TriangleStrip;
00210   vtkPixel               *Pixel;
00211   vtkQuad                *Quad;
00212   vtkPolygon             *Polygon;
00213   vtkTetra               *Tetra;
00214   vtkVoxel               *Voxel;
00215   vtkHexahedron          *Hexahedron;
00216   vtkWedge               *Wedge;
00217   vtkPyramid             *Pyramid;
00218   vtkPentagonalPrism     *PentagonalPrism;
00219   vtkHexagonalPrism      *HexagonalPrism;
00220   vtkQuadraticEdge       *QuadraticEdge;
00221   vtkQuadraticTriangle   *QuadraticTriangle;
00222   vtkQuadraticQuad       *QuadraticQuad;
00223   vtkQuadraticTetra      *QuadraticTetra;
00224   vtkQuadraticHexahedron *QuadraticHexahedron;
00225   vtkQuadraticWedge      *QuadraticWedge;
00226   vtkQuadraticPyramid    *QuadraticPyramid;
00227   vtkConvexPointSet      *ConvexPointSet;
00228   vtkEmptyCell           *EmptyCell;
00229   
00230   // points inherited
00231   // point data (i.e., scalars, vectors, normals, tcoords) inherited
00232   vtkCellArray *Connectivity;
00233   vtkCellLinks *Links;
00234   vtkUnsignedCharArray *Types;
00235   vtkIdTypeArray *Locations;
00236 
00237  private:
00238   // Hide these from the user and the compiler.
00239   
00241 
00242   void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00243     {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00245 
00246   vtkUnstructuredGrid(const vtkUnstructuredGrid&);  // Not implemented.
00247   void operator=(const vtkUnstructuredGrid&);  // Not implemented.
00248 };
00249 
00250 #endif
00251 
00252 
00253 
00254 
00255 
00256 
00257