00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00059 #ifndef __vtkRectilinearGrid_h
00060 #define __vtkRectilinearGrid_h
00061
00062 #include "vtkDataSet.h"
00063 #include "vtkStructuredData.h"
00064
00065 class vtkVertex;
00066 class vtkLine;
00067 class vtkPixel;
00068 class vtkVoxel;
00069 class vtkDataArray;
00070
00071 class VTK_COMMON_EXPORT vtkRectilinearGrid : public vtkDataSet
00072 {
00073 public:
00074 static vtkRectilinearGrid *New();
00075
00076 vtkTypeRevisionMacro(vtkRectilinearGrid,vtkDataSet);
00077 void PrintSelf(ostream& os, vtkIndent indent);
00078
00080 int GetDataObjectType() {return VTK_RECTILINEAR_GRID;};
00081
00084 void CopyStructure(vtkDataSet *ds);
00085
00087 void Initialize();
00088
00090
00091 vtkIdType GetNumberOfCells();
00092 vtkIdType GetNumberOfPoints();
00093 float *GetPoint(vtkIdType ptId);
00094 void GetPoint(vtkIdType id, float x[3]);
00095 vtkCell *GetCell(vtkIdType cellId);
00096 void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00097 void GetCellBounds(vtkIdType cellId, float bounds[6]);
00098 int FindPoint(float x, float y, float z) { return this->vtkDataSet::FindPoint(x, y, z);};
00099 vtkIdType FindPoint(float x[3]);
00100 vtkIdType FindCell(float x[3], vtkCell *cell, vtkIdType cellId, float tol2,
00101 int& subId, float pcoords[3], float *weights);
00102 vtkIdType FindCell(float x[3], vtkCell *cell, vtkGenericCell *gencell,
00103 vtkIdType cellId, float tol2, int& subId,
00104 float pcoords[3], float *weights);
00105 vtkCell *FindAndGetCell(float x[3], vtkCell *cell, vtkIdType cellId,
00106 float tol2, int& subId, float pcoords[3],
00107 float *weights);
00108 int GetCellType(vtkIdType cellId);
00109 void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
00110 {vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription,
00111 this->Dimensions);}
00112 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00113 {vtkStructuredData::GetPointCells(ptId,cellIds,this->Dimensions);}
00114 void ComputeBounds();
00115 int GetMaxCellSize() {return 8;};
00116 void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
00117 vtkIdList *cellIds);
00119
00121
00123 void SetDimensions(int i, int j, int k);
00124 void SetDimensions(int dim[3]);
00126
00128
00129 vtkGetVectorMacro(Dimensions,int,3);
00131
00133 int GetDataDimension();
00134
00140 int ComputeStructuredCoordinates(float x[3], int ijk[3], float pcoords[3]);
00141
00144 vtkIdType ComputePointId(int ijk[3]);
00145
00148 vtkIdType ComputeCellId(int ijk[3]);
00149
00151
00152 virtual void SetXCoordinates(vtkDataArray*);
00153 vtkGetObjectMacro(XCoordinates,vtkDataArray);
00155
00157
00158 virtual void SetYCoordinates(vtkDataArray*);
00159 vtkGetObjectMacro(YCoordinates,vtkDataArray);
00161
00163
00164 virtual void SetZCoordinates(vtkDataArray*);
00165 vtkGetObjectMacro(ZCoordinates,vtkDataArray);
00167
00169
00172 void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00173 void SetUpdateExtent(int piece, int numPieces)
00174 {this->SetUpdateExtent(piece, numPieces, 0);}
00176
00178
00179 void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00180 { this->vtkDataSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00181 void SetUpdateExtent( int ext[6] )
00182 { this->vtkDataSet::SetUpdateExtent( ext ); };
00184
00186
00189 void SetExtent(int extent[6]);
00190 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00191 vtkGetVector6Macro(Extent,int);
00193
00199 unsigned long GetActualMemorySize();
00200
00202
00203 void ShallowCopy(vtkDataObject *src);
00204 void DeepCopy(vtkDataObject *src);
00206
00212 virtual void UpdateData();
00213
00214 protected:
00215 vtkRectilinearGrid();
00216 ~vtkRectilinearGrid();
00217
00218
00219 vtkVertex *Vertex;
00220 vtkLine *Line;
00221 vtkPixel *Pixel;
00222 vtkVoxel *Voxel;
00223
00224
00225 int GetExtentType() { return VTK_3D_EXTENT; };
00226
00230 virtual void Crop();
00231
00232 int Dimensions[3];
00233 int DataDescription;
00234
00235 vtkDataArray *XCoordinates;
00236 vtkDataArray *YCoordinates;
00237 vtkDataArray *ZCoordinates;
00238
00239
00240 float PointReturn[3];
00241
00242 private:
00244
00245 void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00246 {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00248 private:
00249 vtkRectilinearGrid(const vtkRectilinearGrid&);
00250 void operator=(const vtkRectilinearGrid&);
00251 };
00252
00253
00254
00255
00256 inline vtkIdType vtkRectilinearGrid::GetNumberOfCells()
00257 {
00258 vtkIdType nCells=1;
00259 int i;
00260
00261 for (i=0; i<3; i++)
00262 {
00263 if (this->Dimensions[i] <= 0)
00264 {
00265 return 0;
00266 }
00267 if (this->Dimensions[i] > 1)
00268 {
00269 nCells *= (this->Dimensions[i]-1);
00270 }
00271 }
00272
00273 return nCells;
00274 }
00275
00276 inline vtkIdType vtkRectilinearGrid::GetNumberOfPoints()
00277 {
00278 return this->Dimensions[0]*this->Dimensions[1]*this->Dimensions[2];
00279 }
00280
00281 inline int vtkRectilinearGrid::GetDataDimension()
00282 {
00283 return vtkStructuredData::GetDataDimension(this->DataDescription);
00284 }
00285
00286 inline vtkIdType vtkRectilinearGrid::ComputePointId(int ijk[3])
00287 {
00288 return vtkStructuredData::ComputePointId(this->Dimensions,ijk);
00289 }
00290
00291 inline vtkIdType vtkRectilinearGrid::ComputeCellId(int ijk[3])
00292 {
00293 return vtkStructuredData::ComputeCellId(this->Dimensions,ijk);
00294 }
00295
00296 #endif