29 #ifndef vtkStructuredData_h 30 #define vtkStructuredData_h 32 #include "vtkCommonDataModelModule.h" 37 #define VTK_UNCHANGED 0 38 #define VTK_SINGLE_POINT 1 42 #define VTK_XY_PLANE 5 43 #define VTK_YZ_PLANE 6 44 #define VTK_XZ_PLANE 7 45 #define VTK_XYZ_GRID 8 61 static int SetDimensions(
int inDim[3],
int dim[3]);
62 static int SetExtent(
int inExt[6],
int ext[6]);
70 static int GetDataDescription(
int dims[3]);
71 static int GetDataDescriptionFromExtent(
int ext[6]);
78 static int GetDataDimension(
int dataDescription);
79 static int GetDataDimension(
int ext[6]);
101 static void GetCellExtentFromPointExtent(
102 const int pntExtent[6],
int cellExtent[6],
int dataDescription =
VTK_EMPTY);
108 static void GetDimensionsFromExtent(
109 const int ext[6],
int dims[3],
int dataDescription =
VTK_EMPTY);
117 static void GetCellDimensionsFromExtent(
118 const int ext[6],
int celldims[3],
int dataDescription =
VTK_EMPTY);
125 static void GetCellDimensionsFromPointDimensions(
const int pntdims[3],
int cellDims[3]);
133 static void GetLocalStructuredCoordinates(
134 const int ijk[3],
const int ext[6],
int lijk[3],
int dataDescription =
VTK_EMPTY);
141 static void GetGlobalStructuredCoordinates(
142 const int lijk[3],
const int ext[6],
int ijk[3],
int dataDescription =
VTK_EMPTY);
147 static void GetCellPoints(
vtkIdType cellId,
vtkIdList* ptIds,
int dataDescription,
int dim[3]);
159 static void GetCellNeighbors(
167 static vtkIdType ComputePointIdForExtent(
168 const int extent[6],
const int ijk[3],
int dataDescription =
VTK_EMPTY);
176 const int extent[6],
const int ijk[3],
int dataDescription =
VTK_EMPTY);
185 const int dim[3],
const int ijk[3],
int dataDescription =
VTK_EMPTY);
194 const int dim[3],
const int ijk[3],
int dataDescription =
VTK_EMPTY);
202 static void ComputeCellStructuredCoordsForExtent(
203 const vtkIdType cellIdx,
const int ext[6],
int ijk[3],
int dataDescription =
VTK_EMPTY);
210 static void ComputeCellStructuredCoords(
211 const vtkIdType cellId,
const int dim[3],
int ijk[3],
int dataDescription =
VTK_EMPTY);
218 static void ComputePointStructuredCoordsForExtent(
226 static void ComputePointStructuredCoords(
242 return ((static_cast<vtkIdType>(k) * N2 + j) * N1 + i);
253 const vtkIdType idx,
const int N1,
const int N2,
int& i,
int& j,
int& k)
256 k =
static_cast<int>(idx / N12);
257 j =
static_cast<int>((idx - k * N12) / N1);
258 i =
static_cast<int>(idx - k * N12 - j * N1);
263 template <
typename T>
264 static T
Max(
const T& a,
const T& b)
266 return (a > b) ? a : b;
298 return static_cast<vtkIdType>(ext[1] - ext[0] + 1) * static_cast<vtkIdType>(ext[3] - ext[2] + 1) *
299 static_cast<vtkIdType>(ext[5] - ext[4] + 1);
315 return static_cast<vtkIdType>(cellDims[0]) * static_cast<vtkIdType>(cellDims[1]) *
321 const int nodeExtent[6],
int cellExtent[6],
int)
323 cellExtent[0] = nodeExtent[0];
324 cellExtent[2] = nodeExtent[2];
325 cellExtent[4] = nodeExtent[4];
335 dims[0] = ext[1] - ext[0] + 1;
336 dims[1] = ext[3] - ext[2] + 1;
337 dims[2] = ext[5] - ext[4] + 1;
342 const int nodeDims[3],
int cellDims[3])
351 const int ijk[3],
const int ext[6],
int lijk[3],
int)
353 lijk[0] = ijk[0] - ext[0];
354 lijk[1] = ijk[1] - ext[2];
355 lijk[2] = ijk[2] - ext[4];
360 const int lijk[3],
const int ext[6],
int ijk[3],
int)
362 ijk[0] = ext[0] + lijk[0];
363 ijk[1] = ext[2] + lijk[1];
364 ijk[2] = ext[4] + lijk[2];
369 const int extent[6],
const int ijk[3],
int)
382 const int extent[6],
const int ijk[3],
int)
395 const vtkIdType cellId,
const int dims[3],
int ijk[3],
int)
398 cellId, dims[0] - 1, dims[1] - 1, ijk[0], ijk[1], ijk[2]);
403 const vtkIdType cellIdx,
const int ext[6],
int ijk[3],
int)
416 const vtkIdType ptId,
const int dim[3],
int ijk[3],
int)
423 const vtkIdType ptId,
const int ext[6],
int ijk[3],
int)
static void ComputeCellStructuredCoordsForExtent(const vtkIdType cellIdx, const int ext[6], int ijk[3], int dataDescription=VTK_EMPTY)
Given the global grid extent and the linear index of a cell within the grid extent, this method computes the corresponding structured coordinates of the given cell.
static void GetCellDimensionsFromExtent(const int ext[6], int celldims[3], int dataDescription=VTK_EMPTY)
Returns the cell dimensions, i.e., the number of cells along the i,j,k for the grid with the given gr...
static void GetLocalStructuredCoordinates(const int ijk[3], const int ext[6], int lijk[3], int dataDescription=VTK_EMPTY)
Given the global structured coordinates for a point or cell, ijk, w.r.t.
Singleton class for topologically regular data.
abstract base class for most VTK objects
static vtkIdType GetNumberOfCells(const int ext[6], int dataDescription=VTK_EMPTY)
Given the grid extent, this method returns the total number of cells within the extent.
static void ComputeCellStructuredCoords(const vtkIdType cellId, const int dim[3], int ijk[3], int dataDescription=VTK_EMPTY)
Given a cellId and grid dimensions 'dim', get the structured coordinates (i-j-k). ...
static void GetDimensionsFromExtent(const int ext[6], int dims[3], int dataDescription=VTK_EMPTY)
Computes the structured grid dimensions based on the given extent.
static T Max(const T &a, const T &b)
static void ComputePointStructuredCoordsForExtent(const vtkIdType ptId, const int ext[6], int ijk[3], int dataDescription=VTK_EMPTY)
Given a pointId and the grid extent ext, get the structured coordinates (i-j-k).
static void GetGlobalStructuredCoordinates(const int lijk[3], const int ext[6], int ijk[3], int dataDescription=VTK_EMPTY)
Given local structured coordinates, and the corresponding global sub-grid extent, this method compute...
~vtkStructuredData() override
static void GetCellDimensionsFromPointDimensions(const int pntdims[3], int cellDims[3])
Given the dimensions of the grid, in pntdims, this method returns the corresponding cell dimensions f...
static vtkIdType ComputePointId(const int dim[3], const int ijk[3], int dataDescription=VTK_EMPTY)
Given a location in structured coordinates (i-j-k), and the dimensions of the structured dataset...
static vtkIdType GetLinearIndex(const int i, const int j, const int k, const int N1, const int N2)
Computes the linear index for the given i-j-k structured of a grid with of N1 and N2 dimensions along...
list of point or cell ids
static vtkIdType GetNumberOfPoints(const int ext[6], int dataDescription=VTK_EMPTY)
Given the grid extent, this method returns the total number of points within the extent.
static void ComputePointStructuredCoords(const vtkIdType ptId, const int dim[3], int ijk[3], int dataDescription=VTK_EMPTY)
Given a pointId and grid dimensions 'dim', get the structured coordinates (i-j-k).
static vtkIdType ComputeCellIdForExtent(const int extent[6], const int ijk[3], int dataDescription=VTK_EMPTY)
Given a location in structured coordinates (i-j-k), and the extent of the structured dataset...
static vtkIdType ComputeCellId(const int dim[3], const int ijk[3], int dataDescription=VTK_EMPTY)
Given a location in structured coordinates (i-j-k), and the dimensions of the structured dataset...
static vtkIdType ComputePointIdForExtent(const int extent[6], const int ijk[3], int dataDescription=VTK_EMPTY)
Given a location in structured coordinates (i-j-k), and the extent of the structured dataset...
static void GetStructuredCoordinates(const vtkIdType idx, const int N1, const int N2, int &i, int &j, int &k)
Returns the structured coordinates (i,j,k) for the given linear index of a grid with N1 and N2 dimens...
static void GetCellExtentFromPointExtent(const int pntExtent[6], int cellExtent[6], int dataDescription=VTK_EMPTY)
Given the point extent of a grid, this method computes the corresponding cell extent for the grid...