00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00066 #ifndef __vtkRectilinearGrid_h
00067 #define __vtkRectilinearGrid_h
00068
00069 #include "vtkDataSet.h"
00070 #include "vtkStructuredData.h"
00071 class vtkVertex;
00072 class vtkLine;
00073 class vtkPixel;
00074 class vtkVoxel;
00075
00076 class VTK_EXPORT vtkRectilinearGrid : public vtkDataSet
00077 {
00078 public:
00079 static vtkRectilinearGrid *New();
00080
00081 vtkTypeMacro(vtkRectilinearGrid,vtkDataSet);
00082 void PrintSelf(ostream& os, vtkIndent indent);
00083
00085 vtkDataObject *MakeObject() {return vtkRectilinearGrid::New();};
00086
00088 int GetDataObjectType() {return VTK_RECTILINEAR_GRID;};
00089
00092 void CopyStructure(vtkDataSet *ds);
00093
00095 void Initialize();
00096
00098 int GetNumberOfCells();
00099 int GetNumberOfPoints();
00100 float *GetPoint(int ptId);
00101 void GetPoint(int id, float x[3]);
00102 vtkCell *GetCell(int cellId);
00103 void GetCell(int cellId, vtkGenericCell *cell);
00104 void GetCellBounds(int cellId, float bounds[6]);
00105 int FindPoint(float x, float y, float z) { return this->vtkDataSet::FindPoint(x, y, z);};
00106 int FindPoint(float x[3]);
00107 int FindCell(float x[3], vtkCell *cell, int cellId, float tol2, int& subId,
00108 float pcoords[3], float *weights);
00109 int FindCell(float x[3], vtkCell *cell, vtkGenericCell *gencell,
00110 int cellId, float tol2, int& subId,
00111 float pcoords[3], float *weights);
00112 vtkCell *FindAndGetCell(float x[3], vtkCell *cell, int cellId,
00113 float tol2, int& subId, float pcoords[3], float *weights);
00114 int GetCellType(int cellId);
00115 void GetCellPoints(int cellId, vtkIdList *ptIds)
00116 {vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription,
00117 this->Dimensions);}
00118 void GetPointCells(int ptId, vtkIdList *cellIds)
00119 {vtkStructuredData::GetPointCells(ptId,cellIds,this->Dimensions);}
00120 void ComputeBounds();
00121 int GetMaxCellSize() {return 8;};
00122 void GetCellNeighbors(int cellId, vtkIdList *ptIds, vtkIdList *cellIds);
00123
00126 void SetDimensions(int i, int j, int k);
00127 void SetDimensions(int dim[3]);
00128
00130 vtkGetVectorMacro(Dimensions,int,3);
00131
00133 int GetDataDimension();
00134
00140 int ComputeStructuredCoordinates(float x[3], int ijk[3], float pcoords[3]);
00141
00144 int ComputePointId(int ijk[3]);
00145
00148 int ComputeCellId(int ijk[3]);
00149
00151 vtkSetObjectMacro(XCoordinates,vtkScalars);
00152 vtkGetObjectMacro(XCoordinates,vtkScalars);
00153
00155 vtkSetObjectMacro(YCoordinates,vtkScalars);
00156 vtkGetObjectMacro(YCoordinates,vtkScalars);
00157
00159 vtkSetObjectMacro(ZCoordinates,vtkScalars);
00160 vtkGetObjectMacro(ZCoordinates,vtkScalars);
00161
00165 void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00166 void SetUpdateExtent(int piece, int numPieces)
00167 {this->SetUpdateExtent(piece, numPieces, 0);}
00168
00170 void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00171 { this->vtkDataSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00172 void SetUpdateExtent( int ext[6] )
00173 { this->vtkDataSet::SetUpdateExtent( ext ); };
00174
00178 void SetExtent(int extent[6]);
00179 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00180 vtkGetVector6Macro(Extent,int);
00181
00187 unsigned long GetActualMemorySize();
00188
00190 void ShallowCopy(vtkDataObject *src);
00191 void DeepCopy(vtkDataObject *src);
00192
00193 #ifndef VTK_REMOVE_LEGACY_CODE
00194
00195 void GetCellPoints(int cellId, vtkIdList &ptIds)
00196 {VTK_LEGACY_METHOD(GetCellPoints,"3.2"); this->GetCellPoints(cellId, &ptIds);}
00197 void GetPointCells(int ptId, vtkIdList &cellIds)
00198 {VTK_LEGACY_METHOD(GetPointCells,"3.2"); this->GetPointCells(ptId, &cellIds);}
00199 #endif
00200
00201 protected:
00202 vtkRectilinearGrid();
00203 ~vtkRectilinearGrid();
00204 vtkRectilinearGrid(const vtkRectilinearGrid&) {};
00205 void operator=(const vtkRectilinearGrid&) {};
00206
00207
00208 vtkVertex *Vertex;
00209 vtkLine *Line;
00210 vtkPixel *Pixel;
00211 vtkVoxel *Voxel;
00212
00213
00214 int GetExtentType() { return VTK_3D_EXTENT; };
00215
00216 int Dimensions[3];
00217 int DataDescription;
00218
00219 vtkScalars *XCoordinates;
00220 vtkScalars *YCoordinates;
00221 vtkScalars *ZCoordinates;
00222
00223
00224 float PointReturn[3];
00225
00226 private:
00228 void GetCellNeighbors(int cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00229 {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00230 };
00231
00232
00233
00234
00235 inline int vtkRectilinearGrid::GetNumberOfCells()
00236 {
00237 int nCells=1;
00238 int i;
00239
00240 for (i=0; i<3; i++)
00241 {
00242 if (this->Dimensions[i] > 1)
00243 {
00244 nCells *= (this->Dimensions[i]-1);
00245 }
00246 }
00247
00248 return nCells;
00249 }
00250
00251 inline int vtkRectilinearGrid::GetNumberOfPoints()
00252 {
00253 return this->Dimensions[0]*this->Dimensions[1]*this->Dimensions[2];
00254 }
00255
00256 inline int vtkRectilinearGrid::GetDataDimension()
00257 {
00258 return vtkStructuredData::GetDataDimension(this->DataDescription);
00259 }
00260
00261 inline int vtkRectilinearGrid::ComputePointId(int ijk[3])
00262 {
00263 return vtkStructuredData::ComputePointId(this->Dimensions,ijk);
00264 }
00265
00266 inline int vtkRectilinearGrid::ComputeCellId(int ijk[3])
00267 {
00268 return vtkStructuredData::ComputeCellId(this->Dimensions,ijk);
00269 }
00270
00271 #endif