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 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00058 #ifndef __vtkUnstructuredGrid_h
00059 #define __vtkUnstructuredGrid_h
00060 
00061 #include "vtkPointSet.h"
00062 #include "vtkIdList.h"
00063 #include "vtkCellArray.h"
00064 #include "vtkCellLinks.h"
00065 #include "vtkIntArray.h"
00066 #include "vtkUnsignedCharArray.h"
00067 class vtkVertex;
00068 class vtkPolyVertex;
00069 class vtkLine;
00070 class vtkPolyLine;
00071 class vtkTriangle;
00072 class vtkTriangleStrip;
00073 class vtkPixel;
00074 class vtkQuad;
00075 class vtkPolygon;
00076 class vtkTetra;
00077 class vtkVoxel;
00078 class vtkHexahedron;
00079 class vtkWedge;
00080 class vtkPyramid;
00081 
00082 class VTK_COMMON_EXPORT vtkUnstructuredGrid : public vtkPointSet {
00083 private:
00084   vtkUnstructuredGrid(const vtkUnstructuredGrid&);  // Not implemented.
00085   void operator=(const vtkUnstructuredGrid&);  // Not implemented.
00086 public:
00087   static vtkUnstructuredGrid *New();
00088 
00089   vtkTypeMacro(vtkUnstructuredGrid,vtkPointSet);
00090   void PrintSelf(ostream& os, vtkIndent indent);
00091 
00093 
00094   int GetDataObjectType() {return VTK_UNSTRUCTURED_GRID;};
00095   virtual void Allocate(vtkIdType numCells=1000, int extSize=1000);
00096   int InsertNextCell(int type, int npts, vtkIdType *pts);
00097   int InsertNextCell(int type, vtkIdList *ptIds);
00098   void Reset();
00099   void SetCells(int *types, vtkCellArray *cells);
00100   void SetCells(vtkUnsignedCharArray *cellTypes, vtkIntArray *cellLocations, 
00101                 vtkCellArray *cells);
00102   vtkCellArray *GetCells() {return this->Connectivity;};
00103   vtkDataObject *MakeObject() {return vtkUnstructuredGrid::New();};
00104   virtual void CopyStructure(vtkDataSet *ds);
00105   vtkIdType GetNumberOfCells();
00106   virtual vtkCell *GetCell(vtkIdType cellId);
00107   virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00108   virtual void GetCellBounds(vtkIdType cellId, float bounds[6]);
00109   virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
00110   void GetPointCells(vtkIdType ptId, vtkIdList *cellIds);
00112 
00113   int GetCellType(vtkIdType cellId);
00114   void Squeeze();
00115   void Initialize();
00116   int GetMaxCellSize();
00117   void BuildLinks();
00118   vtkCellLinks *GetCellLinks() {return this->Links;};
00119   virtual void GetCellPoints(vtkIdType cellId, vtkIdType& npts,
00120                              vtkIdType* &pts);
00121   void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts);
00122   int InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
00123   void RemoveReferenceToCell(vtkIdType ptId, vtkIdType cellId);
00124   void AddReferenceToCell(vtkIdType ptId, vtkIdType cellId);
00125   void ResizeCellList(vtkIdType ptId, int size);
00126 
00128 
00131   virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, 
00132                                 vtkIdList *cellIds);
00134 
00136 
00139   void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00140   void SetUpdateExtent(int piece, int numPieces)
00141     {this->SetUpdateExtent(piece, numPieces, 0);}
00142   void GetUpdateExtent(int &piece, int &numPieces, int &ghostLevel);
00144 
00146 
00147   vtkGetVector6Macro( UpdateExtent, int );
00149 
00151 
00155   void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00156     { this->vtkPointSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00157   void SetUpdateExtent( int ext[6] )
00158     { this->vtkPointSet::SetUpdateExtent( ext ); };
00160 
00161 
00163 
00165   vtkGetMacro( Piece, int );
00166   vtkGetMacro( NumberOfPieces, int );
00168 
00170 
00171   vtkGetMacro( GhostLevel, int );
00173   
00179   unsigned long GetActualMemorySize();
00180     
00182 
00183   virtual void ShallowCopy(vtkDataObject *src);  
00184   virtual void DeepCopy(vtkDataObject *src);
00186 
00190   void GetListOfUniqueCellTypes(vtkUnsignedCharArray *uniqueTypes);
00191 
00195   void GetIdsOfCellsOfType(int type, vtkIntArray *array);
00196 
00198   int IsHomogeneous();
00199 
00200 protected:
00201   vtkUnstructuredGrid();
00202   ~vtkUnstructuredGrid();
00203 
00204   // used by GetCell method
00205   vtkVertex *Vertex;
00206   vtkPolyVertex *PolyVertex;
00207   vtkLine *Line;
00208   vtkPolyLine *PolyLine;
00209   vtkTriangle *Triangle;
00210   vtkTriangleStrip *TriangleStrip;
00211   vtkPixel *Pixel;
00212   vtkQuad *Quad;
00213   vtkPolygon *Polygon;
00214   vtkTetra *Tetra;
00215   vtkVoxel *Voxel;
00216   vtkHexahedron *Hexahedron;
00217   vtkWedge *Wedge;
00218   vtkPyramid *Pyramid;
00219   
00220   // points inherited
00221   // point data (i.e., scalars, vectors, normals, tcoords) inherited
00222   vtkCellArray *Connectivity;
00223   vtkCellLinks *Links;
00224   vtkUnsignedCharArray *Types;
00225   vtkIntArray *Locations;
00226 
00227  private:
00228   // Hide these from the user and the compiler.
00229   
00231 
00232   void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00233     {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00235 };
00236 
00237 #endif
00238 
00239 
00240 
00241 
00242 
00243 
00244 

Generated on Thu Mar 28 14:19:18 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001