VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkStructuredData.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00031 #ifndef __vtkStructuredData_h 00032 #define __vtkStructuredData_h 00033 00034 #include "vtkCommonDataModelModule.h" // For export macro 00035 #include "vtkObject.h" 00036 00037 class vtkIdList; 00038 00039 #define VTK_UNCHANGED 0 00040 #define VTK_SINGLE_POINT 1 00041 #define VTK_X_LINE 2 00042 #define VTK_Y_LINE 3 00043 #define VTK_Z_LINE 4 00044 #define VTK_XY_PLANE 5 00045 #define VTK_YZ_PLANE 6 00046 #define VTK_XZ_PLANE 7 00047 #define VTK_XYZ_GRID 8 00048 #define VTK_EMPTY 9 00049 00050 class VTKCOMMONDATAMODEL_EXPORT vtkStructuredData : public vtkObject 00051 { 00052 public: 00053 vtkTypeMacro(vtkStructuredData,vtkObject); 00054 00056 00061 static int SetDimensions(int inDim[3], int dim[3]); 00062 static int SetExtent(int inExt[6], int ext[6]); 00064 00066 00068 static int GetDataDescription(int dims[3]); 00069 static int GetDataDescriptionFromExtent( int ext[6] ); 00071 00073 00074 static int GetDataDimension(int dataDescription); 00075 static int GetDataDimension( int ext[6] ); 00077 00085 static int GetNumberOfNodes( int ext[6], int dataDescription=VTK_EMPTY ); 00086 00094 static int GetNumberOfCells( int ext[6], int dataDescription=VTK_EMPTY ); 00095 00097 00105 static void GetCellExtentFromNodeExtent( 00106 int nodeExtent[6], int cellExtent[6], int dataDescription=VTK_EMPTY ); 00108 00110 00111 static void GetDimensionsFromExtent( 00112 int ext[6], int dims[3], int dataDescription=VTK_EMPTY ); 00114 00116 00119 static void GetCellDimensionsFromExtent( 00120 int ext[6], int celldims[3], int dataDescription=VTK_EMPTY ); 00122 00124 00126 static void GetCellDimensionsFromNodeDimensions( 00127 int nodeDims[3],int cellDims[3] ); 00129 00131 00140 static void GetLocalStructuredCoordinates( 00141 int ijk[3], int ext[6], int lijk[3], int dataDescription=VTK_EMPTY ); 00143 00145 00153 static void GetGlobalStructuredCoordinates( 00154 int lijk[3], int ext[6], int ijk[3], int dataDescription=VTK_EMPTY ); 00156 00158 00159 static void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds, 00160 int dataDescription, int dim[3]); 00162 00164 static void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, int dim[3]); 00165 00167 00169 static void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, 00170 vtkIdList *cellIds, int dim[3]); 00172 00174 00182 static vtkIdType ComputePointIdForExtent( 00183 int extent[6], int ijk[3], int dataDescription=VTK_EMPTY ); 00185 00187 00189 static vtkIdType ComputeCellIdForExtent( 00190 int extent[6], int ijk[3], int dataDescription=VTK_EMPTY ); 00192 00194 00203 static vtkIdType ComputePointId( 00204 int dim[3], int ijk[3], int dataDescription=VTK_EMPTY ); 00206 00208 00217 static vtkIdType ComputeCellId( 00218 int dim[3], int ijk[3], int dataDescription=VTK_EMPTY ); 00220 00222 00231 static void ComputeCellStructuredCoordsForExtent( 00232 const vtkIdType cellIdx, int ext[6], int ijk[3], 00233 int dataDescription=VTK_EMPTY ); 00235 00237 00245 static void ComputeCellStructuredCoords( 00246 const vtkIdType cellId, int dim[3], int ijk[3], 00247 int dataDescription=VTK_EMPTY ); 00249 00251 00259 static void ComputePointStructuredCoordsForExtent( 00260 const vtkIdType ptId, int ext[6], int ijk[3], 00261 int dataDescription=VTK_EMPTY ); 00263 00265 00273 static void ComputePointStructuredCoords( 00274 const vtkIdType ptId, int dim[3], int ijk[3], 00275 int dataDescription=VTK_EMPTY ); 00277 00278 protected: 00279 vtkStructuredData() {} 00280 ~vtkStructuredData() {} 00281 00283 00288 static vtkIdType GetLinearIndex( 00289 const int i, const int j, const int k, const int N1, const int N2 ) 00290 { 00291 return( (static_cast<vtkIdType>(k)*N2+j)*N1+i ); 00292 } 00294 00296 00300 static void GetStructuredCoordinates( 00301 const vtkIdType idx, const int N1, const int N2,int &i, int &j, int &k ) 00302 { 00303 int N12 = N1*N2; 00304 k = idx/N12; 00305 j = (idx-k*N12)/N1; 00306 i = idx-k*N12-j*N1; 00307 } 00309 00310 private: 00311 vtkStructuredData(const vtkStructuredData&); // Not implemented. 00312 void operator=(const vtkStructuredData&); // Not implemented. 00313 }; 00314 00315 00316 #endif 00317 00318 // VTK-HeaderTest-Exclude: vtkStructuredData.h