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

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 =========================================================================*/
00057 #ifndef __vtkStructuredGrid_h
00058 #define __vtkStructuredGrid_h
00059 
00060 #include "vtkPointSet.h"
00061 
00062 #include "vtkStructuredData.h" // Needed for inline methods
00063 
00064 class vtkEmptyCell;
00065 class vtkHexahedron;
00066 class vtkLine;
00067 class vtkQuad;
00068 class vtkStructuredVisibilityConstraint;
00069 class vtkUnsignedCharArray;
00070 class vtkVertex;
00071 
00072 class VTK_FILTERING_EXPORT vtkStructuredGrid : public vtkPointSet 
00073 {
00074 public:
00075   static vtkStructuredGrid *New();
00076 
00077   vtkTypeRevisionMacro(vtkStructuredGrid,vtkPointSet);
00078   void PrintSelf(ostream& os, vtkIndent indent);
00079  
00081   int GetDataObjectType() {return VTK_STRUCTURED_GRID;}
00082 
00085   void CopyStructure(vtkDataSet *ds);
00086 
00088 
00089   vtkIdType GetNumberOfPoints() {return vtkPointSet::GetNumberOfPoints();}
00090   double *GetPoint(vtkIdType ptId) {return this->vtkPointSet::GetPoint(ptId);}
00091   void GetPoint(vtkIdType ptId, double p[3])
00092     {this->vtkPointSet::GetPoint(ptId,p);}
00093   vtkCell *GetCell(vtkIdType cellId);
00094   void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00095   void GetCellBounds(vtkIdType cellId, double bounds[6]);
00096   int GetCellType(vtkIdType cellId);
00097   vtkIdType GetNumberOfCells();
00098   void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
00099   void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00100     {
00101       vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());
00102     }
00103   void Initialize();
00104   int GetMaxCellSize() {return 8;}; //hexahedron is the largest
00105   void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
00106                         vtkIdList *cellIds);
00107   virtual void GetScalarRange(double range[2]);
00108   double *GetScalarRange() {return this->Superclass::GetScalarRange();}
00110 
00112 
00113   void SetDimensions(int i, int j, int k);
00114   void SetDimensions(int dim[3]);
00116 
00118 
00119   virtual int *GetDimensions ();
00120   virtual void GetDimensions (int dim[3]);
00122 
00124   int GetDataDimension();
00125   
00127 
00130   void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00131   void SetUpdateExtent(int piece, int numPieces)
00132     {this->SetUpdateExtent(piece, numPieces, 0);}
00134 
00136 
00137   void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00138     { this->vtkPointSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00139   void SetUpdateExtent( int ext[6] )
00140     { this->vtkPointSet::SetUpdateExtent( ext ); };
00142 
00144 
00147   void SetExtent(int extent[6]);
00148   void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00149   int* GetExtent();
00150   void GetExtent(int& x1, int& x2, int& y1, int& y2, int& z1, int& z2);
00151   void GetExtent(int* extent);
00153 
00159   unsigned long GetActualMemorySize();
00160 
00162 
00163   void ShallowCopy(vtkDataObject *src);  
00164   void DeepCopy(vtkDataObject *src);
00166 
00168   int GetExtentType() { return VTK_3D_EXTENT; }
00169 
00171 
00175   void BlankPoint(vtkIdType ptId);
00176   void UnBlankPoint(vtkIdType ptId);
00178 
00180 
00184   void BlankCell(vtkIdType ptId);
00185   void UnBlankCell(vtkIdType ptId);
00187   
00189   vtkUnsignedCharArray *GetPointVisibilityArray(); 
00190 
00194   void SetPointVisibilityArray(vtkUnsignedCharArray *pointVisibility);
00195 
00197   vtkUnsignedCharArray *GetCellVisibilityArray(); 
00198 
00202   void SetCellVisibilityArray(vtkUnsignedCharArray *pointVisibility);
00203 
00206   unsigned char IsPointVisible(vtkIdType ptId);
00207   
00210   unsigned char IsCellVisible(vtkIdType cellId);
00211 
00214   unsigned char GetPointBlanking();
00215 
00218   unsigned char GetCellBlanking();
00219 
00220 protected:
00221   vtkStructuredGrid();
00222   ~vtkStructuredGrid();
00223 
00224   // for the GetCell method
00225   vtkVertex *Vertex;
00226   vtkLine *Line;
00227   vtkQuad *Quad;  
00228   vtkHexahedron *Hexahedron;
00229   vtkEmptyCell *EmptyCell;
00230   
00234   virtual void Crop();
00235 
00236   int Dimensions[3];
00237   int DataDescription;
00238 
00239   vtkStructuredVisibilityConstraint* PointVisibility;
00240 
00241   void SetPointVisibility(vtkStructuredVisibilityConstraint *pointVisibility);
00242   vtkGetObjectMacro(PointVisibility, vtkStructuredVisibilityConstraint);
00243 
00244   vtkStructuredVisibilityConstraint* CellVisibility;
00245 
00246   void SetCellVisibility(vtkStructuredVisibilityConstraint *cellVisibility);
00247   vtkGetObjectMacro(CellVisibility, vtkStructuredVisibilityConstraint);
00248 
00249 private:
00251 
00252   void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00253     {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00255 
00256   // Internal method used by DeepCopy and ShallowCopy.
00257   void InternalStructuredGridCopy(vtkStructuredGrid *src);
00258 
00259 private:
00260   vtkStructuredGrid(const vtkStructuredGrid&);  // Not implemented.
00261   void operator=(const vtkStructuredGrid&);  // Not implemented.
00262 };
00263 
00264 
00265 inline vtkIdType vtkStructuredGrid::GetNumberOfCells() 
00266 {
00267   int nCells=1;
00268   int dims[3];
00269   int i;
00270 
00271   this->GetDimensions(dims);
00272   for (i=0; i<3; i++)
00273     {
00274     if (dims[i] <= 0)
00275       {
00276       return 0;
00277       }
00278     if (dims[i] > 1)
00279       {
00280       nCells *= (dims[i]-1);
00281       }
00282     }
00283 
00284   return nCells;
00285 }
00286 
00287 inline int vtkStructuredGrid::GetDataDimension()
00288 {
00289   return vtkStructuredData::GetDataDimension(this->DataDescription);
00290 }
00291 
00292 #endif
00293 
00294 
00295 
00296 
00297 
00298