VTK  9.3.20240328
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
145 #ifndef vtkStructuredGrid_h
146 #define vtkStructuredGrid_h
147 
148 #include "vtkCommonDataModelModule.h" // For export macro
149 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_3_0
150 #include "vtkPointSet.h"
151 
152 #include "vtkStructuredData.h" // Needed for inline methods
153 
154 VTK_ABI_NAMESPACE_BEGIN
155 class vtkEmptyCell;
156 class vtkHexahedron;
157 class vtkLine;
158 class vtkQuad;
160 class vtkVertex;
161 
162 class VTKCOMMONDATAMODEL_EXPORT vtkStructuredGrid : public vtkPointSet
163 {
164 public:
167 
169  void PrintSelf(ostream& os, vtkIndent indent) override;
170 
174  int GetDataObjectType() override { return VTK_STRUCTURED_GRID; }
175 
179  void CopyStructure(vtkDataSet* ds) override;
180 
184  void Initialize() override;
185 
187 
190  vtkIdType GetNumberOfCells() override;
192  double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override
193  {
194  return this->vtkPointSet::GetPoint(ptId);
195  }
196  void GetPoint(vtkIdType ptId, double p[3]) override { this->vtkPointSet::GetPoint(ptId, p); }
197  vtkCell* GetCell(vtkIdType cellId) override;
198  vtkCell* GetCell(int i, int j, int k) override;
199  void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
200  void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
201  int GetCellType(vtkIdType cellId) override;
202  vtkIdType GetCellSize(vtkIdType cellId) override;
203  void GetCellPoints(vtkIdType cellId, vtkIdType& npts, vtkIdType const*& pts, vtkIdList* ptIds)
204  VTK_SIZEHINT(pts, npts) override;
205  void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override;
206  void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override
207  {
208  int dims[3];
209  this->GetDimensions(dims);
210  vtkStructuredData::GetPointCells(ptId, cellIds, dims);
211  }
212  int GetMaxCellSize() override { return 8; } // hexahedron is the largest
213  int GetMaxSpatialDimension() override;
214  void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds) override;
215  void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds, int* seedLoc);
217 
224 
232 
234 
240  void BlankPoint(vtkIdType ptId);
243 
245 
251  void BlankCell(vtkIdType ptId);
252  void UnBlankCell(vtkIdType ptId);
254 
260  unsigned char IsPointVisible(vtkIdType ptId);
261 
267  unsigned char IsCellVisible(vtkIdType cellId);
268 
273  bool HasAnyBlankPoints() override;
278  bool HasAnyBlankCells() override;
279 
283  vtkGetMacro(DataDescription, int);
284 
291  void GetCellDims(int cellDims[3]);
292 
294 
297  void SetDimensions(int i, int j, int k);
298 
302  void SetDimensions(const int dims[3]);
304 
306 
309  VTK_DEPRECATED_IN_9_3_0("Please use GetDimensions(int dims[3]) instead.")
310  virtual int* GetDimensions() VTK_SIZEHINT(3);
311 
315  virtual void GetDimensions(int dims[3]);
317 
321  int GetDataDimension();
322 
324 
329  void SetExtent(VTK_FUTURE_CONST int extent[6]);
330  void SetExtent(int xMin, int xMax, int yMin, int yMax, int zMin, int zMax);
331  vtkGetVector6Macro(Extent, int);
333 
342  unsigned long GetActualMemorySize() override;
343 
345 
348  void ShallowCopy(vtkDataObject* src) override;
349  void DeepCopy(vtkDataObject* src) override;
351 
355  int GetExtentType() override { return VTK_3D_EXTENT; }
356 
362  void Crop(const int* updateExtent) override;
363 
365 
371 
381  void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true);
382 
383 protected:
385  ~vtkStructuredGrid() override;
386 
387  int Dimensions[3];
388 
390 
391  int Extent[6];
392 
395 
400  void ComputeScalarRange() override;
401 
403  void BuildCells();
405 
406 private:
407  // Internal method used by DeepCopy and ShallowCopy.
408  void InternalStructuredGridCopy(vtkStructuredGrid* src);
409 
410  vtkStructuredGrid(const vtkStructuredGrid&) = delete;
411  void operator=(const vtkStructuredGrid&) = delete;
412 };
413 
414 //------------------------------------------------------------------------------
416 {
418 }
419 
420 //------------------------------------------------------------------------------
422 {
424 }
425 
427 {
429 }
430 
431 VTK_ABI_NAMESPACE_END
432 #endif
abstract class to specify cell behavior
Definition: vtkCell.h:130
general representation of visualization data
abstract class to specify dataset behavior
Definition: vtkDataSet.h:165
virtual int GetMaxSpatialDimension()
Get the maximum spatial dimensionality of the data which is the maximum dimension of all cells.
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:22
provides thread-safe access to cells
a cell that represents a linear 3D hexahedron
list of point or cell ids
Definition: vtkIdList.h:132
A read only array class that wraps an implicit function from integers to any value type supported by ...
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
cell represents a 1D line
Definition: vtkLine.h:132
concrete class for storing a set of points
Definition: vtkPointSet.h:97
vtkIdType GetNumberOfCells() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:160
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:319
void GetPoint(vtkIdType ptId, double x[3]) override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:148
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:87
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 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, VTK_FUTURE_CONST int dim[3])
Get the cells using a point.
topologically regular array of data
vtkSmartPointer< vtkStructuredCellArray > StructuredCells
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.
static vtkStructuredGrid * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
void GetPoint(vtkIdType ptId, double p[3]) override
Standard vtkDataSet API methods.
void BlankPoint(vtkIdType ptId)
Methods for supporting blanking of cells.
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.
vtkStructuredCellArray * GetCells()
Return the structured grid connectivity array.
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.
static vtkStructuredGrid * GetData(vtkInformationVector *v, int i=0)
Retrieve an instance of this class from an information object.
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override
Standard vtkDataSet API methods.
int GetMaxCellSize() override
Standard vtkDataSet API methods.
vtkConstantArray< int > * GetCellTypesArray()
Get the array of all cell types in the structured grid.
int GetDataDimension()
Return the dimensionality of the data.
static vtkStructuredGrid * New()
void BuildImplicitStructures()
~vtkStructuredGrid() override
void ComputeScalarRange() override
Compute the range of the scalars and cache it into ScalarRange only if the cache became invalid (Scal...
int GetMaxSpatialDimension() override
Standard vtkDataSet API methods.
static vtkStructuredGrid * ExtendedNew()
vtkIdType GetNumberOfPoints() override
Standard vtkDataSet API methods.
vtkIdType GetNumberOfCells() override
Standard vtkDataSet API methods.
vtkCell * GetCell(vtkIdType cellId) 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.
void Crop(const int *updateExtent) override
Reallocates and copies to set the Extent to the UpdateExtent.
void GetCellPoints(vtkIdType cellId, vtkIdType &npts, vtkIdType const *&pts, vtkIdList *ptIds) override
Standard vtkDataSet API methods.
unsigned char IsCellVisible(vtkIdType cellId)
Return non-zero value if specified point is visible.
double * GetPoint(vtkIdType ptId) override
Standard vtkDataSet API methods.
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.
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.
bool HasAnyBlankPoints() override
Returns 1 if there is any visibility constraint on the points, 0 otherwise.
vtkSmartPointer< vtkConstantArray< int > > StructuredCellTypes
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
Restore object to initial state.
vtkCell * GetCell(int i, int j, int k) override
Standard vtkDataSet API methods.
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:92
@ info
Definition: vtkX3D.h:376
@ extent
Definition: vtkX3D.h:345
#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(...)