00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00051 #ifndef __vtkRectilinearGrid_h
00052 #define __vtkRectilinearGrid_h
00053
00054 #include "vtkDataSet.h"
00055 #include "vtkStructuredData.h"
00056
00057 class vtkVertex;
00058 class vtkLine;
00059 class vtkPixel;
00060 class vtkVoxel;
00061 class vtkDataArray;
00062
00063 class VTK_FILTERING_EXPORT vtkRectilinearGrid : public vtkDataSet
00064 {
00065 public:
00066 static vtkRectilinearGrid *New();
00067
00068 vtkTypeRevisionMacro(vtkRectilinearGrid,vtkDataSet);
00069 void PrintSelf(ostream& os, vtkIndent indent);
00070
00072 int GetDataObjectType() {return VTK_RECTILINEAR_GRID;};
00073
00076 void CopyStructure(vtkDataSet *ds);
00077
00079 void Initialize();
00080
00082
00083 vtkIdType GetNumberOfCells();
00084 vtkIdType GetNumberOfPoints();
00085 double *GetPoint(vtkIdType ptId);
00086 void GetPoint(vtkIdType id, double x[3]);
00087 vtkCell *GetCell(vtkIdType cellId);
00088 void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00089 void GetCellBounds(vtkIdType cellId, double bounds[6]);
00090 int FindPoint(double x, double y, double z) { return this->vtkDataSet::FindPoint(x, y, z);};
00091 vtkIdType FindPoint(double x[3]);
00092 vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2,
00093 int& subId, double pcoords[3], double *weights);
00094 vtkIdType FindCell(double x[3], vtkCell *cell, vtkGenericCell *gencell,
00095 vtkIdType cellId, double tol2, int& subId,
00096 double pcoords[3], double *weights);
00097 vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId,
00098 double tol2, int& subId, double pcoords[3],
00099 double *weights);
00100 int GetCellType(vtkIdType cellId);
00101 void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
00102 {vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription,
00103 this->Dimensions);}
00104 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00105 {vtkStructuredData::GetPointCells(ptId,cellIds,this->Dimensions);}
00106 void ComputeBounds();
00107 int GetMaxCellSize() {return 8;};
00108 void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
00109 vtkIdList *cellIds);
00111
00113
00115 void SetDimensions(int i, int j, int k);
00116 void SetDimensions(int dim[3]);
00118
00120
00121 vtkGetVectorMacro(Dimensions,int,3);
00123
00125 int GetDataDimension();
00126
00132 int ComputeStructuredCoordinates(double x[3], int ijk[3], double pcoords[3]);
00133
00136 vtkIdType ComputePointId(int ijk[3]);
00137
00140 vtkIdType ComputeCellId(int ijk[3]);
00141
00143
00144 virtual void SetXCoordinates(vtkDataArray*);
00145 vtkGetObjectMacro(XCoordinates,vtkDataArray);
00147
00149
00150 virtual void SetYCoordinates(vtkDataArray*);
00151 vtkGetObjectMacro(YCoordinates,vtkDataArray);
00153
00155
00156 virtual void SetZCoordinates(vtkDataArray*);
00157 vtkGetObjectMacro(ZCoordinates,vtkDataArray);
00159
00161
00164 void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00165 void SetUpdateExtent(int piece, int numPieces)
00166 {this->SetUpdateExtent(piece, numPieces, 0);}
00168
00170
00171 void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00172 { this->vtkDataSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00173 void SetUpdateExtent( int ext[6] )
00174 { this->vtkDataSet::SetUpdateExtent( ext ); };
00176
00178
00181 void SetExtent(int extent[6]);
00182 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00183 int* GetExtent();
00184 void GetExtent(int& x1, int& x2, int& y1, int& y2, int& z1, int& z2);
00185 void GetExtent(int* extent);
00187
00193 unsigned long GetActualMemorySize();
00194
00196
00197 void ShallowCopy(vtkDataObject *src);
00198 void DeepCopy(vtkDataObject *src);
00200
00202 int GetExtentType() { return VTK_3D_EXTENT; };
00203
00204 protected:
00205 vtkRectilinearGrid();
00206 ~vtkRectilinearGrid();
00207
00208
00209 vtkVertex *Vertex;
00210 vtkLine *Line;
00211 vtkPixel *Pixel;
00212 vtkVoxel *Voxel;
00213
00217 virtual void Crop();
00218
00219 int Dimensions[3];
00220 int DataDescription;
00221
00222 vtkDataArray *XCoordinates;
00223 vtkDataArray *YCoordinates;
00224 vtkDataArray *ZCoordinates;
00225
00226
00227 double PointReturn[3];
00228
00229 private:
00231
00232 void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00233 {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00235 private:
00236 vtkRectilinearGrid(const vtkRectilinearGrid&);
00237 void operator=(const vtkRectilinearGrid&);
00238 };
00239
00240
00241
00242
00243 inline vtkIdType vtkRectilinearGrid::GetNumberOfCells()
00244 {
00245 vtkIdType nCells=1;
00246 int i;
00247
00248 for (i=0; i<3; i++)
00249 {
00250 if (this->Dimensions[i] <= 0)
00251 {
00252 return 0;
00253 }
00254 if (this->Dimensions[i] > 1)
00255 {
00256 nCells *= (this->Dimensions[i]-1);
00257 }
00258 }
00259
00260 return nCells;
00261 }
00262
00263 inline vtkIdType vtkRectilinearGrid::GetNumberOfPoints()
00264 {
00265 return this->Dimensions[0]*this->Dimensions[1]*this->Dimensions[2];
00266 }
00267
00268 inline int vtkRectilinearGrid::GetDataDimension()
00269 {
00270 return vtkStructuredData::GetDataDimension(this->DataDescription);
00271 }
00272
00273 inline vtkIdType vtkRectilinearGrid::ComputePointId(int ijk[3])
00274 {
00275 return vtkStructuredData::ComputePointId(this->Dimensions,ijk);
00276 }
00277
00278 inline vtkIdType vtkRectilinearGrid::ComputeCellId(int ijk[3])
00279 {
00280 return vtkStructuredData::ComputeCellId(this->Dimensions,ijk);
00281 }
00282
00283 #endif