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

Common/vtkStructuredGrid.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkStructuredGrid.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 =========================================================================*/
00065 #ifndef __vtkStructuredGrid_h
00066 #define __vtkStructuredGrid_h
00067 
00068 #include "vtkPointSet.h"
00069 
00070 #include "vtkStructuredData.h" // Needed for inline methods
00071 #include "vtkUnsignedCharArray.h" // Needed for inline methods
00072 
00073 class vtkEmptyCell;
00074 class vtkHexahedron;
00075 class vtkLine;
00076 class vtkQuad;
00077 class vtkVertex;
00078 
00079 class VTK_COMMON_EXPORT vtkStructuredGrid : public vtkPointSet 
00080 {
00081 public:
00082   static vtkStructuredGrid *New();
00083 
00084   vtkTypeRevisionMacro(vtkStructuredGrid,vtkPointSet);
00085   void PrintSelf(ostream& os, vtkIndent indent);
00086  
00088   int GetDataObjectType() {return VTK_STRUCTURED_GRID;}
00089 
00092   void CopyStructure(vtkDataSet *ds);
00093 
00095 
00096   vtkIdType GetNumberOfPoints() {return vtkPointSet::GetNumberOfPoints();}
00097   float *GetPoint(vtkIdType ptId) {return this->vtkPointSet::GetPoint(ptId);}
00098   void GetPoint(vtkIdType ptId, float p[3])
00099     {this->vtkPointSet::GetPoint(ptId,p);}
00100   vtkCell *GetCell(vtkIdType cellId);
00101   void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00102   void GetCellBounds(vtkIdType cellId, float bounds[6]);
00103   int GetCellType(vtkIdType cellId);
00104   vtkIdType GetNumberOfCells();
00105   void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
00106   void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00107     {
00108       vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());
00109     }
00110   void Initialize();
00111   int GetMaxCellSize() {return 8;}; //hexahedron is the largest
00112   void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
00113                         vtkIdList *cellIds);
00114   virtual void GetScalarRange(float range[2]);
00115   float *GetScalarRange() {return this->vtkPointSet::GetScalarRange();}
00117 
00119 
00120   void SetDimensions(int i, int j, int k);
00121   void SetDimensions(int dim[3]);
00123 
00125 
00126   virtual int *GetDimensions ();
00127   virtual void GetDimensions (int dim[3]);
00129 
00131   int GetDataDimension();
00132 
00134 
00136   void SetBlanking(int blanking);
00137   int GetBlanking() {return this->Blanking;}
00138   void BlankingOn();
00139   void BlankingOff();
00140   void BlankPoint(vtkIdType ptId);
00141   void UnBlankPoint(vtkIdType ptId);
00143   
00145 
00146   vtkUnsignedCharArray *GetPointVisibility() 
00147     {return this->PointVisibility;}
00149 
00153   void SetPointVisibility(vtkUnsignedCharArray *pointVisibility);
00154 
00156 
00158   unsigned char IsPointVisible(vtkIdType ptId)
00159     {return (this->Blanking ? this->PointVisibility->GetValue(ptId) : 1);}
00161   
00164   unsigned char IsCellVisible(vtkIdType cellId);
00165   
00167 
00170   void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00171   void SetUpdateExtent(int piece, int numPieces)
00172     {this->SetUpdateExtent(piece, numPieces, 0);}
00174 
00176 
00177   void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00178     { this->vtkPointSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00179   void SetUpdateExtent( int ext[6] )
00180     { this->vtkPointSet::SetUpdateExtent( ext ); };
00182 
00184 
00187   void SetExtent(int extent[6]);
00188   void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00189   vtkGetVector6Macro(Extent,int);
00191 
00197   unsigned long GetActualMemorySize();
00198 
00200 
00201   void ShallowCopy(vtkDataObject *src);  
00202   void DeepCopy(vtkDataObject *src);
00204 
00207   virtual void UpdateData();
00208 
00209 protected:
00210   vtkStructuredGrid();
00211   ~vtkStructuredGrid();
00212 
00213   // for the GetCell method
00214   vtkVertex *Vertex;
00215   vtkLine *Line;
00216   vtkQuad *Quad;  
00217   vtkHexahedron *Hexahedron;
00218   vtkEmptyCell *EmptyCell;
00219 
00220   // The extent type is a 3D extent
00221   int GetExtentType() { return VTK_3D_EXTENT; }
00222   
00226   virtual void Crop();
00227 
00228   int Dimensions[3];
00229   int DataDescription;
00230   int Blanking;
00231   vtkUnsignedCharArray *PointVisibility;
00232   void AllocatePointVisibility();
00233 
00234 private:
00236 
00237   void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00238     {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00240 
00241   // Internal method used by DeepCopy and ShallowCopy.
00242   void InternalStructuredGridCopy(vtkStructuredGrid *src);
00243 
00244 private:
00245   vtkStructuredGrid(const vtkStructuredGrid&);  // Not implemented.
00246   void operator=(const vtkStructuredGrid&);  // Not implemented.
00247 };
00248 
00249 
00250 inline vtkIdType vtkStructuredGrid::GetNumberOfCells() 
00251 {
00252   int nCells=1;
00253   int dims[3];
00254   int i;
00255 
00256   this->GetDimensions(dims);
00257   for (i=0; i<3; i++)
00258     {
00259     if (dims[i] <= 0)
00260       {
00261       return 0;
00262       }
00263     if (dims[i] > 1)
00264       {
00265       nCells *= (dims[i]-1);
00266       }
00267     }
00268 
00269   return nCells;
00270 }
00271 
00272 inline int vtkStructuredGrid::GetDataDimension()
00273 {
00274   return vtkStructuredData::GetDataDimension(this->DataDescription);
00275 }
00276 
00277 #endif
00278 
00279 
00280 
00281 
00282 
00283