00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00055 #ifndef __vtkUnstructuredGrid_h
00056 #define __vtkUnstructuredGrid_h
00057 
00058 #include "vtkPointSet.h"
00059 #include "vtkIdList.h"
00060 #include "vtkCellArray.h"
00061 #include "vtkCellTypes.h"
00062 #include "vtkCellLinks.h"
00063 class vtkVertex;
00064 class vtkPolyVertex;
00065 class vtkLine;
00066 class vtkPolyLine;
00067 class vtkTriangle;
00068 class vtkTriangleStrip;
00069 class vtkPixel;
00070 class vtkQuad;
00071 class vtkPolygon;
00072 class vtkTetra;
00073 class vtkVoxel;
00074 class vtkHexahedron;
00075 class vtkWedge;
00076 class vtkPyramid;
00077 
00078 class VTK_EXPORT vtkUnstructuredGrid : public vtkPointSet {
00079 public:
00080   static vtkUnstructuredGrid *New();
00081 
00082   vtkTypeMacro(vtkUnstructuredGrid,vtkPointSet);
00083   void PrintSelf(ostream& os, vtkIndent indent);
00084 
00086   int GetDataObjectType() {return VTK_UNSTRUCTURED_GRID;};
00087   void Allocate(int numCells=1000, int extSize=1000);
00088   int InsertNextCell(int type, int npts, int *pts);
00089   int InsertNextCell(int type, vtkIdList *ptIds);
00090   void Reset();
00091   void SetCells(int *types, vtkCellArray *cells);
00092   vtkCellArray *GetCells() {return this->Connectivity;};
00093   vtkDataObject *MakeObject() {return vtkUnstructuredGrid::New();};
00094   void CopyStructure(vtkDataSet *ds);
00095   int GetNumberOfCells();
00096   vtkCell *GetCell(int cellId);
00097   void GetCell(int cellId, vtkGenericCell *cell);
00098   void GetCellBounds(int cellId, float bounds[6]);
00099   void GetCellPoints(int cellId, vtkIdList *ptIds);
00100   void GetPointCells(int ptId, vtkIdList *cellIds);
00101 
00102   int GetCellType(int cellId);
00103   void Squeeze();
00104   void Initialize();
00105   int GetMaxCellSize();
00106   void BuildLinks();
00107   vtkCellLinks *GetCellLinks() {return this->Links;};
00108   void GetCellPoints(int cellId, int& npts, int* &pts);
00109   void ReplaceCell(int cellId, int npts, int *pts);
00110   int InsertNextLinkedCell(int type, int npts, int *pts); 
00111   void RemoveReferenceToCell(int ptId, int cellId);
00112   void AddReferenceToCell(int ptId, int cellId);
00113   void ResizeCellList(int ptId, int size);
00114 
00118   virtual void GetCellNeighbors(int cellId, vtkIdList *ptIds, 
00119             vtkIdList *cellIds);
00120 
00124   void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00125   void SetUpdateExtent(int piece, int numPieces)
00126     {this->SetUpdateExtent(piece, numPieces, 0);}
00127   void GetUpdateExtent(int &piece, int &numPieces, int &ghostLevel);
00128 
00130   vtkGetVector6Macro( UpdateExtent, int );
00131 
00136   void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00137     { this->vtkPointSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00138   void SetUpdateExtent( int ext[6] )
00139     { this->vtkPointSet::SetUpdateExtent( ext ); };
00140 
00141 
00144   vtkGetMacro( Piece, int );
00145   vtkGetMacro( NumberOfPieces, int );
00146 
00148   vtkGetMacro( GhostLevel, int );
00149   
00155   unsigned long GetActualMemorySize();
00156     
00158   void ShallowCopy(vtkDataObject *src);  
00159   void DeepCopy(vtkDataObject *src);
00160 
00161 #ifndef VTK_REMOVE_LEGACY_CODE
00162 
00163   void GetCellPoints(int cellId, vtkIdList &ptIds)
00164     {VTK_LEGACY_METHOD(GetCellPoints,"3.2"); this->GetCellPoints(cellId, &ptIds);}
00165   void GetPointCells(int ptId, vtkIdList &cellIds)
00166     {VTK_LEGACY_METHOD(GetPointCells,"3.2"); this->GetPointCells(ptId, &cellIds);}
00167   int InsertNextCell(int type, vtkIdList &pts) 
00168     {VTK_LEGACY_METHOD(InsertNextCell,"3.2"); return this->InsertNextCell(type, &pts);}
00169 #endif
00170   
00171 protected:
00172   vtkUnstructuredGrid();
00173   ~vtkUnstructuredGrid();
00174   vtkUnstructuredGrid(const vtkUnstructuredGrid&) {};
00175   void operator=(const vtkUnstructuredGrid&) {};
00176 
00177   
00178   vtkVertex *Vertex;
00179   vtkPolyVertex *PolyVertex;
00180   vtkLine *Line;
00181   vtkPolyLine *PolyLine;
00182   vtkTriangle *Triangle;
00183   vtkTriangleStrip *TriangleStrip;
00184   vtkPixel *Pixel;
00185   vtkQuad *Quad;
00186   vtkPolygon *Polygon;
00187   vtkTetra *Tetra;
00188   vtkVoxel *Voxel;
00189   vtkHexahedron *Hexahedron;
00190   vtkWedge *Wedge;
00191   vtkPyramid *Pyramid;
00192   
00193   
00194   
00195   vtkCellTypes *Cells;
00196   vtkCellArray *Connectivity;
00197   vtkCellLinks *Links;
00198 
00199  private:
00200   
00201   
00203   void GetCellNeighbors(int cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00204     {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00205 };
00206 
00207 #endif
00208 
00209 
00210 
00211 
00212 
00213 
00214