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
00069 #ifndef __vtkRectilinearGrid_h
00070 #define __vtkRectilinearGrid_h
00071
00072 #include "vtkDataSet.h"
00073 #include "vtkStructuredData.h"
00074 class vtkVertex;
00075 class vtkLine;
00076 class vtkPixel;
00077 class vtkVoxel;
00078 class vtkDataArray;
00079
00080 class VTK_COMMON_EXPORT vtkRectilinearGrid : public vtkDataSet
00081 {
00082 public:
00083 static vtkRectilinearGrid *New();
00084
00085 vtkTypeMacro(vtkRectilinearGrid,vtkDataSet);
00086 void PrintSelf(ostream& os, vtkIndent indent);
00087
00089 vtkDataObject *MakeObject() {return vtkRectilinearGrid::New();};
00090
00092 int GetDataObjectType() {return VTK_RECTILINEAR_GRID;};
00093
00096 void CopyStructure(vtkDataSet *ds);
00097
00099 void Initialize();
00100
00102
00103 vtkIdType GetNumberOfCells();
00104 vtkIdType GetNumberOfPoints();
00105 float *GetPoint(vtkIdType ptId);
00106 void GetPoint(vtkIdType id, float x[3]);
00107 vtkCell *GetCell(vtkIdType cellId);
00108 void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00109 void GetCellBounds(vtkIdType cellId, float bounds[6]);
00110 int FindPoint(float x, float y, float z) { return this->vtkDataSet::FindPoint(x, y, z);};
00111 vtkIdType FindPoint(float x[3]);
00112 vtkIdType FindCell(float x[3], vtkCell *cell, vtkIdType cellId, float tol2,
00113 int& subId, float pcoords[3], float *weights);
00114 vtkIdType FindCell(float x[3], vtkCell *cell, vtkGenericCell *gencell,
00115 vtkIdType cellId, float tol2, int& subId,
00116 float pcoords[3], float *weights);
00117 vtkCell *FindAndGetCell(float x[3], vtkCell *cell, vtkIdType cellId,
00118 float tol2, int& subId, float pcoords[3],
00119 float *weights);
00120 int GetCellType(vtkIdType cellId);
00121 void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
00122 {vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription,
00123 this->Dimensions);}
00124 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00125 {vtkStructuredData::GetPointCells(ptId,cellIds,this->Dimensions);}
00126 void ComputeBounds();
00127 int GetMaxCellSize() {return 8;};
00128 void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
00129 vtkIdList *cellIds);
00131
00133
00135 void SetDimensions(int i, int j, int k);
00136 void SetDimensions(int dim[3]);
00138
00140
00141 vtkGetVectorMacro(Dimensions,int,3);
00143
00145 int GetDataDimension();
00146
00152 int ComputeStructuredCoordinates(float x[3], int ijk[3], float pcoords[3]);
00153
00156 vtkIdType ComputePointId(int ijk[3]);
00157
00160 vtkIdType ComputeCellId(int ijk[3]);
00161
00163
00164 vtkSetObjectMacro(XCoordinates,vtkDataArray);
00165 vtkGetObjectMacro(XCoordinates,vtkDataArray);
00167
00169
00170 vtkSetObjectMacro(YCoordinates,vtkDataArray);
00171 vtkGetObjectMacro(YCoordinates,vtkDataArray);
00173
00175
00176 vtkSetObjectMacro(ZCoordinates,vtkDataArray);
00177 vtkGetObjectMacro(ZCoordinates,vtkDataArray);
00179
00181
00184 void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00185 void SetUpdateExtent(int piece, int numPieces)
00186 {this->SetUpdateExtent(piece, numPieces, 0);}
00188
00190
00191 void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00192 { this->vtkDataSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00193 void SetUpdateExtent( int ext[6] )
00194 { this->vtkDataSet::SetUpdateExtent( ext ); };
00196
00198
00201 void SetExtent(int extent[6]);
00202 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00203 vtkGetVector6Macro(Extent,int);
00205
00211 unsigned long GetActualMemorySize();
00212
00214
00215 void ShallowCopy(vtkDataObject *src);
00216 void DeepCopy(vtkDataObject *src);
00218
00219 protected:
00220 vtkRectilinearGrid();
00221 ~vtkRectilinearGrid();
00222
00223
00224 vtkVertex *Vertex;
00225 vtkLine *Line;
00226 vtkPixel *Pixel;
00227 vtkVoxel *Voxel;
00228
00229
00230 int GetExtentType() { return VTK_3D_EXTENT; };
00231
00235 virtual void Crop();
00236
00237 int Dimensions[3];
00238 int DataDescription;
00239
00240 vtkDataArray *XCoordinates;
00241 vtkDataArray *YCoordinates;
00242 vtkDataArray *ZCoordinates;
00243
00244
00245 float PointReturn[3];
00246
00247 private:
00249
00250 void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00251 {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00253 private:
00254 vtkRectilinearGrid(const vtkRectilinearGrid&);
00255 void operator=(const vtkRectilinearGrid&);
00256 };
00257
00258
00259
00260
00261 inline vtkIdType vtkRectilinearGrid::GetNumberOfCells()
00262 {
00263 vtkIdType nCells=1;
00264 int i;
00265
00266 for (i=0; i<3; i++)
00267 {
00268 if (this->Dimensions[i] <= 0)
00269 {
00270 return 0;
00271 }
00272 if (this->Dimensions[i] > 1)
00273 {
00274 nCells *= (this->Dimensions[i]-1);
00275 }
00276 }
00277
00278 return nCells;
00279 }
00280
00281 inline vtkIdType vtkRectilinearGrid::GetNumberOfPoints()
00282 {
00283 return this->Dimensions[0]*this->Dimensions[1]*this->Dimensions[2];
00284 }
00285
00286 inline int vtkRectilinearGrid::GetDataDimension()
00287 {
00288 return vtkStructuredData::GetDataDimension(this->DataDescription);
00289 }
00290
00291 inline vtkIdType vtkRectilinearGrid::ComputePointId(int ijk[3])
00292 {
00293 return vtkStructuredData::ComputePointId(this->Dimensions,ijk);
00294 }
00295
00296 inline vtkIdType vtkRectilinearGrid::ComputeCellId(int ijk[3])
00297 {
00298 return vtkStructuredData::ComputeCellId(this->Dimensions,ijk);
00299 }
00300
00301 #endif