00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00041 #ifndef __vtkRectilinearGrid_h
00042 #define __vtkRectilinearGrid_h
00043
00044 #include "vtkDataSet.h"
00045 #include "vtkStructuredData.h"
00046
00047 class vtkVertex;
00048 class vtkLine;
00049 class vtkPixel;
00050 class vtkVoxel;
00051 class vtkDataArray;
00052
00053 class VTK_FILTERING_EXPORT vtkRectilinearGrid : public vtkDataSet
00054 {
00055 public:
00056 static vtkRectilinearGrid *New();
00057
00058 vtkTypeRevisionMacro(vtkRectilinearGrid,vtkDataSet);
00059 void PrintSelf(ostream& os, vtkIndent indent);
00060
00062 int GetDataObjectType() {return VTK_RECTILINEAR_GRID;};
00063
00066 void CopyStructure(vtkDataSet *ds);
00067
00069 void Initialize();
00070
00072
00073 vtkIdType GetNumberOfCells();
00074 vtkIdType GetNumberOfPoints();
00075 double *GetPoint(vtkIdType ptId);
00076 void GetPoint(vtkIdType id, double x[3]);
00077 vtkCell *GetCell(vtkIdType cellId);
00078 void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00079 void GetCellBounds(vtkIdType cellId, double bounds[6]);
00080 int FindPoint(double x, double y, double z) { return this->vtkDataSet::FindPoint(x, y, z);};
00081 vtkIdType FindPoint(double x[3]);
00082 vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2,
00083 int& subId, double pcoords[3], double *weights);
00084 vtkIdType FindCell(double x[3], vtkCell *cell, vtkGenericCell *gencell,
00085 vtkIdType cellId, double tol2, int& subId,
00086 double pcoords[3], double *weights);
00087 vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId,
00088 double tol2, int& subId, double pcoords[3],
00089 double *weights);
00090 int GetCellType(vtkIdType cellId);
00091 void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
00092 {vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription,
00093 this->Dimensions);}
00094 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00095 {vtkStructuredData::GetPointCells(ptId,cellIds,this->Dimensions);}
00096 void ComputeBounds();
00097 int GetMaxCellSize() {return 8;};
00098 void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
00099 vtkIdList *cellIds);
00101
00103
00105 void SetDimensions(int i, int j, int k);
00106 void SetDimensions(int dim[3]);
00108
00110
00111 vtkGetVectorMacro(Dimensions,int,3);
00113
00115 int GetDataDimension();
00116
00122 int ComputeStructuredCoordinates(double x[3], int ijk[3], double pcoords[3]);
00123
00126 vtkIdType ComputePointId(int ijk[3]);
00127
00130 vtkIdType ComputeCellId(int ijk[3]);
00131
00133
00134 virtual void SetXCoordinates(vtkDataArray*);
00135 vtkGetObjectMacro(XCoordinates,vtkDataArray);
00137
00139
00140 virtual void SetYCoordinates(vtkDataArray*);
00141 vtkGetObjectMacro(YCoordinates,vtkDataArray);
00143
00145
00146 virtual void SetZCoordinates(vtkDataArray*);
00147 vtkGetObjectMacro(ZCoordinates,vtkDataArray);
00149
00151
00154 void SetExtent(int extent[6]);
00155 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00156 vtkGetVector6Macro(Extent, int);
00158
00164 unsigned long GetActualMemorySize();
00165
00167
00168 void ShallowCopy(vtkDataObject *src);
00169 void DeepCopy(vtkDataObject *src);
00171
00173 int GetExtentType() { return VTK_3D_EXTENT; };
00174
00178 virtual void Crop();
00179
00180
00182
00183 static vtkRectilinearGrid* GetData(vtkInformation* info);
00184 static vtkRectilinearGrid* GetData(vtkInformationVector* v, int i=0);
00185
00187
00188 protected:
00189 vtkRectilinearGrid();
00190 ~vtkRectilinearGrid();
00191
00192
00193 vtkVertex *Vertex;
00194 vtkLine *Line;
00195 vtkPixel *Pixel;
00196 vtkVoxel *Voxel;
00197
00198 int Dimensions[3];
00199 int DataDescription;
00200
00201 int Extent[6];
00202
00203 vtkDataArray *XCoordinates;
00204 vtkDataArray *YCoordinates;
00205 vtkDataArray *ZCoordinates;
00206
00207
00208 double PointReturn[3];
00209
00210 private:
00212 VTK_LEGACY(void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds));
00213 private:
00214 vtkRectilinearGrid(const vtkRectilinearGrid&);
00215 void operator=(const vtkRectilinearGrid&);
00216 };
00217
00218
00219 inline vtkIdType vtkRectilinearGrid::GetNumberOfCells()
00220 {
00221 vtkIdType nCells=1;
00222 int i;
00223
00224 for (i=0; i<3; i++)
00225 {
00226 if (this->Dimensions[i] <= 0)
00227 {
00228 return 0;
00229 }
00230 if (this->Dimensions[i] > 1)
00231 {
00232 nCells *= (this->Dimensions[i]-1);
00233 }
00234 }
00235
00236 return nCells;
00237 }
00238
00239
00240 inline vtkIdType vtkRectilinearGrid::GetNumberOfPoints()
00241 {
00242 return this->Dimensions[0]*this->Dimensions[1]*this->Dimensions[2];
00243 }
00244
00245
00246 inline int vtkRectilinearGrid::GetDataDimension()
00247 {
00248 return vtkStructuredData::GetDataDimension(this->DataDescription);
00249 }
00250
00251
00252 inline vtkIdType vtkRectilinearGrid::ComputePointId(int ijk[3])
00253 {
00254 return vtkStructuredData::ComputePointId(this->Dimensions,ijk);
00255 }
00256
00257
00258 inline vtkIdType vtkRectilinearGrid::ComputeCellId(int ijk[3])
00259 {
00260 return vtkStructuredData::ComputeCellId(this->Dimensions,ijk);
00261 }
00262
00263
00264 #ifndef VTK_LEGACY_REMOVE
00265 inline void vtkRectilinearGrid::GetCellNeighbors(vtkIdType cellId,
00266 vtkIdList& ptIds, vtkIdList& cellIds)
00267 {
00268 this->GetCellNeighbors(cellId, &ptIds, &cellIds);
00269 }
00270 #endif
00271
00272 #endif