VTK
vtkStructuredData.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkStructuredData.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
26 #ifndef __vtkStructuredData_h
27 #define __vtkStructuredData_h
28 
29 #include "vtkObject.h"
30 
31 class vtkIdList;
32 
33 #define VTK_UNCHANGED 0
34 #define VTK_SINGLE_POINT 1
35 #define VTK_X_LINE 2
36 #define VTK_Y_LINE 3
37 #define VTK_Z_LINE 4
38 #define VTK_XY_PLANE 5
39 #define VTK_YZ_PLANE 6
40 #define VTK_XZ_PLANE 7
41 #define VTK_XYZ_GRID 8
42 #define VTK_EMPTY 9
43 
45 {
46 public:
48 
50 
55  static int SetDimensions(int inDim[3], int dim[3]);
56  static int SetExtent(int inExt[6], int ext[6]);
58 
61  static int GetDataDescription(int dims[3]);
62 
64  static int GetDataDimension(int dataDescription);
65 
67 
68  static void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds,
69  int dataDescription, int dim[3]);
71 
73  static void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, int dim[3]);
74 
76 
78  static void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
79  vtkIdList *cellIds, int dim[3]);
81 
83 
85  static vtkIdType ComputePointIdForExtent(int extent[6], int ijk[3]) {
86  vtkIdType ydim = static_cast<vtkIdType>(extent[3] - extent[2] + 1);
87  vtkIdType xdim = static_cast<vtkIdType>(extent[1] - extent[0] + 1);
88  return ((ijk[2] - extent[4])*ydim + (ijk[1] - extent[2]))*xdim
89  + (ijk[0] - extent[0]); }
91 
93 
95  static vtkIdType ComputeCellIdForExtent(int extent[6], int ijk[3]) {
96  vtkIdType ydim = static_cast<vtkIdType>(extent[3] - extent[2]);
97  if (ydim == 0) ydim = 1;
98  vtkIdType xdim = static_cast<vtkIdType>(extent[1] - extent[0]);
99  if (xdim == 0) xdim = 1;
100  return ((ijk[2] - extent[4])*(ydim) + (ijk[1] - extent[2]))*(xdim)
101  + (ijk[0] - extent[0]); }
103 
105 
108  static vtkIdType ComputePointId(int dim[3], int ijk[3]) {
109  return (ijk[2]*static_cast<vtkIdType>(dim[1]) + ijk[1])*dim[0] + ijk[0];}
111 
113 
116  static vtkIdType ComputeCellId(int dim[3], int ijk[3]) {
117  return (ijk[2]*static_cast<vtkIdType>(dim[1]-1) + ijk[1])*(dim[0]-1) + ijk[0];}
119 
120 protected:
123 
124 private:
125  vtkStructuredData(const vtkStructuredData&); // Not implemented.
126  void operator=(const vtkStructuredData&); // Not implemented.
127 };
128 
129 
130 #endif
131 
static vtkIdType ComputeCellId(int dim[3], int ijk[3])
abstract class for topologically regular data
abstract base class for most VTK objects
Definition: vtkObject.h:60
static vtkIdType ComputeCellIdForExtent(int extent[6], int ijk[3])
int vtkIdType
Definition: vtkType.h:255
list of point or cell ids
Definition: vtkIdList.h:34
#define VTK_COMMON_EXPORT
static vtkIdType ComputePointIdForExtent(int extent[6], int ijk[3])
static vtkIdType ComputePointId(int dim[3], int ijk[3])