Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | 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   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 =========================================================================*/
00034 #ifndef __vtkUnstructuredGrid_h
00035 #define __vtkUnstructuredGrid_h
00036 
00037 #include "vtkPointSet.h"
00038 
00039 class vtkCellArray;
00040 class vtkCellLinks;
00041 class vtkConvexPointSet;
00042 class vtkHexahedron;
00043 class vtkIdList;
00044 class vtkIntArray;
00045 class vtkLine;
00046 class vtkPixel;
00047 class vtkPolyLine;
00048 class vtkPolyVertex;
00049 class vtkPolygon;
00050 class vtkPyramid;
00051 class vtkQuad;
00052 class vtkQuadraticEdge;
00053 class vtkQuadraticHexahedron;
00054 class vtkQuadraticQuad;
00055 class vtkQuadraticTetra;
00056 class vtkQuadraticTriangle;
00057 class vtkTetra;
00058 class vtkTriangle;
00059 class vtkTriangleStrip;
00060 class vtkUnsignedCharArray;
00061 class vtkVertex;
00062 class vtkVoxel;
00063 class vtkWedge;
00064 
00065 class VTK_COMMON_EXPORT vtkUnstructuredGrid : public vtkPointSet {
00066 private:
00067   vtkUnstructuredGrid(const vtkUnstructuredGrid&);  // Not implemented.
00068   void operator=(const vtkUnstructuredGrid&);  // Not implemented.
00069 public:
00070   static vtkUnstructuredGrid *New();
00071 
00072   vtkTypeRevisionMacro(vtkUnstructuredGrid,vtkPointSet);
00073   void PrintSelf(ostream& os, vtkIndent indent);
00074 
00076 
00077   int GetDataObjectType() {return VTK_UNSTRUCTURED_GRID;};
00078   virtual void Allocate(vtkIdType numCells=1000, int extSize=1000);
00079   int InsertNextCell(int type, int npts, vtkIdType *pts);
00080   int InsertNextCell(int type, vtkIdList *ptIds);
00081   void Reset();
00082   void SetCells(int *types, vtkCellArray *cells);
00083   void SetCells(vtkUnsignedCharArray *cellTypes, vtkIntArray *cellLocations, 
00084                 vtkCellArray *cells);
00085   vtkCellArray *GetCells() {return this->Connectivity;};
00086   virtual void CopyStructure(vtkDataSet *ds);
00087   vtkIdType GetNumberOfCells();
00088   virtual vtkCell *GetCell(vtkIdType cellId);
00089   virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00090   virtual void GetCellBounds(vtkIdType cellId, float bounds[6]);
00091   virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
00092   void GetPointCells(vtkIdType ptId, vtkIdList *cellIds);
00094 
00095   int GetCellType(vtkIdType cellId);
00096   vtkUnsignedCharArray* GetCellTypesArray() { return this->Types; }
00097   vtkIntArray* GetCellLocationsArray() { return this->Locations; }
00098   void Squeeze();
00099   void Initialize();
00100   int GetMaxCellSize();
00101   void BuildLinks();
00102   vtkCellLinks *GetCellLinks() {return this->Links;};
00103   virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts,
00104                              vtkIdType* &pts);
00105   void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts);
00106   int InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
00107   void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId);
00108   void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId);
00109   void ResizeCellList(vtkIdType ptId, int size);
00110 
00112 
00115   virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, 
00116                                 vtkIdList *cellIds);
00118 
00120 
00123   void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00124   void SetUpdateExtent(int piece, int numPieces)
00125     {this->SetUpdateExtent(piece, numPieces, 0);}
00126   void GetUpdateExtent(int &piece, int &numPieces, int &ghostLevel);
00128 
00130 
00131   vtkGetVector6Macro( UpdateExtent, int );
00133 
00135 
00139   void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00140     { this->Superclass::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00141   void SetUpdateExtent( int ext[6] )
00142     { this->Superclass::SetUpdateExtent( ext ); };
00144 
00145 
00147 
00149   vtkGetMacro( Piece, int );
00150   vtkGetMacro( NumberOfPieces, int );
00152 
00154 
00155   vtkGetMacro( GhostLevel, int );
00157   
00163   unsigned long GetActualMemorySize();
00164     
00166 
00167   virtual void ShallowCopy(vtkDataObject *src);  
00168   virtual void DeepCopy(vtkDataObject *src);
00170 
00174   void GetListOfUniqueCellTypes(vtkUnsignedCharArray *uniqueTypes);
00175 
00179   void GetIdsOfCellsOfType(int type, vtkIntArray *array);
00180 
00182   int IsHomogeneous();
00183 
00186   void RemoveGhostCells(int level);
00187 
00188 protected:
00189   vtkUnstructuredGrid();
00190   ~vtkUnstructuredGrid();
00191 
00192   // used by GetCell method
00193   vtkVertex        *Vertex;
00194   vtkPolyVertex    *PolyVertex;
00195   vtkLine          *Line;
00196   vtkPolyLine      *PolyLine;
00197   vtkTriangle      *Triangle;
00198   vtkTriangleStrip *TriangleStrip;
00199   vtkPixel         *Pixel;
00200   vtkQuad          *Quad;
00201   vtkPolygon       *Polygon;
00202   vtkTetra      *Tetra;
00203   vtkVoxel      *Voxel;
00204   vtkHexahedron *Hexahedron;
00205   vtkWedge      *Wedge;
00206   vtkPyramid    *Pyramid;
00207   vtkQuadraticEdge       *QuadraticEdge;
00208   vtkQuadraticTriangle   *QuadraticTriangle;
00209   vtkQuadraticQuad       *QuadraticQuad;
00210   vtkQuadraticTetra      *QuadraticTetra;
00211   vtkQuadraticHexahedron *QuadraticHexahedron;
00212   vtkConvexPointSet      *ConvexPointSet;
00213   
00214   // points inherited
00215   // point data (i.e., scalars, vectors, normals, tcoords) inherited
00216   vtkCellArray *Connectivity;
00217   vtkCellLinks *Links;
00218   vtkUnsignedCharArray *Types;
00219   vtkIntArray *Locations;
00220 
00221  private:
00222   // Hide these from the user and the compiler.
00223   
00225 
00226   void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00227     {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00229 };
00230 
00231 #endif
00232 
00233 
00234 
00235 
00236 
00237 
00238