00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00026 #ifndef __vtkStructuredData_h
00027 #define __vtkStructuredData_h
00028
00029 #include "vtkObject.h"
00030
00031 class vtkIdList;
00032
00033 #define VTK_UNCHANGED 0
00034 #define VTK_SINGLE_POINT 1
00035 #define VTK_X_LINE 2
00036 #define VTK_Y_LINE 3
00037 #define VTK_Z_LINE 4
00038 #define VTK_XY_PLANE 5
00039 #define VTK_YZ_PLANE 6
00040 #define VTK_XZ_PLANE 7
00041 #define VTK_XYZ_GRID 8
00042 #define VTK_EMPTY 9
00043
00044 class VTK_COMMON_EXPORT vtkStructuredData : public vtkObject
00045 {
00046 public:
00047 vtkTypeMacro(vtkStructuredData,vtkObject);
00048
00050
00055 static int SetDimensions(int inDim[3], int dim[3]);
00056 static int SetExtent(int inExt[6], int ext[6]);
00058
00061 static int GetDataDescription(int dims[3]);
00062
00064 static int GetDataDimension(int dataDescription);
00065
00067
00068 static void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds,
00069 int dataDescription, int dim[3]);
00071
00073 static void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, int dim[3]);
00074
00076
00078 static void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
00079 vtkIdList *cellIds, int dim[3]);
00081
00083
00085 static vtkIdType ComputePointIdForExtent(int extent[6], int ijk[3]) {
00086 vtkIdType ydim = static_cast<vtkIdType>(extent[3] - extent[2] + 1);
00087 vtkIdType xdim = static_cast<vtkIdType>(extent[1] - extent[0] + 1);
00088 return ((ijk[2] - extent[4])*ydim + (ijk[1] - extent[2]))*xdim
00089 + (ijk[0] - extent[0]); }
00091
00093
00095 static vtkIdType ComputeCellIdForExtent(int extent[6], int ijk[3]) {
00096 vtkIdType ydim = static_cast<vtkIdType>(extent[3] - extent[2]);
00097 if (ydim == 0) ydim = 1;
00098 vtkIdType xdim = static_cast<vtkIdType>(extent[1] - extent[0]);
00099 if (xdim == 0) xdim = 1;
00100 return ((ijk[2] - extent[4])*(ydim) + (ijk[1] - extent[2]))*(xdim)
00101 + (ijk[0] - extent[0]); }
00103
00105
00108 static vtkIdType ComputePointId(int dim[3], int ijk[3]) {
00109 return (ijk[2]*static_cast<vtkIdType>(dim[1]) + ijk[1])*dim[0] + ijk[0];}
00111
00113
00116 static vtkIdType ComputeCellId(int dim[3], int ijk[3]) {
00117 return (ijk[2]*static_cast<vtkIdType>(dim[1]-1) + ijk[1])*(dim[0]-1) + ijk[0];}
00119
00120 protected:
00121 vtkStructuredData() {};
00122 ~vtkStructuredData() {};
00123
00124 private:
00125 vtkStructuredData(const vtkStructuredData&);
00126 void operator=(const vtkStructuredData&);
00127 };
00128
00129
00130 #endif
00131