VTK  9.7.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 "vtkPointSet.h"
41 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
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 VTK_MARSHALAUTO vtkStructuredGrid : public vtkPointSet
54 {
55 public:
56  static vtkStructuredGrid* New();
58 
60  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
65  int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_STRUCTURED_GRID; }
66 
70  void CopyStructure(vtkDataSet* ds) override;
71 
75  void Initialize() override;
76 
78 
81  vtkIdType GetNumberOfCells() override;
83  double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override
84  {
85  return this->vtkPointSet::GetPoint(ptId);
86  }
87  void GetPoint(vtkIdType ptId, double p[3]) override { this->vtkPointSet::GetPoint(ptId, p); }
88  vtkCell* GetCell(vtkIdType cellId) override;
89  vtkCell* GetCell(int i, int j, int k) override;
90  void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
91  void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
92  int GetCellType(vtkIdType cellId) override;
93  vtkIdType GetCellSize(vtkIdType cellId) override;
94  void GetCellPoints(vtkIdType cellId, vtkIdType& npts, vtkIdType const*& pts, vtkIdList* ptIds)
95  VTK_SIZEHINT(pts, npts) override;
96  void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override;
97  void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override
98  {
99  int dims[3];
100  this->GetDimensions(dims);
101  vtkStructuredData::GetPointCells(ptId, cellIds, dims);
102  }
103  int GetMaxCellSize() override { return 8; } // hexahedron is the largest
104  int GetMaxSpatialDimension() override;
105  int GetMinSpatialDimension() override;
106  void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds) override;
107  void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds, int* seedLoc);
109 
115  vtkStructuredCellArray* GetCells();
116 
118 
124  using vtkDataSet::GetCellTypes; // VTK_DEPRECATED_IN_9_6_0
126  VTK_DEPRECATED_IN_9_6_0("Use vtkConstantArray<unsigned char>* GetCellTypes() instead")
127  vtkConstantArray<int>* GetCellTypesArray();
129 
131 
137  void BlankPoint(vtkIdType ptId);
138  void UnBlankPoint(vtkIdType ptId);
140 
142 
148  void BlankCell(vtkIdType ptId);
149  void UnBlankCell(vtkIdType ptId);
151 
157  unsigned char IsPointVisible(vtkIdType ptId);
158 
164  unsigned char IsCellVisible(vtkIdType cellId);
165 
170  bool HasAnyBlankPoints() override;
175  bool HasAnyBlankCells() override;
176 
180  vtkGetMacro(DataDescription, int);
181 
188  void GetCellDims(int cellDims[3]);
189 
191 
194  void SetDimensions(int i, int j, int k);
195 
199  void SetDimensions(const int dims[3]);
201 
205  virtual void GetDimensions(int dims[3]);
206 
210  int GetDataDimension();
211 
213 
218  void SetExtent(VTK_FUTURE_CONST int extent[6]);
219  void SetExtent(int xMin, int xMax, int yMin, int yMax, int zMin, int zMax);
220  vtkGetVector6Macro(Extent, int);
222 
231  unsigned long GetActualMemorySize() override;
232 
234 
237  void ShallowCopy(vtkDataObject* src) override;
238  void DeepCopy(vtkDataObject* src) override;
240 
244  int GetExtentType() VTK_FUTURE_CONST override { return VTK_3D_EXTENT; }
245 
251  void Crop(const int updateExtent[6]) override;
252 
254 
258  static vtkStructuredGrid* GetData(vtkInformationVector* v, int i = 0);
260 
270  void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true);
271 
272 protected:
274  ~vtkStructuredGrid() override;
275 
276  int Dimensions[3];
277 
279 
280  int Extent[6];
281 
285 
290  void ComputeScalarRange() override;
291 
292  void BuildImplicitStructures();
293  void BuildCells();
294  void BuildCellTypes();
295 
296 private:
297  // Internal method used by DeepCopy and ShallowCopy.
298  void InternalStructuredGridCopy(vtkStructuredGrid* src);
299 
300  vtkStructuredGrid(const vtkStructuredGrid&) = delete;
301  void operator=(const vtkStructuredGrid&) = delete;
302 };
303 
304 //------------------------------------------------------------------------------
306 {
308 }
309 
310 //------------------------------------------------------------------------------
312 {
314 }
315 
316 //------------------------------------------------------------------------------
318 {
320 }
321 
322 //------------------------------------------------------------------------------
324 {
326 }
327 
328 VTK_ABI_NAMESPACE_END
329 #endif
vtkIdType GetCellSize(vtkIdType) override
This method always returns 1, as all cells are point in a pure vtkPointSet.
Definition: vtkPointSet.h:156
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:285
VTKIOHDF_EXPORT std::vector< hsize_t > GetDimensions(hid_t fileID, const char *datasetName)
Returns the dimensions of a HDF dataset of a file.
int GetMinSpatialDimension() override
Standard vtkDataSet API methods.
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:56
a cell that represents a 3D point
Definition: vtkVertex.h:22
A utility array for wrapping constant functions in implicit arrays.
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:52
static int GetDataDimension(int dataDescription)
Return the topological dimension of the data (e.g., 0, 1, 2, or 3D).
implicit object to represent cell connectivity
void GetCellPoints(vtkIdType, vtkIdList *idList) override
Topological inquiry to get points defining cell.
Definition: vtkPointSet.h:137
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:121
virtual int GetMaxSpatialDimension()
Get the maximum/minimum spatial dimensionality of the data which is the maximum/minimum dimension of ...
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:21
int vtkIdType
Definition: vtkType.h:363
int GetCellType(vtkIdType) override
This method always returns VTK_EMPTY_CELL, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:150
provides thread-safe access to cells
int GetDataDimension()
Return the dimensionality of the data.
int GetDataObjectType() VTK_FUTURE_CONST override
Return what type of dataset this is.
static vtkIdType GetNumberOfCells(const int ext[6], int dataDescription=vtkStructuredData::VTK_STRUCTURED_EMPTY)
Given the grid extent, this method returns the total number of cells within the extent.
cell represents a 1D line
Definition: vtkLine.h:22
abstract class to specify cell behavior
Definition: vtkCell.h:50
#define VTK_DEPRECATED_IN_9_6_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
vtkSmartPointer< vtkConstantArray< unsigned char > > StructuredCellTypes
static vtkPointSet * New()
Standard instantiation method.
list of point or cell ids
Definition: vtkIdList.h:25
void Initialize() override
Reset to an empty state and free any memory.
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 GetCellTypes(vtkCellTypes *types)
Get a list of types of cells in a dataset.
Definition: vtkDataSet.h:189
virtual int GetMinSpatialDimension()
Get the maximum/minimum spatial dimensionality of the data which is the maximum/minimum dimension of ...
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
vtkSmartPointer< vtkConstantArray< int > > LegacyStructuredCellTypes
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.
#define VTK_MARSHALAUTO
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override
Standard vtkDataSet API methods.
virtual void Crop(const int updateExtent[6])
This method crops the data object (if necessary) so that the extent matches the update extent...
vtkCell * GetCell(vtkIdType) override
This method always return a vtkEmptyCell, as there is no cell in a vtkPointSet.
vtkSmartPointer< vtkStructuredCellArray > StructuredCells
void CopyStructure(vtkDataSet *pd) override
Copy the geometric structure of an input point set object.
general representation of visualization data
Definition: vtkDataObject.h:55
virtual void GetCellBounds(vtkIdType cellId, double bounds[6])
Get the bounds of the cell with cellId such that: 0 <= cellId < NumberOfCells.
int GetMaxSpatialDimension() override
Standard vtkDataSet API methods.
double * GetPoint(vtkIdType ptId) override
Standard vtkDataSet API methods.
vtkIdType GetNumberOfPoints() override
Standard vtkDataSet API methods.