VTK  9.2.6
vtkStructuredGrid.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkStructuredGrid.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
41
42#ifndef vtkStructuredGrid_h
43#define vtkStructuredGrid_h
44
45#include "vtkCommonDataModelModule.h" // For export macro
46#include "vtkPointSet.h"
47
48#include "vtkStructuredData.h" // Needed for inline methods
49
50class vtkEmptyCell;
51class vtkHexahedron;
52class vtkLine;
53class vtkQuad;
55class vtkVertex;
56
57class VTKCOMMONDATAMODEL_EXPORT vtkStructuredGrid : public vtkPointSet
58{
59public:
62
64 void PrintSelf(ostream& os, vtkIndent indent) override;
65
69 int GetDataObjectType() override { return VTK_STRUCTURED_GRID; }
70
74 void CopyStructure(vtkDataSet* ds) override;
75
77
81 double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override
82 {
83 return this->vtkPointSet::GetPoint(ptId);
84 }
85 void GetPoint(vtkIdType ptId, double p[3]) override { this->vtkPointSet::GetPoint(ptId, p); }
86 vtkCell* GetCell(vtkIdType cellId) override;
87 vtkCell* GetCell(int i, int j, int k) override;
88 void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
89 void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
90 int GetCellType(vtkIdType cellId) override;
92 vtkIdType GetNumberOfCells() override;
94 void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override;
95 void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override
96 {
97 vtkStructuredData::GetPointCells(ptId, cellIds, this->GetDimensions());
98 }
99 void Initialize() override;
100 int GetMaxCellSize() override { return 8; } // hexahedron is the largest
101 void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds) override;
102 void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds, int* seedLoc);
104
106
109 void SetDimensions(int i, int j, int k);
110 void SetDimensions(const int dim[3]);
112
114
117 virtual int* GetDimensions() VTK_SIZEHINT(3);
118 virtual void GetDimensions(int dim[3]);
120
124 int GetDataDimension();
125
127
132 void SetExtent(int extent[6]);
133 void SetExtent(int xMin, int xMax, int yMin, int yMax, int zMin, int zMax);
134 vtkGetVector6Macro(Extent, int);
136
145 unsigned long GetActualMemorySize() override;
146
148
151 void ShallowCopy(vtkDataObject* src) override;
152 void DeepCopy(vtkDataObject* src) override;
154
158 int GetExtentType() override { return VTK_3D_EXTENT; }
159
161
170
172
181
187 unsigned char IsPointVisible(vtkIdType ptId);
188
194 unsigned char IsCellVisible(vtkIdType cellId);
195
200 bool HasAnyBlankPoints() override;
205 bool HasAnyBlankCells() override;
206
213 void GetCellDims(int cellDims[3]);
214
220 void Crop(const int* updateExtent) override;
221
223
229
239 void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true);
240
241protected:
244
245 // for the GetCell method
251
254
255 int Extent[6];
256
261 void ComputeScalarRange() override;
262
263private:
264 // Internal method used by DeepCopy and ShallowCopy.
265 void InternalStructuredGridCopy(vtkStructuredGrid* src);
266
267private:
268 vtkStructuredGrid(const vtkStructuredGrid&) = delete;
269 void operator=(const vtkStructuredGrid&) = delete;
270};
271
273{
274 vtkIdType nCells = 1;
275 int dims[3];
276 int i;
277
278 this->GetDimensions(dims);
279 for (i = 0; i < 3; i++)
280 {
281 if (dims[i] <= 0)
282 {
283 return 0;
284 }
285 if (dims[i] > 1)
286 {
287 nCells *= (dims[i] - 1);
288 }
289 }
290
291 return nCells;
292}
293
298
299#endif
abstract class to specify cell behavior
Definition vtkCell.h:58
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:31
a simple class to control print indentation
Definition vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
cell represents a 1D line
Definition vtkLine.h:31
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:36
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, int dim[3])
Get the cells using a point.
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)
following methods are specific to structured grid
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 SetDimensions(const int dim[3])
following methods are specific to structured grid
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 GetExtentType() override
The extent type is a 3D extent.
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...
void SetExtent(int extent[6])
Different ways to set the extent of the data array.
vtkIdType GetNumberOfPoints() override
Standard vtkDataSet API methods.
double * GetPoint(vtkIdType ptId) override
Standard vtkDataSet API methods.
void DeepCopy(vtkDataObject *src) override
Shallow and Deep copy.
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.
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
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 ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
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 points dataset.
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
dynamic, self-adjusting array of unsigned char
a cell that represents a 3D point
Definition vtkVertex.h:31
#define VTK_3D_EXTENT
int vtkIdType
Definition vtkType.h:332
#define VTK_STRUCTURED_GRID
Definition vtkType.h:79
#define VTK_SIZEHINT(...)