VTK  9.3.0
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
45#ifndef vtkStructuredGrid_h
46#define vtkStructuredGrid_h
47
48#include "vtkCommonDataModelModule.h" // For export macro
49#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_3_0
50#include "vtkPointSet.h"
51
52#include "vtkStructuredData.h" // Needed for inline methods
53
54VTK_ABI_NAMESPACE_BEGIN
55class vtkEmptyCell;
56class vtkHexahedron;
57class vtkLine;
58class vtkQuad;
60class vtkVertex;
61
62class VTKCOMMONDATAMODEL_EXPORT vtkStructuredGrid : public vtkPointSet
63{
64public:
67
69 void PrintSelf(ostream& os, vtkIndent indent) override;
70
74 int GetDataObjectType() override { return VTK_STRUCTURED_GRID; }
75
79 void CopyStructure(vtkDataSet* ds) override;
80
82
86 double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override
87 {
88 return this->vtkPointSet::GetPoint(ptId);
89 }
90 void GetPoint(vtkIdType ptId, double p[3]) override { this->vtkPointSet::GetPoint(ptId, p); }
91 vtkCell* GetCell(vtkIdType cellId) override;
92 vtkCell* GetCell(int i, int j, int k) override;
93 void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
94 void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
95 int GetCellType(vtkIdType cellId) override;
97 vtkIdType GetNumberOfCells() override;
99 void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override;
100 void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override
101 {
102 int dims[3];
103 this->GetDimensions(dims);
104 vtkStructuredData::GetPointCells(ptId, cellIds, dims);
105 }
106 void Initialize() override;
107 int GetMaxCellSize() override { return 8; } // hexahedron is the largest
108 void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds) override;
109 void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds, int* seedLoc);
111
113
116 void SetDimensions(int i, int j, int k);
117
121 void SetDimensions(const int dims[3]);
123
125
128 VTK_DEPRECATED_IN_9_3_0("Please use GetDimensions(int dims[3]) instead.")
129 virtual int* GetDimensions() VTK_SIZEHINT(3);
130
134 virtual void GetDimensions(int dims[3]);
136
140 int GetDataDimension();
141
143
148 void SetExtent(VTK_FUTURE_CONST int extent[6]);
149 void SetExtent(int xMin, int xMax, int yMin, int yMax, int zMin, int zMax);
150 vtkGetVector6Macro(Extent, int);
152
161 unsigned long GetActualMemorySize() override;
162
164
167 void ShallowCopy(vtkDataObject* src) override;
168 void DeepCopy(vtkDataObject* src) override;
170
174 int GetExtentType() override { return VTK_3D_EXTENT; }
175
177
186
188
197
203 unsigned char IsPointVisible(vtkIdType ptId);
204
210 unsigned char IsCellVisible(vtkIdType cellId);
211
216 bool HasAnyBlankPoints() override;
221 bool HasAnyBlankCells() override;
222
229 void GetCellDims(int cellDims[3]);
230
236 void Crop(const int* updateExtent) override;
237
239
245
255 void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true);
256
257protected:
260
261 // for the GetCell method
267
268#if !defined(VTK_LEGACY_REMOVE)
269 int Dimensions[3];
270#endif
272
273 int Extent[6];
274
279 void ComputeScalarRange() override;
280
281private:
282 // Internal method used by DeepCopy and ShallowCopy.
283 void InternalStructuredGridCopy(vtkStructuredGrid* src);
284
285 vtkStructuredGrid(const vtkStructuredGrid&) = delete;
286 void operator=(const vtkStructuredGrid&) = delete;
287};
288
290{
291 vtkIdType nCells = 1;
292 int dims[3];
293 int i;
294
295 this->GetDimensions(dims);
296 for (i = 0; i < 3; i++)
297 {
298 if (dims[i] <= 0)
299 {
300 return 0;
301 }
302 if (dims[i] > 1)
303 {
304 nCells *= (dims[i] - 1);
305 }
306 }
307
308 return nCells;
309}
310
312{
314}
315
316VTK_ABI_NAMESPACE_END
317#endif
abstract class to specify cell behavior
Definition vtkCell.h:59
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:62
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
Topological inquiry to get points defining cell.
an empty cell used as a place-holder during processing
provides thread-safe access to cells
a cell that represents a linear 3D hexahedron
list of point or cell ids
Definition vtkIdList.h:32
a simple class to control print indentation
Definition vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
cell represents a 1D line
Definition vtkLine.h:32
concrete class for storing a set of points
Definition vtkPointSet.h:68
vtkIdType GetNumberOfCells() override
This method always returns 0, as there are no cells in a vtkPointSet.
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
void GetPoint(vtkIdType ptId, double x[3]) override
See vtkDataSet for additional information.
a cell that represents a 2D quadrilateral
Definition vtkQuad.h:37
static int GetDataDimension(int dataDescription)
Return the topological dimension of the data (e.g., 0, 1, 2, or 3D).
static void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, VTK_FUTURE_CONST int dim[3])
Get the cells using a point.
topologically regular array of data
vtkHexahedron * Hexahedron
static vtkStructuredGrid * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
void SetDimensions(int i, int j, int k)
Sets the extent to be 0 to i-1, 0 to j-1, and 0 to k-1.
vtkIdType GetCellSize(vtkIdType cellId) override
Standard vtkDataSet API methods.
void GetCellDims(int cellDims[3])
Given the node dimensions of this grid instance, this method computes the node dimensions.
void BlankCell(vtkIdType ptId)
Methods for supporting blanking of cells.
void GetPoint(vtkIdType ptId, double p[3]) override
Standard vtkDataSet API methods.
void BlankPoint(vtkIdType ptId)
Methods for supporting blanking of cells.
vtkCell * GetCell(int i, int j, int k) override
Standard vtkDataSet API methods.
void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds) override
Standard vtkDataSet API methods.
void GetCellBounds(vtkIdType cellId, double bounds[6]) override
Standard vtkDataSet API methods.
void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) override
Standard vtkDataSet API methods.
int GetDataObjectType() override
Return what type of dataset this is.
void GetCell(vtkIdType cellId, vtkGenericCell *cell) override
Standard vtkDataSet API methods.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for type information and printing.
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override
Standard vtkDataSet API methods.
int GetMaxCellSize() override
Standard vtkDataSet API methods.
int GetDataDimension()
Return the dimensionality of the data.
~vtkStructuredGrid() override
void ComputeScalarRange() override
Compute the range of the scalars and cache it into ScalarRange only if the cache became invalid (Scal...
vtkIdType GetNumberOfPoints() override
Standard vtkDataSet API methods.
double * GetPoint(vtkIdType ptId) override
Standard vtkDataSet API methods.
vtkIdType GetNumberOfCells() override
Standard vtkDataSet API methods.
bool HasAnyBlankCells() override
Returns 1 if there is any visibility constraint on the cells, 0 otherwise.
void UnBlankPoint(vtkIdType ptId)
Methods for supporting blanking of cells.
vtkCell * GetCell(vtkIdType cellId) override
Standard vtkDataSet API methods.
void Crop(const int *updateExtent) override
Reallocates and copies to set the Extent to the UpdateExtent.
unsigned char IsCellVisible(vtkIdType cellId)
Return non-zero value if specified point is visible.
int GetCellType(vtkIdType cellId) override
Standard vtkDataSet API methods.
void CopyStructure(vtkDataSet *ds) override
Copy the geometric and topological structure of an input poly data object.
static vtkStructuredGrid * GetData(vtkInformationVector *v, int i=0)
Retrieve an instance of this class from an information object.
virtual int * GetDimensions()
Get dimensions of this structured grid.
unsigned char IsPointVisible(vtkIdType ptId)
Return non-zero value if specified point is visible.
void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent=true)
Get a point in the grid.
static vtkStructuredGrid * ExtendedNew()
bool HasAnyBlankPoints() override
Returns 1 if there is any visibility constraint on the points, 0 otherwise.
static vtkStructuredGrid * New()
void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds, int *seedLoc)
Standard vtkDataSet API methods.
void UnBlankCell(vtkIdType ptId)
Methods for supporting blanking of cells.
void Initialize() override
Standard vtkDataSet API methods.
vtkEmptyCell * EmptyCell
void SetDimensions(const int dims[3])
Sets the extent to be 0 to dim[i]-1 in all 3 dimensions.
dynamic, self-adjusting array of unsigned char
a cell that represents a 3D point
Definition vtkVertex.h:32
#define VTK_3D_EXTENT
#define VTK_DEPRECATED_IN_9_3_0(reason)
int vtkIdType
Definition vtkType.h:315
#define VTK_STRUCTURED_GRID
Definition vtkType.h:67
#define VTK_SIZEHINT(...)