• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Filtering/vtkRectilinearGrid.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkRectilinearGrid.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 =========================================================================*/
00038 #ifndef __vtkRectilinearGrid_h
00039 #define __vtkRectilinearGrid_h
00040 
00041 #include "vtkDataSet.h"
00042 #include "vtkStructuredData.h" // For inline methods
00043 
00044 class vtkVertex;
00045 class vtkLine;
00046 class vtkPixel;
00047 class vtkVoxel;
00048 class vtkDataArray;
00049 
00050 class VTK_FILTERING_EXPORT vtkRectilinearGrid : public vtkDataSet
00051 {
00052 public:
00053   static vtkRectilinearGrid *New();
00054 
00055   vtkTypeRevisionMacro(vtkRectilinearGrid,vtkDataSet);
00056   void PrintSelf(ostream& os, vtkIndent indent);
00057 
00059   int GetDataObjectType() {return VTK_RECTILINEAR_GRID;};
00060 
00063   void CopyStructure(vtkDataSet *ds);
00064 
00066   void Initialize();
00067 
00069 
00070   vtkIdType GetNumberOfCells();
00071   vtkIdType GetNumberOfPoints();
00072   double *GetPoint(vtkIdType ptId);
00073   void GetPoint(vtkIdType id, double x[3]);
00074   vtkCell *GetCell(vtkIdType cellId);
00075   void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00076   void GetCellBounds(vtkIdType cellId, double bounds[6]);
00077   vtkIdType FindPoint(double x, double y, double z) { return this->vtkDataSet::FindPoint(x, y, z);};
00078   vtkIdType FindPoint(double x[3]);
00079   vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2,
00080                      int& subId, double pcoords[3], double *weights);
00081   vtkIdType FindCell(double x[3], vtkCell *cell, vtkGenericCell *gencell,
00082                      vtkIdType cellId, double tol2, int& subId, 
00083                      double pcoords[3], double *weights);
00084   vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId, 
00085                           double tol2, int& subId, double pcoords[3],
00086                           double *weights);
00087   int GetCellType(vtkIdType cellId);
00088   void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
00089     {vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription,
00090                                       this->Dimensions);}
00091   void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00092     {vtkStructuredData::GetPointCells(ptId,cellIds,this->Dimensions);}
00093   void ComputeBounds();
00094   int GetMaxCellSize() {return 8;}; //voxel is the largest
00095   void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
00096                         vtkIdList *cellIds);
00098 
00100 
00102   void SetDimensions(int i, int j, int k);
00103   void SetDimensions(int dim[3]);
00105 
00107 
00108   vtkGetVectorMacro(Dimensions,int,3);
00110 
00112   int GetDataDimension();
00113 
00119   int ComputeStructuredCoordinates(double x[3], int ijk[3], double pcoords[3]);
00120 
00123   vtkIdType ComputePointId(int ijk[3]);
00124 
00127   vtkIdType ComputeCellId(int ijk[3]);
00128 
00130 
00131   virtual void SetXCoordinates(vtkDataArray*);
00132   vtkGetObjectMacro(XCoordinates,vtkDataArray);
00134 
00136 
00137   virtual void SetYCoordinates(vtkDataArray*);
00138   vtkGetObjectMacro(YCoordinates,vtkDataArray);
00140 
00142 
00143   virtual void SetZCoordinates(vtkDataArray*);
00144   vtkGetObjectMacro(ZCoordinates,vtkDataArray);
00146 
00148 
00151   void SetExtent(int extent[6]);
00152   void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00153   vtkGetVector6Macro(Extent, int);
00155 
00161   unsigned long GetActualMemorySize();
00162 
00164 
00165   void ShallowCopy(vtkDataObject *src);  
00166   void DeepCopy(vtkDataObject *src);
00168 
00170   int GetExtentType() { return VTK_3D_EXTENT; };
00171 
00175   virtual void Crop();
00176 
00177   //BTX
00179 
00180   static vtkRectilinearGrid* GetData(vtkInformation* info);
00181   static vtkRectilinearGrid* GetData(vtkInformationVector* v, int i=0);
00182   //ETX
00184 
00185 protected:
00186   vtkRectilinearGrid();
00187   ~vtkRectilinearGrid();
00188 
00189   // for the GetCell method
00190   vtkVertex *Vertex;
00191   vtkLine *Line;
00192   vtkPixel *Pixel;
00193   vtkVoxel *Voxel;
00194   
00195   int Dimensions[3];
00196   int DataDescription;
00197 
00198   int Extent[6];
00199 
00200   vtkDataArray *XCoordinates;
00201   vtkDataArray *YCoordinates;
00202   vtkDataArray *ZCoordinates;
00203 
00204   // Hang on to some space for returning points when GetPoint(id) is called.
00205   double PointReturn[3];
00206 
00207 private:
00209   VTK_LEGACY(void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds));
00210 private:
00211   vtkRectilinearGrid(const vtkRectilinearGrid&);  // Not implemented.
00212   void operator=(const vtkRectilinearGrid&);  // Not implemented.
00213 };
00214 
00215 //----------------------------------------------------------------------------
00216 inline vtkIdType vtkRectilinearGrid::GetNumberOfCells() 
00217 {
00218   vtkIdType nCells=1;
00219   int i;
00220 
00221   for (i=0; i<3; i++)
00222     {
00223     if (this->Dimensions[i] <= 0)
00224       {
00225       return 0;
00226       }
00227     if (this->Dimensions[i] > 1)
00228       {
00229       nCells *= (this->Dimensions[i]-1);
00230       }
00231     }
00232 
00233   return nCells;
00234 }
00235 
00236 //----------------------------------------------------------------------------
00237 inline vtkIdType vtkRectilinearGrid::GetNumberOfPoints()
00238 {
00239   return this->Dimensions[0]*this->Dimensions[1]*this->Dimensions[2];
00240 }
00241 
00242 //----------------------------------------------------------------------------
00243 inline int vtkRectilinearGrid::GetDataDimension()
00244 {
00245   return vtkStructuredData::GetDataDimension(this->DataDescription);
00246 }
00247 
00248 //----------------------------------------------------------------------------
00249 inline vtkIdType vtkRectilinearGrid::ComputePointId(int ijk[3])
00250 {
00251   return vtkStructuredData::ComputePointId(this->Dimensions,ijk);
00252 }
00253 
00254 //----------------------------------------------------------------------------
00255 inline vtkIdType vtkRectilinearGrid::ComputeCellId(int ijk[3])
00256 {
00257   return vtkStructuredData::ComputeCellId(this->Dimensions,ijk);
00258 }
00259 
00260 //----------------------------------------------------------------------------
00261 #ifndef VTK_LEGACY_REMOVE
00262 inline void vtkRectilinearGrid::GetCellNeighbors(vtkIdType cellId, 
00263   vtkIdList& ptIds, vtkIdList& cellIds)
00264 {
00265   this->GetCellNeighbors(cellId, &ptIds, &cellIds);
00266 }
00267 #endif
00268 
00269 #endif

Generated by  doxygen 1.7.1