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

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

Generated on Mon Jan 21 23:07:21 2008 for VTK by  doxygen 1.4.3-20050530