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

dox/Common/vtkRectilinearGrid.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkRectilinearGrid.h,v $ 00005 Language: C++ 00006 00007 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 00015 =========================================================================*/ 00045 #ifndef __vtkRectilinearGrid_h 00046 #define __vtkRectilinearGrid_h 00047 00048 #include "vtkDataSet.h" 00049 #include "vtkStructuredData.h" // For inline methods 00050 00051 class vtkVertex; 00052 class vtkLine; 00053 class vtkPixel; 00054 class vtkVoxel; 00055 class vtkDataArray; 00056 00057 class VTK_COMMON_EXPORT vtkRectilinearGrid : public vtkDataSet 00058 { 00059 public: 00060 static vtkRectilinearGrid *New(); 00061 00062 vtkTypeRevisionMacro(vtkRectilinearGrid,vtkDataSet); 00063 void PrintSelf(ostream& os, vtkIndent indent); 00064 00066 int GetDataObjectType() {return VTK_RECTILINEAR_GRID;}; 00067 00070 void CopyStructure(vtkDataSet *ds); 00071 00073 void Initialize(); 00074 00076 00077 vtkIdType GetNumberOfCells(); 00078 vtkIdType GetNumberOfPoints(); 00079 float *GetPoint(vtkIdType ptId); 00080 void GetPoint(vtkIdType id, float x[3]); 00081 vtkCell *GetCell(vtkIdType cellId); 00082 void GetCell(vtkIdType cellId, vtkGenericCell *cell); 00083 void GetCellBounds(vtkIdType cellId, float bounds[6]); 00084 int FindPoint(float x, float y, float z) { return this->vtkDataSet::FindPoint(x, y, z);}; 00085 vtkIdType FindPoint(float x[3]); 00086 vtkIdType FindCell(float x[3], vtkCell *cell, vtkIdType cellId, float tol2, 00087 int& subId, float pcoords[3], float *weights); 00088 vtkIdType FindCell(float x[3], vtkCell *cell, vtkGenericCell *gencell, 00089 vtkIdType cellId, float tol2, int& subId, 00090 float pcoords[3], float *weights); 00091 vtkCell *FindAndGetCell(float x[3], vtkCell *cell, vtkIdType cellId, 00092 float tol2, int& subId, float pcoords[3], 00093 float *weights); 00094 int GetCellType(vtkIdType cellId); 00095 void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) 00096 {vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription, 00097 this->Dimensions);} 00098 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) 00099 {vtkStructuredData::GetPointCells(ptId,cellIds,this->Dimensions);} 00100 void ComputeBounds(); 00101 int GetMaxCellSize() {return 8;}; //voxel is the largest 00102 void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, 00103 vtkIdList *cellIds); 00105 00107 00109 void SetDimensions(int i, int j, int k); 00110 void SetDimensions(int dim[3]); 00112 00114 00115 vtkGetVectorMacro(Dimensions,int,3); 00117 00119 int GetDataDimension(); 00120 00126 int ComputeStructuredCoordinates(float x[3], int ijk[3], float pcoords[3]); 00127 00130 vtkIdType ComputePointId(int ijk[3]); 00131 00134 vtkIdType ComputeCellId(int ijk[3]); 00135 00137 00138 virtual void SetXCoordinates(vtkDataArray*); 00139 vtkGetObjectMacro(XCoordinates,vtkDataArray); 00141 00143 00144 virtual void SetYCoordinates(vtkDataArray*); 00145 vtkGetObjectMacro(YCoordinates,vtkDataArray); 00147 00149 00150 virtual void SetZCoordinates(vtkDataArray*); 00151 vtkGetObjectMacro(ZCoordinates,vtkDataArray); 00153 00155 00158 void SetUpdateExtent(int piece, int numPieces, int ghostLevel); 00159 void SetUpdateExtent(int piece, int numPieces) 00160 {this->SetUpdateExtent(piece, numPieces, 0);} 00162 00164 00165 void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 ) 00166 { this->vtkDataSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); }; 00167 void SetUpdateExtent( int ext[6] ) 00168 { this->vtkDataSet::SetUpdateExtent( ext ); }; 00170 00172 00175 void SetExtent(int extent[6]); 00176 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2); 00177 vtkGetVector6Macro(Extent,int); 00179 00185 unsigned long GetActualMemorySize(); 00186 00188 00189 void ShallowCopy(vtkDataObject *src); 00190 void DeepCopy(vtkDataObject *src); 00192 00198 virtual void UpdateData(); 00199 00200 protected: 00201 vtkRectilinearGrid(); 00202 ~vtkRectilinearGrid(); 00203 00204 // for the GetCell method 00205 vtkVertex *Vertex; 00206 vtkLine *Line; 00207 vtkPixel *Pixel; 00208 vtkVoxel *Voxel; 00209 00210 // The extent type is a 3D extent 00211 int GetExtentType() { return VTK_3D_EXTENT; }; 00212 00216 virtual void Crop(); 00217 00218 int Dimensions[3]; 00219 int DataDescription; 00220 00221 vtkDataArray *XCoordinates; 00222 vtkDataArray *YCoordinates; 00223 vtkDataArray *ZCoordinates; 00224 00225 // Hang on to some space for returning points when GetPoint(id) is called. 00226 float PointReturn[3]; 00227 00228 private: 00230 00231 void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds) 00232 {this->GetCellNeighbors(cellId, &ptIds, &cellIds);} 00234 private: 00235 vtkRectilinearGrid(const vtkRectilinearGrid&); // Not implemented. 00236 void operator=(const vtkRectilinearGrid&); // Not implemented. 00237 }; 00238 00239 00240 00241 00242 inline vtkIdType vtkRectilinearGrid::GetNumberOfCells() 00243 { 00244 vtkIdType nCells=1; 00245 int i; 00246 00247 for (i=0; i<3; i++) 00248 { 00249 if (this->Dimensions[i] <= 0) 00250 { 00251 return 0; 00252 } 00253 if (this->Dimensions[i] > 1) 00254 { 00255 nCells *= (this->Dimensions[i]-1); 00256 } 00257 } 00258 00259 return nCells; 00260 } 00261 00262 inline vtkIdType vtkRectilinearGrid::GetNumberOfPoints() 00263 { 00264 return this->Dimensions[0]*this->Dimensions[1]*this->Dimensions[2]; 00265 } 00266 00267 inline int vtkRectilinearGrid::GetDataDimension() 00268 { 00269 return vtkStructuredData::GetDataDimension(this->DataDescription); 00270 } 00271 00272 inline vtkIdType vtkRectilinearGrid::ComputePointId(int ijk[3]) 00273 { 00274 return vtkStructuredData::ComputePointId(this->Dimensions,ijk); 00275 } 00276 00277 inline vtkIdType vtkRectilinearGrid::ComputeCellId(int ijk[3]) 00278 { 00279 return vtkStructuredData::ComputeCellId(this->Dimensions,ijk); 00280 } 00281 00282 #endif