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 
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 =========================================================================*/
00047 #ifndef __vtkStructuredGrid_h
00048 #define __vtkStructuredGrid_h
00049 
00050 #include "vtkPointSet.h"
00051 
00052 #include "vtkStructuredData.h" // Needed for inline methods
00053 
00054 class vtkEmptyCell;
00055 class vtkHexahedron;
00056 class vtkLine;
00057 class vtkQuad;
00058 class vtkStructuredVisibilityConstraint;
00059 class vtkUnsignedCharArray;
00060 class vtkVertex;
00061 
00062 class VTK_COMMON_EXPORT vtkStructuredGrid : public vtkPointSet 
00063 {
00064 public:
00065   static vtkStructuredGrid *New();
00066 
00067   vtkTypeRevisionMacro(vtkStructuredGrid,vtkPointSet);
00068   void PrintSelf(ostream& os, vtkIndent indent);
00069  
00071   int GetDataObjectType() {return VTK_STRUCTURED_GRID;}
00072 
00075   void CopyStructure(vtkDataSet *ds);
00076 
00078 
00079   vtkIdType GetNumberOfPoints() {return vtkPointSet::GetNumberOfPoints();}
00080   double *GetPoint(vtkIdType ptId) {return this->vtkPointSet::GetPoint(ptId);}
00081   void GetPoint(vtkIdType ptId, double p[3])
00082     {this->vtkPointSet::GetPoint(ptId,p);}
00083   vtkCell *GetCell(vtkIdType cellId);
00084   void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00085   void GetCellBounds(vtkIdType cellId, double bounds[6]);
00086   int GetCellType(vtkIdType cellId);
00087   vtkIdType GetNumberOfCells();
00088   void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
00089   void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00090     {
00091       vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());
00092     }
00093   void Initialize();
00094   int GetMaxCellSize() {return 8;}; //hexahedron is the largest
00095   void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
00096                         vtkIdList *cellIds);
00097   virtual void GetScalarRange(double range[2]);
00098   double *GetScalarRange() {return this->Superclass::GetScalarRange();}
00100 
00102 
00103   void SetDimensions(int i, int j, int k);
00104   void SetDimensions(int dim[3]);
00106 
00108 
00109   virtual int *GetDimensions ();
00110   virtual void GetDimensions (int dim[3]);
00112 
00114   int GetDataDimension();
00115   
00117 
00120   void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00121   void SetUpdateExtent(int piece, int numPieces)
00122     {this->SetUpdateExtent(piece, numPieces, 0);}
00124 
00126 
00127   void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00128     { this->vtkPointSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00129   void SetUpdateExtent( int ext[6] )
00130     { this->vtkPointSet::SetUpdateExtent( ext ); };
00132 
00134 
00137   void SetExtent(int extent[6]);
00138   void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00139   vtkGetVector6Macro(Extent,int);
00141 
00147   unsigned long GetActualMemorySize();
00148 
00150 
00151   void ShallowCopy(vtkDataObject *src);  
00152   void DeepCopy(vtkDataObject *src);
00154 
00157   virtual void UpdateData();
00158 
00160   int GetExtentType() { return VTK_3D_EXTENT; }
00161 
00163 
00167   void BlankPoint(vtkIdType ptId);
00168   void UnBlankPoint(vtkIdType ptId);
00170 
00172 
00176   void BlankCell(vtkIdType ptId);
00177   void UnBlankCell(vtkIdType ptId);
00179   
00181   vtkUnsignedCharArray *GetPointVisibilityArray(); 
00182 
00186   void SetPointVisibilityArray(vtkUnsignedCharArray *pointVisibility);
00187 
00189   vtkUnsignedCharArray *GetCellVisibilityArray(); 
00190 
00194   void SetCellVisibilityArray(vtkUnsignedCharArray *pointVisibility);
00195 
00198   unsigned char IsPointVisible(vtkIdType ptId);
00199   
00202   unsigned char IsCellVisible(vtkIdType cellId);
00203 
00206   unsigned char GetPointBlanking();
00207 
00210   unsigned char GetCellBlanking();
00211 
00212 protected:
00213   vtkStructuredGrid();
00214   ~vtkStructuredGrid();
00215 
00216   // for the GetCell method
00217   vtkVertex *Vertex;
00218   vtkLine *Line;
00219   vtkQuad *Quad;  
00220   vtkHexahedron *Hexahedron;
00221   vtkEmptyCell *EmptyCell;
00222   
00226   virtual void Crop();
00227 
00228   int Dimensions[3];
00229   int DataDescription;
00230 
00231   vtkStructuredVisibilityConstraint* PointVisibility;
00232 
00233   void SetPointVisibility(vtkStructuredVisibilityConstraint *pointVisibility);
00234   vtkGetObjectMacro(PointVisibility, vtkStructuredVisibilityConstraint);
00235 
00236   vtkStructuredVisibilityConstraint* CellVisibility;
00237 
00238   void SetCellVisibility(vtkStructuredVisibilityConstraint *cellVisibility);
00239   vtkGetObjectMacro(CellVisibility, vtkStructuredVisibilityConstraint);
00240 
00241 private:
00243 
00244   void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00245     {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00247 
00248   // Internal method used by DeepCopy and ShallowCopy.
00249   void InternalStructuredGridCopy(vtkStructuredGrid *src);
00250 
00251 private:
00252   vtkStructuredGrid(const vtkStructuredGrid&);  // Not implemented.
00253   void operator=(const vtkStructuredGrid&);  // Not implemented.
00254 };
00255 
00256 
00257 inline vtkIdType vtkStructuredGrid::GetNumberOfCells() 
00258 {
00259   int nCells=1;
00260   int dims[3];
00261   int i;
00262 
00263   this->GetDimensions(dims);
00264   for (i=0; i<3; i++)
00265     {
00266     if (dims[i] <= 0)
00267       {
00268       return 0;
00269       }
00270     if (dims[i] > 1)
00271       {
00272       nCells *= (dims[i]-1);
00273       }
00274     }
00275 
00276   return nCells;
00277 }
00278 
00279 inline int vtkStructuredGrid::GetDataDimension()
00280 {
00281   return vtkStructuredData::GetDataDimension(this->DataDescription);
00282 }
00283 
00284 #endif
00285 
00286 
00287 
00288 
00289 
00290