VTK  9.7.1
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
31 #ifndef vtkRectilinearGrid_h
32 #define vtkRectilinearGrid_h
33 
34 #include "vtkCartesianGrid.h"
35 #include "vtkCommonDataModelModule.h" // For export macro
36 #include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_6_0
37 #include "vtkSmartPointer.h" // For vtkSmartPointer
38 #include "vtkStructuredData.h" // For inline methods
39 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
40 
41 VTK_ABI_NAMESPACE_BEGIN
42 class vtkDataArray;
44 class vtkPoints;
45 
46 class VTKCOMMONDATAMODEL_EXPORT VTK_MARSHALAUTO vtkRectilinearGrid : public vtkCartesianGrid
47 {
48 public:
49  static vtkRectilinearGrid* New();
50  static vtkRectilinearGrid* ExtendedNew();
51 
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
58  int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_RECTILINEAR_GRID; }
59 
61 
64  void ShallowCopy(vtkDataObject* src) override;
65  void DeepCopy(vtkDataObject* src) override;
67 
72  void CopyStructure(vtkDataSet* ds) override;
73 
77  void Initialize() override;
78 
80  using Superclass::GetCell;
82 
85  void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
86  void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
87  vtkIdType FindPoint(double x[3]) override;
88  vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* genCell, vtkIdType cellId,
89  double tol2, int& subId, double pcoords[3], double* weights) override;
90  void ComputeBounds() override;
92 
99  int ComputeStructuredCoordinates(const double x[3], int ijk[3], double pcoords[3]) override;
100 
101  VTK_DEPRECATED_IN_9_6_0("Use the const version instead")
102  int ComputeStructuredCoordinates(double x[3], int ijk[3], double pcoords[3])
103  {
104  const double* pt = x;
105  return this->ComputeStructuredCoordinates(pt, ijk, pcoords);
106  };
107 
113  vtkIdType ComputePointId(int ijk[3]) override;
114 
120  vtkIdType ComputeCellId(int ijk[3]) override;
121 
122  using Superclass::GetPoint;
128  void GetPoint(int i, int j, int k, double p[3]);
129 
131 
134  virtual void SetXCoordinates(vtkDataArray*);
135  vtkGetObjectMacro(XCoordinates, vtkDataArray);
137 
139 
142  virtual void SetYCoordinates(vtkDataArray*);
143  vtkGetObjectMacro(YCoordinates, vtkDataArray);
145 
147 
150  virtual void SetZCoordinates(vtkDataArray*);
151  vtkGetObjectMacro(ZCoordinates, vtkDataArray);
153 
162  unsigned long GetActualMemorySize() override;
163 
169  void Crop(const int updateExtent[6]) override;
170 
172 
176  static vtkRectilinearGrid* GetData(vtkInformationVector* v, int i = 0);
178 
179 protected:
181  ~vtkRectilinearGrid() override;
182 
186 
187  void BuildPoints() override;
188 
189 private:
190  void Cleanup();
191 
192  vtkRectilinearGrid(const vtkRectilinearGrid&) = delete;
193  void operator=(const vtkRectilinearGrid&) = delete;
194 };
195 
196 //----------------------------------------------------------------------------
198 {
200 }
201 
202 //----------------------------------------------------------------------------
204 {
205  return vtkStructuredData::ComputeCellId(this->GetDimensions(), ijk);
206 }
207 
208 VTK_ABI_NAMESPACE_END
209 #endif
a dataset that is topologically regular with variable spacing in the three coordinate directions ...
static vtkDataObject * New()
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
implicit object to represent cell connectivity
void Initialize() override
Standard vtkDataSet API methods.
virtual void ComputeBounds()
Compute the data bounding box from data points.
static vtkCartesianGrid * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
vtkDataArray * XCoordinates
int GetDataObjectType() VTK_FUTURE_CONST override
Return what type of dataset this is.
int vtkIdType
Definition: vtkType.h:363
static vtkIdType ComputeCellId(const int dim[3], const int ijk[3], int dataDescription=vtkStructuredData::VTK_STRUCTURED_EMPTY)
Given a location in structured coordinates (i-j-k), and the dimensions of the structured dataset...
provides thread-safe access to cells
void CopyStructure(vtkDataSet *ds) override
Standard vtkObject API methods.
int * GetDimensions()
Get dimensions of this structured points dataset.
abstract class to specify cell behavior
Definition: vtkCell.h:50
#define VTK_DEPRECATED_IN_9_6_0(reason)
static vtkIdType ComputePointId(const int dim[3], const int ijk[3], int dataDescription=vtkStructuredData::VTK_STRUCTURED_EMPTY)
Given a location in structured coordinates (i-j-k), and the dimensions of the structured dataset...
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkDataArray * ZCoordinates
void GetPoint(vtkIdType id, double x[3]) override
Standard vtkDataSet API methods.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
virtual vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights)
Locate cell based on global coordinate x and tolerance squared.
vtkIdType ComputeCellId(int ijk[3]) override
Given a location in structured coordinates (i-j-k), return the cell id.
vtkCell * GetCell(vtkIdType cellId) override
Standard vtkDataSet API methods.
void DeepCopy(vtkDataObject *src) override
Standard vtkObject API methods.
vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights) override
Standard vtkDataSet API methods.
vtkDataArray * YCoordinates
void PrintSelf(ostream &os, vtkIndent indent) override
Standard vtkObject API methods.
Store zero or more vtkInformation instances.
virtual double * GetPoint(vtkIdType ptId)=0
Get point coordinates with ptId such that: 0 <= ptId < NumberOfPoints.
#define VTK_MARSHALAUTO
Abstract API for vtkImageData and vtkRectilinearGrid.
virtual void Crop(const int updateExtent[6])
This method crops the data object (if necessary) so that the extent matches the update extent...
vtkIdType ComputePointId(int ijk[3]) override
Given a location in structured coordinates (i-j-k), return the point id.
virtual vtkIdType ComputePointId(int ijk[3])=0
Given a location in structured coordinates (i-j-k), return the point id.
virtual vtkIdType ComputeCellId(int ijk[3])=0
Given a location in structured coordinates (i-j-k), return the cell id.
general representation of visualization data
Definition: vtkDataObject.h:55
virtual void BuildPoints()=0
Pure abstract method responsible to build and set internal points.
vtkIdType FindPoint(double x, double y, double z)
Locate the closest point to the global coordinate x.
Definition: vtkDataSet.h:248
virtual vtkCell * GetCell(vtkIdType cellId)=0
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
represent and manipulate 3D points
Definition: vtkPoints.h:30
virtual int ComputeStructuredCoordinates(const double x[3], int ijk[3], double pcoords[3])=0
Computes the structured coordinates for a point x[3].
virtual void GetCellBounds(vtkIdType cellId, double bounds[6])
Get the bounds of the cell with cellId such that: 0 <= cellId < NumberOfCells.
void ShallowCopy(vtkDataObject *src) override
Standard vtkObject API methods.