Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Common/vtkUnstructuredGrid.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkUnstructuredGrid.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00047 #ifndef __vtkUnstructuredGrid_h
00048 #define __vtkUnstructuredGrid_h
00049 
00050 #include "vtkPointSet.h"
00051 
00052 class vtkCellArray;
00053 class vtkCellLinks;
00054 class vtkConvexPointSet;
00055 class vtkHexahedron;
00056 class vtkIdList;
00057 class vtkIntArray;
00058 class vtkLine;
00059 class vtkPixel;
00060 class vtkPolyLine;
00061 class vtkPolyVertex;
00062 class vtkPolygon;
00063 class vtkPyramid;
00064 class vtkQuad;
00065 class vtkQuadraticEdge;
00066 class vtkQuadraticHexahedron;
00067 class vtkQuadraticQuad;
00068 class vtkQuadraticTetra;
00069 class vtkQuadraticTriangle;
00070 class vtkTetra;
00071 class vtkTriangle;
00072 class vtkTriangleStrip;
00073 class vtkUnsignedCharArray;
00074 class vtkVertex;
00075 class vtkVoxel;
00076 class vtkWedge;
00077 
00078 class VTK_COMMON_EXPORT vtkUnstructuredGrid : public vtkPointSet {
00079 private:
00080   vtkUnstructuredGrid(const vtkUnstructuredGrid&);  // Not implemented.
00081   void operator=(const vtkUnstructuredGrid&);  // Not implemented.
00082 public:
00083   static vtkUnstructuredGrid *New();
00084 
00085   vtkTypeRevisionMacro(vtkUnstructuredGrid,vtkPointSet);
00086   void PrintSelf(ostream& os, vtkIndent indent);
00087 
00089 
00090   int GetDataObjectType() {return VTK_UNSTRUCTURED_GRID;};
00091   virtual void Allocate(vtkIdType numCells=1000, int extSize=1000);
00092   int InsertNextCell(int type, int npts, vtkIdType *pts);
00093   int InsertNextCell(int type, vtkIdList *ptIds);
00094   void Reset();
00095   void SetCells(int *types, vtkCellArray *cells);
00096   void SetCells(vtkUnsignedCharArray *cellTypes, vtkIntArray *cellLocations, 
00097                 vtkCellArray *cells);
00098   vtkCellArray *GetCells() {return this->Connectivity;};
00099   virtual void CopyStructure(vtkDataSet *ds);
00100   vtkIdType GetNumberOfCells();
00101   virtual vtkCell *GetCell(vtkIdType cellId);
00102   virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00103   virtual void GetCellBounds(vtkIdType cellId, float bounds[6]);
00104   virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
00105   void GetPointCells(vtkIdType ptId, vtkIdList *cellIds);
00107 
00108   int GetCellType(vtkIdType cellId);
00109   vtkUnsignedCharArray* GetCellTypesArray() { return this->Types; }
00110   vtkIntArray* GetCellLocationsArray() { return this->Locations; }
00111   void Squeeze();
00112   void Initialize();
00113   int GetMaxCellSize();
00114   void BuildLinks();
00115   vtkCellLinks *GetCellLinks() {return this->Links;};
00116   virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts,
00117                              vtkIdType* &pts);
00118   void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts);
00119   int InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
00120   void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId);
00121   void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId);
00122   void ResizeCellList(vtkIdType ptId, int size);
00123 
00125 
00128   virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, 
00129                                 vtkIdList *cellIds);
00131 
00133 
00136   void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00137   void SetUpdateExtent(int piece, int numPieces)
00138     {this->SetUpdateExtent(piece, numPieces, 0);}
00139   void GetUpdateExtent(int &piece, int &numPieces, int &ghostLevel);
00141 
00143 
00144   vtkGetVector6Macro( UpdateExtent, int );
00146 
00148 
00152   void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00153     { this->Superclass::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00154   void SetUpdateExtent( int ext[6] )
00155     { this->Superclass::SetUpdateExtent( ext ); };
00157 
00158 
00160 
00162   vtkGetMacro( Piece, int );
00163   vtkGetMacro( NumberOfPieces, int );
00165 
00167 
00168   vtkGetMacro( GhostLevel, int );
00170   
00176   unsigned long GetActualMemorySize();
00177     
00179 
00180   virtual void ShallowCopy(vtkDataObject *src);  
00181   virtual void DeepCopy(vtkDataObject *src);
00183 
00187   void GetListOfUniqueCellTypes(vtkUnsignedCharArray *uniqueTypes);
00188 
00192   void GetIdsOfCellsOfType(int type, vtkIntArray *array);
00193 
00195   int IsHomogeneous();
00196 
00199   void RemoveGhostCells(int level);
00200 
00201 protected:
00202   vtkUnstructuredGrid();
00203   ~vtkUnstructuredGrid();
00204 
00205   // used by GetCell method
00206   vtkVertex        *Vertex;
00207   vtkPolyVertex    *PolyVertex;
00208   vtkLine          *Line;
00209   vtkPolyLine      *PolyLine;
00210   vtkTriangle      *Triangle;
00211   vtkTriangleStrip *TriangleStrip;
00212   vtkPixel         *Pixel;
00213   vtkQuad          *Quad;
00214   vtkPolygon       *Polygon;
00215   vtkTetra      *Tetra;
00216   vtkVoxel      *Voxel;
00217   vtkHexahedron *Hexahedron;
00218   vtkWedge      *Wedge;
00219   vtkPyramid    *Pyramid;
00220   vtkQuadraticEdge       *QuadraticEdge;
00221   vtkQuadraticTriangle   *QuadraticTriangle;
00222   vtkQuadraticQuad       *QuadraticQuad;
00223   vtkQuadraticTetra      *QuadraticTetra;
00224   vtkQuadraticHexahedron *QuadraticHexahedron;
00225   vtkConvexPointSet      *ConvexPointSet;
00226   
00227   // points inherited
00228   // point data (i.e., scalars, vectors, normals, tcoords) inherited
00229   vtkCellArray *Connectivity;
00230   vtkCellLinks *Links;
00231   vtkUnsignedCharArray *Types;
00232   vtkIntArray *Locations;
00233 
00234  private:
00235   // Hide these from the user and the compiler.
00236   
00238 
00239   void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00240     {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00242 };
00243 
00244 #endif
00245 
00246 
00247 
00248 
00249 
00250 
00251