VTK
vtkRectilinearGrid.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkRectilinearGrid.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 =========================================================================*/
41 #ifndef vtkRectilinearGrid_h
42 #define vtkRectilinearGrid_h
43 
44 #include "vtkCommonDataModelModule.h" // For export macro
45 #include "vtkDataSet.h"
46 #include "vtkStructuredData.h" // For inline methods
47 
48 class vtkVertex;
49 class vtkLine;
50 class vtkPixel;
51 class vtkVoxel;
52 class vtkDataArray;
53 class vtkPoints;
54 
56 {
57 public:
59 
61  void PrintSelf(ostream& os, vtkIndent indent);
62 
65 
69 
71  void Initialize();
72 
74 
77  double *GetPoint(vtkIdType ptId);
78  void GetPoint(vtkIdType id, double x[3]);
80  void GetCell(vtkIdType cellId, vtkGenericCell *cell);
81  void GetCellBounds(vtkIdType cellId, double bounds[6]);
82  vtkIdType FindPoint(double x, double y, double z) { return this->vtkDataSet::FindPoint(x, y, z);};
83  vtkIdType FindPoint(double x[3]);
84  vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2,
85  int& subId, double pcoords[3], double *weights);
86  vtkIdType FindCell(double x[3], vtkCell *cell, vtkGenericCell *gencell,
87  vtkIdType cellId, double tol2, int& subId,
88  double pcoords[3], double *weights);
89  vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId,
90  double tol2, int& subId, double pcoords[3],
91  double *weights);
92  int GetCellType(vtkIdType cellId);
93  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
94  {vtkStructuredData::GetCellPoints(cellId,ptIds,this->DataDescription,
95  this->Dimensions);}
96  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
97  {vtkStructuredData::GetPointCells(ptId,cellIds,this->Dimensions);}
98  void ComputeBounds();
99  int GetMaxCellSize() {return 8;}; //voxel is the largest
100  void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
101  vtkIdList *cellIds);
103 
106  void GetPoints(vtkPoints* pnts);
107 
109 
111  void SetDimensions(int i, int j, int k);
112  void SetDimensions(int dim[3]);
114 
116 
117  vtkGetVectorMacro(Dimensions,int,3);
119 
121  int GetDataDimension();
122 
128  int ComputeStructuredCoordinates(double x[3], int ijk[3], double pcoords[3]);
129 
132  vtkIdType ComputePointId(int ijk[3]);
133 
136  vtkIdType ComputeCellId(int ijk[3]);
137 
141  void GetPoint(const int i,const int j,const int k,double p[3]);
142 
144 
148 
150 
154 
156 
160 
162 
165  void SetExtent(int extent[6]);
166  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
167  vtkGetVector6Macro(Extent, int);
169 
175  unsigned long GetActualMemorySize();
176 
178 
182 
184  int GetExtentType() { return VTK_3D_EXTENT; };
185 
189  virtual void Crop(const int* updateExtent);
190 
191  //BTX
193 
196  //ETX
198 
199 protected:
202 
203  // for the GetCell method
208 
209  int Dimensions[3];
211 
212  int Extent[6];
213 
217 
218  // Hang on to some space for returning points when GetPoint(id) is called.
219  double PointReturn[3];
220 
221 private:
222  void Cleanup();
223 
224 private:
225  vtkRectilinearGrid(const vtkRectilinearGrid&); // Not implemented.
226  void operator=(const vtkRectilinearGrid&); // Not implemented.
227 };
228 
229 //----------------------------------------------------------------------------
231 {
232  vtkIdType nCells=1;
233  int i;
234 
235  for (i=0; i<3; i++)
236  {
237  if (this->Dimensions[i] <= 0)
238  {
239  return 0;
240  }
241  if (this->Dimensions[i] > 1)
242  {
243  nCells *= (this->Dimensions[i]-1);
244  }
245  }
246 
247  return nCells;
248 }
249 
250 //----------------------------------------------------------------------------
252 {
253  return this->Dimensions[0]*this->Dimensions[1]*this->Dimensions[2];
254 }
255 
256 //----------------------------------------------------------------------------
258 {
260 }
261 
262 //----------------------------------------------------------------------------
264 {
266 }
267 
268 //----------------------------------------------------------------------------
270 {
272 }
273 
274 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkgl::z
GLdouble GLdouble z
Definition: vtkgl.h:11754
vtkGetVector6Macro
#define vtkGetVector6Macro(name, type)
Definition: vtkSetGet.h:380
vtkDataSet::GetNumberOfPoints
virtual vtkIdType GetNumberOfPoints()=0
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkRectilinearGrid::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkStructuredData::GetDataDimension
static int GetDataDimension(int dataDescription)
vtkgl::weights
const GLbyte * weights
Definition: vtkgl.h:12766
vtkRectilinearGrid::Voxel
vtkVoxel * Voxel
Definition: vtkRectilinearGrid.h:207
vtkRectilinearGrid::ComputeStructuredCoordinates
int ComputeStructuredCoordinates(double x[3], int ijk[3], double pcoords[3])
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkRectilinearGrid::Vertex
vtkVertex * Vertex
Definition: vtkRectilinearGrid.h:204
vtkCommonDataModelModule.h
vtkRectilinearGrid
a dataset that is topologically regular with variable spacing in the three coordinate directions
Definition: vtkRectilinearGrid.h:56
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkRectilinearGrid::GetCell
void GetCell(vtkIdType cellId, vtkGenericCell *cell)
vtkRectilinearGrid::ShallowCopy
void ShallowCopy(vtkDataObject *src)
vtkRectilinearGrid::GetPoint
void GetPoint(const int i, const int j, const int k, double p[3])
vtkRectilinearGrid::CopyStructure
void CopyStructure(vtkDataSet *ds)
vtkRectilinearGrid::GetData
static vtkRectilinearGrid * GetData(vtkInformationVector *v, int i=0)
vtkRectilinearGrid::GetNumberOfPoints
vtkIdType GetNumberOfPoints()
Definition: vtkRectilinearGrid.h:251
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkRectilinearGrid::GetCellPoints
void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
Definition: vtkRectilinearGrid.h:93
vtkRectilinearGrid::Pixel
vtkPixel * Pixel
Definition: vtkRectilinearGrid.h:206
vtkRectilinearGrid::FindCell
vtkIdType FindCell(double x[3], vtkCell *cell, vtkGenericCell *gencell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights)
vtkgl::v
const GLdouble * v
Definition: vtkgl.h:11595
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkRectilinearGrid::Initialize
void Initialize()
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkRectilinearGrid::YCoordinates
vtkDataArray * YCoordinates
Definition: vtkRectilinearGrid.h:215
vtkGetVectorMacro
#define vtkGetVectorMacro(name, type, count)
Definition: vtkSetGet.h:424
vtkRectilinearGrid::SetZCoordinates
virtual void SetZCoordinates(vtkDataArray *)
vtkVertex
a cell that represents a 3D point
Definition: vtkVertex.h:36
vtkRectilinearGrid::SetDimensions
void SetDimensions(int dim[3])
vtkRectilinearGrid::DeepCopy
void DeepCopy(vtkDataObject *src)
vtkLine
cell represents a 1D line
Definition: vtkLine.h:35
vtkRectilinearGrid::GetPoint
double * GetPoint(vtkIdType ptId)
vtkRectilinearGrid::GetCellType
int GetCellType(vtkIdType cellId)
VTK_3D_EXTENT
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:61
vtkStructuredData.h
vtkRectilinearGrid::New
static vtkRectilinearGrid * New()
vtkStructuredData::ComputePointId
static vtkIdType ComputePointId(int dim[3], int ijk[3], int dataDescription=VTK_EMPTY)
Definition: vtkStructuredData.h:275
vtkStructuredData::GetCellPoints
static void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds, int dataDescription, int dim[3])
vtkDataSet::FindPoint
vtkIdType FindPoint(double x, double y, double z)
Definition: vtkDataSet.h:154
vtkRectilinearGrid::SetDimensions
void SetDimensions(int i, int j, int k)
vtkRectilinearGrid::SetExtent
void SetExtent(int extent[6])
vtkgl::src
GLenum src
Definition: vtkgl.h:12525
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:62
vtkRectilinearGrid::GetDataDimension
int GetDataDimension()
Definition: vtkRectilinearGrid.h:257
vtkRectilinearGrid::SetXCoordinates
virtual void SetXCoordinates(vtkDataArray *)
vtkStructuredData::GetPointCells
static void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, int dim[3])
vtkRectilinearGrid::FindPoint
vtkIdType FindPoint(double x, double y, double z)
Definition: vtkRectilinearGrid.h:82
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkRectilinearGrid::Line
vtkLine * Line
Definition: vtkRectilinearGrid.h:205
vtkRectilinearGrid::GetCell
vtkCell * GetCell(vtkIdType cellId)
vtkRectilinearGrid::SetYCoordinates
virtual void SetYCoordinates(vtkDataArray *)
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkRectilinearGrid::GetPointCells
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
Definition: vtkRectilinearGrid.h:96
vtkRectilinearGrid::ComputePointId
vtkIdType ComputePointId(int ijk[3])
Definition: vtkRectilinearGrid.h:263
vtkRectilinearGrid::ComputeCellId
vtkIdType ComputeCellId(int ijk[3])
Definition: vtkRectilinearGrid.h:269
vtkRectilinearGrid::GetData
static vtkRectilinearGrid * GetData(vtkInformation *info)
vtkRectilinearGrid::Dimensions
int Dimensions[3]
Definition: vtkRectilinearGrid.h:209
vtkStructuredData::ComputeCellId
static vtkIdType ComputeCellId(int dim[3], int ijk[3], int dataDescription=VTK_EMPTY)
Definition: vtkStructuredData.h:282
vtkRectilinearGrid::Crop
virtual void Crop(const int *updateExtent)
vtkRectilinearGrid::ComputeBounds
void ComputeBounds()
vtkDataSet.h
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkRectilinearGrid::XCoordinates
vtkDataArray * XCoordinates
Definition: vtkRectilinearGrid.h:214
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkRectilinearGrid::GetPoint
void GetPoint(vtkIdType id, double x[3])
vtkRectilinearGrid::GetCellBounds
void GetCellBounds(vtkIdType cellId, double bounds[6])
vtkRectilinearGrid::SetExtent
void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2)
vtkRectilinearGrid::GetCellNeighbors
void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds)
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkPixel
a cell that represents an orthogonal quadrilateral
Definition: vtkPixel.h:40
vtkRectilinearGrid::FindPoint
vtkIdType FindPoint(double x[3])
vtkRectilinearGrid::GetExtentType
int GetExtentType()
Definition: vtkRectilinearGrid.h:184
vtkRectilinearGrid::~vtkRectilinearGrid
~vtkRectilinearGrid()
vtkRectilinearGrid::FindCell
vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights)
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:42
vtkgl::p
GLfloat GLfloat p
Definition: vtkgl.h:15717
VTKCOMMONDATAMODEL_EXPORT
#define VTKCOMMONDATAMODEL_EXPORT
Definition: vtkCommonDataModelModule.h:15
vtkX3D::extent
@ extent
Definition: vtkX3D.h:345
vtkRectilinearGrid::vtkRectilinearGrid
vtkRectilinearGrid()
vtkDataSet::GetNumberOfCells
virtual vtkIdType GetNumberOfCells()=0
vtkRectilinearGrid::GetActualMemorySize
unsigned long GetActualMemorySize()
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
vtkRectilinearGrid::GetMaxCellSize
int GetMaxCellSize()
Definition: vtkRectilinearGrid.h:99
vtkRectilinearGrid::FindAndGetCell
vtkCell * FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights)
vtkRectilinearGrid::ZCoordinates
vtkDataArray * ZCoordinates
Definition: vtkRectilinearGrid.h:216
VTK_RECTILINEAR_GRID
#define VTK_RECTILINEAR_GRID
Definition: vtkType.h:69
vtkRectilinearGrid::DataDescription
int DataDescription
Definition: vtkRectilinearGrid.h:210
vtkRectilinearGrid::GetPoints
void GetPoints(vtkPoints *pnts)
vtkRectilinearGrid::GetDataObjectType
int GetDataObjectType()
Definition: vtkRectilinearGrid.h:64
vtkRectilinearGrid::GetNumberOfCells
vtkIdType GetNumberOfCells()
Definition: vtkRectilinearGrid.h:230
vtkVoxel
a cell that represents a 3D orthogonal parallelepiped
Definition: vtkVoxel.h:44