Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class 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 
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 vtkQuad;
00049 class vtkQuadraticEdge;
00050 class vtkQuadraticHexahedron;
00051 class vtkQuadraticQuad;
00052 class vtkQuadraticTetra;
00053 class vtkQuadraticTriangle;
00054 class vtkTetra;
00055 class vtkTriangle;
00056 class vtkTriangleStrip;
00057 class vtkUnsignedCharArray;
00058 class vtkVertex;
00059 class vtkVoxel;
00060 class vtkWedge;
00061 
00062 class VTK_COMMON_EXPORT vtkUnstructuredGrid : public vtkPointSet {
00063 private:
00064   vtkUnstructuredGrid(const vtkUnstructuredGrid&);  // Not implemented.
00065   void operator=(const vtkUnstructuredGrid&);  // Not implemented.
00066 public:
00067   static vtkUnstructuredGrid *New();
00068 
00069   vtkTypeRevisionMacro(vtkUnstructuredGrid,vtkPointSet);
00070   void PrintSelf(ostream& os, vtkIndent indent);
00071 
00073 
00074   int GetDataObjectType() {return VTK_UNSTRUCTURED_GRID;};
00075   virtual void Allocate(vtkIdType numCells=1000, int extSize=1000);
00076   int InsertNextCell(int type, int npts, vtkIdType *pts);
00077   int InsertNextCell(int type, vtkIdList *ptIds);
00078   void Reset();
00079   virtual void CopyStructure(vtkDataSet *ds);
00080   vtkIdType GetNumberOfCells();
00081   virtual vtkCell *GetCell(vtkIdType cellId);
00082   virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00083   virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
00084   virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
00085   void GetPointCells(vtkIdType ptId, vtkIdList *cellIds);
00087 
00088   int GetCellType(vtkIdType cellId);
00089   vtkUnsignedCharArray* GetCellTypesArray() { return this->Types; }
00090   vtkIdTypeArray* GetCellLocationsArray() { return this->Locations; }
00091   void Squeeze();
00092   void Initialize();
00093   int GetMaxCellSize();
00094   void BuildLinks();
00095   vtkCellLinks *GetCellLinks() {return this->Links;};
00096   virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts,
00097                              vtkIdType* &pts);
00098 
00100 
00102   void SetCells(int type, vtkCellArray *cells);
00103   void SetCells(int *types, vtkCellArray *cells);
00104   void SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations, 
00105                 vtkCellArray *cells);
00106   vtkCellArray *GetCells() {return this->Connectivity;};
00107   void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts);
00108   int InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
00109   void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId);
00110   void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId);
00111   void ResizeCellList(vtkIdType ptId, int size);
00113 
00115 
00118   virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, 
00119                                 vtkIdList *cellIds);
00121 
00123 
00126   void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00127   void SetUpdateExtent(int piece, int numPieces)
00128     {this->SetUpdateExtent(piece, numPieces, 0);}
00129   void GetUpdateExtent(int &piece, int &numPieces, int &ghostLevel);
00131 
00133 
00134   vtkGetVector6Macro( UpdateExtent, int );
00136 
00138 
00142   void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00143     { this->Superclass::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00144   void SetUpdateExtent( int ext[6] )
00145     { this->Superclass::SetUpdateExtent( ext ); };
00147 
00148 
00150 
00152   vtkGetMacro( Piece, int );
00153   vtkGetMacro( NumberOfPieces, int );
00155 
00157 
00158   vtkGetMacro( GhostLevel, int );
00160   
00166   unsigned long GetActualMemorySize();
00167     
00169 
00170   virtual void ShallowCopy(vtkDataObject *src);  
00171   virtual void DeepCopy(vtkDataObject *src);
00173 
00177   void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array);
00178 
00180   int IsHomogeneous();
00181 
00184   void RemoveGhostCells(int level);
00185 
00186 protected:
00187   vtkUnstructuredGrid();
00188   ~vtkUnstructuredGrid();
00189 
00190   // used by GetCell method
00191   vtkVertex        *Vertex;
00192   vtkPolyVertex    *PolyVertex;
00193   vtkLine          *Line;
00194   vtkPolyLine      *PolyLine;
00195   vtkTriangle      *Triangle;
00196   vtkTriangleStrip *TriangleStrip;
00197   vtkPixel         *Pixel;
00198   vtkQuad          *Quad;
00199   vtkPolygon       *Polygon;
00200   vtkTetra      *Tetra;
00201   vtkVoxel      *Voxel;
00202   vtkHexahedron *Hexahedron;
00203   vtkWedge      *Wedge;
00204   vtkPyramid    *Pyramid;
00205   vtkQuadraticEdge       *QuadraticEdge;
00206   vtkQuadraticTriangle   *QuadraticTriangle;
00207   vtkQuadraticQuad       *QuadraticQuad;
00208   vtkQuadraticTetra      *QuadraticTetra;
00209   vtkQuadraticHexahedron *QuadraticHexahedron;
00210   vtkConvexPointSet      *ConvexPointSet;
00211   vtkEmptyCell *EmptyCell;
00212   
00213   // points inherited
00214   // point data (i.e., scalars, vectors, normals, tcoords) inherited
00215   vtkCellArray *Connectivity;
00216   vtkCellLinks *Links;
00217   vtkUnsignedCharArray *Types;
00218   vtkIdTypeArray *Locations;
00219 
00220  private:
00221   // Hide these from the user and the compiler.
00222   
00224 
00225   void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00226     {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00228 };
00229 
00230 #endif
00231 
00232 
00233 
00234 
00235 
00236 
00237