VTK  9.3.1
vtkStructuredGrid.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
36 #ifndef vtkStructuredGrid_h
37 #define vtkStructuredGrid_h
38 
39 #include "vtkCommonDataModelModule.h" // For export macro
40 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_3_0
41 #include "vtkPointSet.h"
42 
43 #include "vtkStructuredData.h" // Needed for inline methods
44 
45 VTK_ABI_NAMESPACE_BEGIN
46 class vtkEmptyCell;
47 class vtkHexahedron;
48 class vtkLine;
49 class vtkQuad;
51 class vtkVertex;
52 
53 class VTKCOMMONDATAMODEL_EXPORT vtkStructuredGrid : public vtkPointSet
54 {
55 public:
56  static vtkStructuredGrid* New();
58 
60  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
65  int GetDataObjectType() override { return VTK_STRUCTURED_GRID; }
66 
70  void CopyStructure(vtkDataSet* ds) override;
71 
73 
77  double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override
78  {
79  return this->vtkPointSet::GetPoint(ptId);
80  }
81  void GetPoint(vtkIdType ptId, double p[3]) override { this->vtkPointSet::GetPoint(ptId, p); }
82  vtkCell* GetCell(vtkIdType cellId) override;
83  vtkCell* GetCell(int i, int j, int k) override;
84  void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
85  void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
86  int GetCellType(vtkIdType cellId) override;
87  vtkIdType GetCellSize(vtkIdType cellId) override;
88  vtkIdType GetNumberOfCells() override;
90  void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override;
91  void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override
92  {
93  int dims[3];
94  this->GetDimensions(dims);
95  vtkStructuredData::GetPointCells(ptId, cellIds, dims);
96  }
97  void Initialize() override;
98  int GetMaxCellSize() override { return 8; } // hexahedron is the largest
99  void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds) override;
100  void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds, int* seedLoc);
102 
104 
107  void SetDimensions(int i, int j, int k);
108 
112  void SetDimensions(const int dims[3]);
114 
116 
119  VTK_DEPRECATED_IN_9_3_0("Please use GetDimensions(int dims[3]) instead.")
120  virtual int* GetDimensions() VTK_SIZEHINT(3);
121 
125  virtual void GetDimensions(int dims[3]);
127 
131  int GetDataDimension();
132 
134 
139  void SetExtent(VTK_FUTURE_CONST int extent[6]);
140  void SetExtent(int xMin, int xMax, int yMin, int yMax, int zMin, int zMax);
141  vtkGetVector6Macro(Extent, int);
143 
152  unsigned long GetActualMemorySize() override;
153 
155 
158  void ShallowCopy(vtkDataObject* src) override;
159  void DeepCopy(vtkDataObject* src) override;
161 
165  int GetExtentType() override { return VTK_3D_EXTENT; }
166 
168 
174  void BlankPoint(vtkIdType ptId);
175  void UnBlankPoint(vtkIdType ptId);
177 
179 
185  void BlankCell(vtkIdType ptId);
186  void UnBlankCell(vtkIdType ptId);
188 
194  unsigned char IsPointVisible(vtkIdType ptId);
195 
201  unsigned char IsCellVisible(vtkIdType cellId);
202 
207  bool HasAnyBlankPoints() override;
212  bool HasAnyBlankCells() override;
213 
220  void GetCellDims(int cellDims[3]);
221 
227  void Crop(const int* updateExtent) override;
228 
230 
234  static vtkStructuredGrid* GetData(vtkInformationVector* v, int i = 0);
236 
246  void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true);
247 
248 protected:
250  ~vtkStructuredGrid() override;
251 
252  // for the GetCell method
258 
259 #if !defined(VTK_LEGACY_REMOVE)
260  int Dimensions[3];
261 #endif
263 
264  int Extent[6];
265 
270  void ComputeScalarRange() override;
271 
272 private:
273  // Internal method used by DeepCopy and ShallowCopy.
274  void InternalStructuredGridCopy(vtkStructuredGrid* src);
275 
276  vtkStructuredGrid(const vtkStructuredGrid&) = delete;
277  void operator=(const vtkStructuredGrid&) = delete;
278 };
279 
281 {
282  vtkIdType nCells = 1;
283  int dims[3];
284  int i;
285 
286  this->GetDimensions(dims);
287  for (i = 0; i < 3; i++)
288  {
289  if (dims[i] <= 0)
290  {
291  return 0;
292  }
293  if (dims[i] > 1)
294  {
295  nCells *= (dims[i] - 1);
296  }
297  }
298 
299  return nCells;
300 }
301 
303 {
305 }
306 
307 VTK_ABI_NAMESPACE_END
308 #endif
vtkIdType GetCellSize(vtkIdType) override
This method always returns 1, as all cells are point in a pure vtkPointSet.
Definition: vtkPointSet.h:158
int GetDataObjectType() override
Return what type of dataset this is.
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:283
vtkEmptyCell * EmptyCell
virtual void ComputeScalarRange()
Compute the range of the scalars and cache it into ScalarRange only if the cache became invalid (Scal...
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
a cell that represents a 3D point
Definition: vtkVertex.h:22
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:51
static int GetDataDimension(int dataDescription)
Return the topological dimension of the data (e.g., 0, 1, 2, or 3D).
void GetCellPoints(vtkIdType, vtkIdList *idList) override
Topological inquiry to get points defining cell.
Definition: vtkPointSet.h:139
static vtkPointSet * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:27
concrete class for storing a set of points
Definition: vtkPointSet.h:58
vtkIdType GetNumberOfCells() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:123
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:21
int vtkIdType
Definition: vtkType.h:315
virtual bool HasAnyBlankCells()
Returns 1 if there are any blanking cells 0 otherwise.
Definition: vtkDataSet.h:473
int GetCellType(vtkIdType) override
This method always returns VTK_EMPTY_CELL, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:152
provides thread-safe access to cells
virtual int * GetDimensions()
Get dimensions of this structured grid.
virtual void Crop(const int *updateExtent)
This method crops the data object (if necessary) so that the extent matches the update extent...
int GetDataDimension()
Return the dimensionality of the data.
cell represents a 1D line
Definition: vtkLine.h:22
abstract class to specify cell behavior
Definition: vtkCell.h:49
#define VTK_DEPRECATED_IN_9_3_0(reason)
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for type information and printing.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual bool HasAnyBlankPoints()
Returns 1 if there are any blanking points 0 otherwise.
Definition: vtkDataSet.h:479
static vtkPointSet * New()
Standard instantiation method.
list of point or cell ids
Definition: vtkIdList.h:22
void Initialize() override
Reset to an empty state and free any memory.
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
Topological inquiry to get points defining cell.
void GetPoint(vtkIdType ptId, double p[3]) override
Standard vtkDataSet API methods.
int GetMaxCellSize() override
Standard vtkDataSet API methods.
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:33
virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds)
Topological inquiry to get all cells using list of points exclusive of cell specified (e...
#define VTK_SIZEHINT(...)
dynamic, self-adjusting array of unsigned char
vtkIdType GetNumberOfCells() override
Standard vtkDataSet API methods.
void GetPoint(vtkIdType ptId, double x[3]) override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:110
static vtkPointSet * ExtendedNew()
topologically regular array of data
static void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, VTK_FUTURE_CONST int dim[3])
Get the cells using a point.
Store zero or more vtkInformation instances.
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override
Standard vtkDataSet API methods.
vtkCell * GetCell(vtkIdType) override
This method always return a vtkEmptyCell, as there is no cell in a vtkPointSet.
void CopyStructure(vtkDataSet *pd) override
Copy the geometric structure of an input point set object.
general representation of visualization data
Definition: vtkDataObject.h:54
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:67
vtkHexahedron * Hexahedron
virtual void GetCellBounds(vtkIdType cellId, double bounds[6])
Get the bounds of the cell with cellId such that: 0 <= cellId < NumberOfCells.
double * GetPoint(vtkIdType ptId) override
Standard vtkDataSet API methods.
vtkIdType GetNumberOfPoints() override
Standard vtkDataSet API methods.