VTK  9.5.2
vtkRectilinearGrid.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
30
31#ifndef vtkRectilinearGrid_h
32#define vtkRectilinearGrid_h
33
34#include "vtkCommonDataModelModule.h" // For export macro
35#include "vtkDataSet.h"
36#include "vtkSmartPointer.h" // For vtkSmartPointer
37#include "vtkStructuredData.h" // For inline methods
38
39VTK_ABI_NAMESPACE_BEGIN
40class vtkDataArray;
42class vtkPoints;
43
44class VTKCOMMONDATAMODEL_EXPORT vtkRectilinearGrid : public vtkDataSet
45{
46public:
49
51 void PrintSelf(ostream& os, vtkIndent indent) override;
52
56 int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_RECTILINEAR_GRID; }
57
62 void CopyStructure(vtkDataSet* ds) override;
63
67 void Initialize() override;
68
70
73 vtkIdType GetNumberOfCells() override;
75 vtkPoints* GetPoints() override;
76 double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override;
77 void GetPoint(vtkIdType id, double x[3]) override;
78 vtkCell* GetCell(vtkIdType cellId) override;
79 vtkCell* GetCell(int i, int j, int k) override;
80 void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
81 void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
82 vtkIdType FindPoint(double x[3]) override;
83 vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
84 double pcoords[3], double* weights) override;
85 vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
86 double tol2, int& subId, double pcoords[3], double* weights) override;
87 vtkCell* FindAndGetCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
88 double pcoords[3], double* weights) override;
89 int GetCellType(vtkIdType cellId) override;
91 void GetCellPoints(vtkIdType cellId, vtkIdType& npts, vtkIdType const*& pts, vtkIdList* ptIds)
92 VTK_SIZEHINT(pts, npts) override;
93 void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override;
94 void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override
95 {
96 vtkStructuredData::GetPointCells(ptId, cellIds, this->Dimensions);
97 }
98 void ComputeBounds() override;
99 int GetMaxCellSize() override { return 8; } // voxel is the largest
100 int GetMaxSpatialDimension() override;
101 int GetMinSpatialDimension() override;
102 void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds) override;
103 void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds, int* seedLoc);
105
112
120
122
128 virtual void BlankPoint(vtkIdType ptId);
129 virtual void UnBlankPoint(vtkIdType ptId);
130 virtual void BlankPoint(int i, int j, int k);
131 virtual void UnBlankPoint(int i, int j, int k);
133
135
141 virtual void BlankCell(vtkIdType ptId);
142 virtual void UnBlankCell(vtkIdType ptId);
143 virtual void BlankCell(int i, int j, int k);
144 virtual void UnBlankCell(int i, int j, int k);
146
152 unsigned char IsPointVisible(vtkIdType ptId);
153
159 unsigned char IsCellVisible(vtkIdType cellId);
160
165 bool HasAnyBlankPoints() override;
170 bool HasAnyBlankCells() override;
171
175 vtkGetMacro(DataDescription, int);
176
183 void GetCellDims(int cellDims[3]);
184
186
190 void SetDimensions(int i, int j, int k);
191 void SetDimensions(const int dim[3]);
193
195
198 vtkGetVectorMacro(Dimensions, int, 3);
200
204 int GetDataDimension();
205
212 int ComputeStructuredCoordinates(double x[3], int ijk[3], double pcoords[3]);
213
217 vtkIdType ComputePointId(int ijk[3]);
218
222 vtkIdType ComputeCellId(int ijk[3]);
223
229 void GetPoint(int i, int j, int k, double p[3]);
230
232
236 vtkGetObjectMacro(XCoordinates, vtkDataArray);
238
240
244 vtkGetObjectMacro(YCoordinates, vtkDataArray);
246
248
252 vtkGetObjectMacro(ZCoordinates, vtkDataArray);
254
256
261 void SetExtent(int extent[6]);
262 void SetExtent(int xMin, int xMax, int yMin, int yMax, int zMin, int zMax);
263 vtkGetVector6Macro(Extent, int);
265
274 unsigned long GetActualMemorySize() override;
275
277
280 void ShallowCopy(vtkDataObject* src) override;
281 void DeepCopy(vtkDataObject* src) override;
283
287 int GetExtentType() VTK_FUTURE_CONST override { return VTK_3D_EXTENT; }
288
294 void Crop(const int* updateExtent) override;
295
297
303
305
308 static void SetScalarType(int, vtkInformation* meta_data);
309 static int GetScalarType(vtkInformation* meta_data);
310 static bool HasScalarType(vtkInformation* meta_data);
312 const char* GetScalarTypeAsString() { return vtkImageScalarTypeNameMacro(this->GetScalarType()); }
314
316
320 static void SetNumberOfScalarComponents(int n, vtkInformation* meta_data);
325
326protected:
329
332
333 int Extent[6];
334
338
339 // Hang on to some space for returning points when GetPoint(id) is called.
340 double Point[3];
341
345
350
351private:
352 void Cleanup();
353
354 vtkRectilinearGrid(const vtkRectilinearGrid&) = delete;
355 void operator=(const vtkRectilinearGrid&) = delete;
356};
357
358//----------------------------------------------------------------------------
360{
361 this->GetPoint(id, this->Point);
362 return this->Point;
363}
364
365//----------------------------------------------------------------------------
370
371//----------------------------------------------------------------------------
376
377//----------------------------------------------------------------------------
382
383//----------------------------------------------------------------------------
388
389//----------------------------------------------------------------------------
394
395//----------------------------------------------------------------------------
400
401//----------------------------------------------------------------------------
406
407VTK_ABI_NAMESPACE_END
408#endif
abstract class to specify cell behavior
Definition vtkCell.h:51
virtual vtkIdType GetNumberOfPoints()=0
Determine the number of points composing the dataset.
virtual vtkIdType GetNumberOfCells()=0
Determine the number of cells composing the dataset.
virtual int GetMaxSpatialDimension()
Get the maximum/minimum spatial dimensionality of the data which is the maximum/minimum dimension of ...
virtual double * GetPoint(vtkIdType ptId)=0
Get point coordinates with ptId such that: 0 <= ptId < NumberOfPoints.
virtual int GetMinSpatialDimension()
Get the maximum/minimum spatial dimensionality of the data which is the maximum/minimum dimension of ...
provides thread-safe access to cells
list of point or cell ids
Definition vtkIdList.h:24
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition vtkPoints.h:30
static vtkRectilinearGrid * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
static bool HasScalarType(vtkInformation *meta_data)
Set/Get the scalar data type for the points.
virtual void UnBlankCell(vtkIdType ptId)
Methods for supporting blanking of cells.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Initialize() override
Restore object to initial state.
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights) override
Standard vtkDataSet API methods.
virtual void SetZCoordinates(vtkDataArray *)
Specify the grid coordinates in the z-direction.
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override
Standard vtkDataSet API methods.
vtkIdType GetNumberOfPoints() override
Standard vtkDataSet API methods.
int GetExtentType() VTK_FUTURE_CONST override
Structured extent.
bool HasAnyBlankCells() override
Returns 1 if there is any visibility constraint on the cells, 0 otherwise.
unsigned char IsCellVisible(vtkIdType cellId)
Return non-zero value if specified point is visible.
virtual void BlankCell(int i, int j, int k)
Methods for supporting blanking of cells.
virtual void BlankPoint(int i, int j, int k)
Methods for supporting blanking of cells.
virtual void BlankCell(vtkIdType ptId)
Methods for supporting blanking of cells.
bool HasAnyBlankPoints() override
Returns 1 if there is any visibility constraint on the points, 0 otherwise.
virtual void SetYCoordinates(vtkDataArray *)
Specify the grid coordinates in the y-direction.
virtual void SetXCoordinates(vtkDataArray *)
Specify the grid coordinates in the x-direction.
virtual void UnBlankCell(int i, int j, int k)
Methods for supporting blanking of cells.
vtkIdType ComputeCellId(int ijk[3])
Given a location in structured coordinates (i-j-k), return the cell id.
vtkConstantArray< int > * GetCellTypesArray()
Get the array of all cell types in the rectilinear grid.
void DeepCopy(vtkDataObject *src) override
Shallow and Deep copy.
static vtkRectilinearGrid * GetData(vtkInformationVector *v, int i=0)
Retrieve an instance of this class from an information object.
vtkDataArray * YCoordinates
int GetMinSpatialDimension() override
Standard vtkDataSet API methods.
virtual void UnBlankPoint(int i, int j, int k)
Methods for supporting blanking of cells.
vtkCell * GetCell(vtkIdType cellId) override
Standard vtkDataSet API methods.
vtkIdType GetNumberOfCells() override
Standard vtkDataSet API methods.
void SetExtent(int extent[6])
Different ways to set the extent of the data array.
int GetMaxSpatialDimension() override
Standard vtkDataSet API methods.
static void SetNumberOfScalarComponents(int n, vtkInformation *meta_data)
Set/Get the number of scalar components for points.
static int GetNumberOfScalarComponents(vtkInformation *meta_data)
Set/Get the number of scalar components for points.
vtkDataArray * XCoordinates
void GetCellPoints(vtkIdType cellId, vtkIdType &npts, vtkIdType const *&pts, vtkIdList *ptIds) override
Standard vtkDataSet API methods.
const char * GetScalarTypeAsString()
Set/Get the scalar data type for the points.
vtkSmartPointer< vtkStructuredCellArray > StructuredCells
void CopyStructure(vtkDataSet *ds) override
Copy the geometric and topological structure of an input rectilinear grid object.
static int GetScalarType(vtkInformation *meta_data)
Set/Get the scalar data type for the points.
void SetDimensions(int i, int j, int k)
Set dimensions of rectilinear grid dataset.
vtkSmartPointer< vtkPoints > StructuredPoints
void BuildImplicitStructures()
static void SetScalarType(int, vtkInformation *meta_data)
Set/Get the scalar data type for the points.
~vtkRectilinearGrid() override
virtual void BlankPoint(vtkIdType ptId)
Methods for supporting blanking of cells.
void GetCellDims(int cellDims[3])
Given the node dimensions of this grid instance, this method computes the node dimensions.
unsigned char IsPointVisible(vtkIdType ptId)
Return non-zero value if specified point is visible.
vtkIdType ComputePointId(int ijk[3])
Given a location in structured coordinates (i-j-k), return the point id.
virtual void UnBlankPoint(vtkIdType ptId)
Methods for supporting blanking of cells.
void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) override
Standard vtkDataSet API methods.
static bool HasNumberOfScalarComponents(vtkInformation *meta_data)
Set/Get the number of scalar components for points.
void GetPoint(int i, int j, int k, double p[3])
Given the IJK-coordinates of the point, it returns the corresponding xyz-coordinates.
vtkIdType GetCellSize(vtkIdType cellId) override
Standard vtkDataSet API methods.
vtkIdType FindPoint(double x[3]) override
Standard vtkDataSet API methods.
int GetNumberOfScalarComponents()
Set/Get the number of scalar components for points.
int GetCellType(vtkIdType cellId) override
Standard vtkDataSet API methods.
vtkSmartPointer< vtkConstantArray< int > > StructuredCellTypes
void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds, int *seedLoc)
Standard vtkDataSet API methods.
void GetPoint(vtkIdType id, double x[3]) override
Standard vtkDataSet API methods.
double * GetPoint(vtkIdType ptId) override
Standard vtkDataSet API methods.
vtkDataArray * ZCoordinates
void GetCellBounds(vtkIdType cellId, double bounds[6]) override
Standard vtkDataSet API methods.
vtkCell * GetCell(int i, int j, int k) override
Standard vtkDataSet API methods.
static vtkRectilinearGrid * New()
vtkStructuredCellArray * GetCells()
Return the rectilinear grid connectivity array.
int GetScalarType()
Set/Get the scalar data type for the points.
int GetDataDimension()
Return the dimensionality of the data.
void ComputeBounds() override
Standard vtkDataSet API methods.
void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds) override
Standard vtkDataSet API methods.
void Crop(const int *updateExtent) override
Reallocates and copies to set the Extent to the UpdateExtent.
int GetDataObjectType() VTK_FUTURE_CONST override
Return what type of dataset this is.
vtkPoints * GetPoints() override
Standard vtkDataSet API methods.
vtkIdType FindCell(double x[3], vtkCell *cell, vtkGenericCell *gencell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights) override
Standard vtkDataSet API methods.
vtkCell * FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights) override
Standard vtkDataSet API methods.
int ComputeStructuredCoordinates(double x[3], int ijk[3], double pcoords[3])
Convenience function computes the structured coordinates for a point x[3].
int GetMaxCellSize() override
Standard vtkDataSet API methods.
void ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
static vtkRectilinearGrid * ExtendedNew()
void SetExtent(int xMin, int xMax, int yMin, int yMax, int zMin, int zMax)
Different ways to set the extent of the data array.
void GetCell(vtkIdType cellId, vtkGenericCell *cell) override
Standard vtkDataSet API methods.
void SetDimensions(const int dim[3])
Set dimensions of rectilinear grid dataset.
Hold a reference to a vtkObjectBase instance.
implicit object to represent cell connectivity
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 int GetDataDimension(int dataDescription)
Return the topological dimension of the data (e.g., 0, 1, 2, or 3D).
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 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, VTK_FUTURE_CONST int dim[3])
Get the cells using a point.
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 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,...
#define vtkDataArray
vtkImplicitArray< vtkConstantImplicitBackend< T > > vtkConstantArray
A utility alias for wrapping constant functions in implicit arrays.
#define VTK_3D_EXTENT
int vtkIdType
Definition vtkType.h:332
@ VTK_RECTILINEAR_GRID
Definition vtkType.h:79
#define VTK_SIZEHINT(...)