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

vtkUniformGrid.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkUniformGrid.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 =========================================================================*/
00040 #ifndef __vtkUniformGrid_h
00041 #define __vtkUniformGrid_h
00042 
00043 #include "vtkDataSet.h"
00044 
00045 #include "vtkStructuredData.h" // Needed for inline methods
00046 
00047 class vtkDataArray;
00048 class vtkEmptyCell;
00049 class vtkImageData;
00050 class vtkLine;
00051 class vtkPixel;
00052 class vtkVertex;
00053 class vtkVoxel;
00054 class vtkStructuredVisibilityConstraint;
00055 class vtkUnsignedCharArray;
00056 
00057 class VTK_FILTERING_EXPORT vtkUniformGrid : public vtkDataSet
00058 {
00059 public:
00060   static vtkUniformGrid *New();
00061 
00062   vtkTypeRevisionMacro(vtkUniformGrid,vtkDataSet);
00063   void PrintSelf(ostream& os, vtkIndent indent);
00064 
00067   void CopyStructure(vtkDataSet *ds);
00068 
00070   int GetDataObjectType() {return VTK_UNIFORM_GRID;};
00071 
00073 
00074   vtkIdType GetNumberOfCells();
00075   vtkIdType GetNumberOfPoints();
00076   double *GetPoint(vtkIdType ptId);
00077   void GetPoint(vtkIdType id, double x[3]);
00078   vtkCell *GetCell(vtkIdType cellId);
00079   void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00080   void GetCellBounds(vtkIdType cellId, double bounds[6]);
00081   vtkIdType FindPoint(double x, double y, double z) { return this->vtkDataSet::FindPoint(x, y, z);};
00082   vtkIdType FindPoint(double x[3]);
00083   vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, 
00084                      int& subId, double pcoords[3], double *weights);
00085   vtkIdType FindCell(double x[3], vtkCell *cell, vtkGenericCell *gencell,
00086                      vtkIdType cellId, double tol2, int& subId, 
00087                      double pcoords[3], double *weights);
00088   vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId, 
00089                           double tol2, int& subId, double pcoords[3],
00090                           double *weights);
00091   int GetCellType(vtkIdType cellId);
00092   void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
00093     {vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription,
00094                                       this->GetDimensions());}
00095   void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00096     {vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());}
00097   void ComputeBounds();
00098   void Initialize();
00099   int GetMaxCellSize() {return 8;}; //voxel is the largest
00100   virtual void GetScalarRange(double range[2]);
00101   double *GetScalarRange() {return this->Superclass::GetScalarRange();}
00103 
00105 
00107   void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00108   void SetUpdateExtent(int piece, int numPieces)
00109     {this->SetUpdateExtent(piece, numPieces, 0);}
00111 
00113 
00117   void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00118     { this->Superclass::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00119   void SetUpdateExtent( int ext[6] )
00120     { this->Superclass::SetUpdateExtent( ext ); };
00122 
00124   void SetDimensions(int i, int j, int k);
00125 
00127   void SetDimensions(int dims[3]);
00128 
00130 
00132   int *GetDimensions();
00133   void GetDimensions(int dims[3]);
00135 
00141   int ComputeStructuredCoordinates(double x[3], int ijk[3], double pcoords[3]);
00142   
00144   int GetDataDimension();
00145 
00147 
00150   void SetExtent(int extent[6]);
00151   void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00152   int* GetExtent();
00153   void GetExtent(int& x1, int& x2, int& y1, int& y2, int& z1, int& z2);
00154   void GetExtent(int* extent);
00156 
00162   unsigned long GetActualMemorySize();
00163   
00165 
00167   vtkSetVector3Macro(Spacing,double);
00168   vtkGetVector3Macro(Spacing,double);
00170   
00172 
00174   vtkSetVector3Macro(Origin,double);
00175   vtkGetVector3Macro(Origin,double);
00177   
00179 
00180   void ShallowCopy(vtkDataObject *src);  
00181   void DeepCopy(vtkDataObject *src);
00183   
00185   int GetExtentType() { return VTK_3D_EXTENT; };
00186 
00188 
00192   void BlankPoint(vtkIdType ptId);
00193   void UnBlankPoint(vtkIdType ptId);
00195 
00197 
00200   void BlankCell(vtkIdType ptId);
00201   void UnBlankCell(vtkIdType ptId);
00203   
00205   vtkUnsignedCharArray *GetPointVisibilityArray(); 
00206 
00210   void SetPointVisibilityArray(vtkUnsignedCharArray *pointVisibility);
00211 
00213   vtkUnsignedCharArray *GetCellVisibilityArray(); 
00214 
00218   void SetCellVisibilityArray(vtkUnsignedCharArray *pointVisibility);
00219 
00222   unsigned char IsPointVisible(vtkIdType ptId);
00223   
00226   unsigned char IsCellVisible(vtkIdType cellId);
00227 
00230   unsigned char GetPointBlanking();
00231 
00234   unsigned char GetCellBlanking();
00235 
00236 protected:
00237   vtkUniformGrid();
00238   ~vtkUniformGrid();
00239 
00240   // for the GetCell method
00241   vtkVertex *Vertex;
00242   vtkLine *Line;
00243   vtkPixel *Pixel;
00244   vtkVoxel *Voxel;
00245   vtkEmptyCell *EmptyCell;
00246 
00247   // The extent of what is currently in the structured grid.
00248   // Dimensions is just an array to return a value.
00249   // Its contents are out of data until GetDimensions is called.
00250   int Dimensions[3];
00251   int DataDescription;
00252 
00253   double Origin[3];
00254   double Spacing[3];
00255 
00256   vtkStructuredVisibilityConstraint* PointVisibility;
00257 
00258   void SetPointVisibility(vtkStructuredVisibilityConstraint *pointVisibility);
00259   vtkGetObjectMacro(PointVisibility, vtkStructuredVisibilityConstraint);
00260 
00261   vtkStructuredVisibilityConstraint* CellVisibility;
00262 
00263   void SetCellVisibility(vtkStructuredVisibilityConstraint *cellVisibility);
00264   vtkGetObjectMacro(CellVisibility, vtkStructuredVisibilityConstraint);
00265 
00266 private:
00267   void InternalUniformGridCopy(vtkUniformGrid *src);
00268   void InternalUniformGridCopy(vtkImageData *src);
00269 private:
00270   vtkUniformGrid(const vtkUniformGrid&);  // Not implemented.
00271   void operator=(const vtkUniformGrid&);  // Not implemented.
00272 };
00273 
00274 
00275 inline void vtkUniformGrid::GetPoint(vtkIdType id, double x[3])
00276 {
00277   double *p=this->GetPoint(id);
00278   x[0] = p[0]; x[1] = p[1]; x[2] = p[2];
00279 }
00280 
00281 
00282 
00283 inline vtkIdType vtkUniformGrid::GetNumberOfPoints()
00284 {
00285   int *dims = this->GetDimensions();
00286   return dims[0]*dims[1]*dims[2];
00287 }
00288 
00289 inline int vtkUniformGrid::GetDataDimension()
00290 {
00291   return vtkStructuredData::GetDataDimension(this->DataDescription);
00292 }
00293 
00294 #endif
00295 
00296 
00297