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 =========================================================================*/
48 #ifndef vtkStructuredGrid_h
49 #define vtkStructuredGrid_h
50 
51 #include "vtkCommonDataModelModule.h" // For export macro
52 #include "vtkPointSet.h"
53 
54 #include "vtkStructuredData.h" // Needed for inline methods
55 
56 class vtkEmptyCell;
57 class vtkHexahedron;
58 class vtkLine;
59 class vtkQuad;
61 class vtkVertex;
62 
63 class VTKCOMMONDATAMODEL_EXPORT vtkStructuredGrid : public vtkPointSet
64 {
65 public:
66  static vtkStructuredGrid* New();
68 
70  void PrintSelf(ostream& os, vtkIndent indent) override;
71 
75  int GetDataObjectType() override { return VTK_STRUCTURED_GRID; }
76 
80  void CopyStructure(vtkDataSet* ds) override;
81 
83 
87  double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override
88  {
89  return this->vtkPointSet::GetPoint(ptId);
90  }
91  void GetPoint(vtkIdType ptId, double p[3]) override { this->vtkPointSet::GetPoint(ptId, p); }
92  vtkCell* GetCell(vtkIdType cellId) override;
93  vtkCell* GetCell(int i, int j, int k) override;
94  void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
95  void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
96  int GetCellType(vtkIdType cellId) override;
97  vtkIdType GetCellSize(vtkIdType cellId) override;
98  vtkIdType GetNumberOfCells() override;
100  void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override;
101  void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override
102  {
103  vtkStructuredData::GetPointCells(ptId, cellIds, this->GetDimensions());
104  }
105  void Initialize() override;
106  int GetMaxCellSize() override { return 8; } // hexahedron is the largest
107  void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds) override;
108  void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds, int* seedLoc);
110 
112 
115  void SetDimensions(int i, int j, int k);
116  void SetDimensions(const int dim[3]);
118 
120 
123  virtual int* GetDimensions() VTK_SIZEHINT(3);
124  virtual void GetDimensions(int dim[3]);
126 
130  int GetDataDimension();
131 
133 
138  void SetExtent(int extent[6]);
139  void SetExtent(int xMin, int xMax, int yMin, int yMax, int zMin, int zMax);
140  vtkGetVector6Macro(Extent, int);
142 
151  unsigned long GetActualMemorySize() override;
152 
154 
157  void ShallowCopy(vtkDataObject* src) override;
158  void DeepCopy(vtkDataObject* src) override;
160 
164  int GetExtentType() override { return VTK_3D_EXTENT; }
165 
167 
173  void BlankPoint(vtkIdType ptId);
174  void UnBlankPoint(vtkIdType ptId);
176 
178 
184  void BlankCell(vtkIdType ptId);
185  void UnBlankCell(vtkIdType ptId);
187 
193  unsigned char IsPointVisible(vtkIdType ptId);
194 
200  unsigned char IsCellVisible(vtkIdType cellId);
201 
206  bool HasAnyBlankPoints() override;
211  bool HasAnyBlankCells() override;
212 
219  void GetCellDims(int cellDims[3]);
220 
226  void Crop(const int* updateExtent) override;
227 
229 
233  static vtkStructuredGrid* GetData(vtkInformationVector* v, int i = 0);
235 
245  void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true);
246 
247 protected:
249  ~vtkStructuredGrid() override;
250 
251  // for the GetCell method
257 
258  int Dimensions[3];
260 
261  int Extent[6];
262 
267  void ComputeScalarRange() override;
268 
269 private:
270  // Internal method used by DeepCopy and ShallowCopy.
271  void InternalStructuredGridCopy(vtkStructuredGrid* src);
272 
273 private:
274  vtkStructuredGrid(const vtkStructuredGrid&) = delete;
275  void operator=(const vtkStructuredGrid&) = delete;
276 };
277 
279 {
280  vtkIdType nCells = 1;
281  int dims[3];
282  int i;
283 
284  this->GetDimensions(dims);
285  for (i = 0; i < 3; i++)
286  {
287  if (dims[i] <= 0)
288  {
289  return 0;
290  }
291  if (dims[i] > 1)
292  {
293  nCells *= (dims[i] - 1);
294  }
295  }
296 
297  return nCells;
298 }
299 
301 {
303 }
304 
305 #endif
vtkIdType GetCellSize(vtkIdType) override
This method always returns 1, as all cells are point in a pure vtkPointSet.
Definition: vtkPointSet.h:164
int GetDataObjectType() override
Return what type of dataset this is.
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:289
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:62
a cell that represents a 3D point
Definition: vtkVertex.h:33
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:62
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:145
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:38
concrete class for storing a set of points
Definition: vtkPointSet.h:69
vtkIdType GetNumberOfCells() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:129
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:32
int vtkIdType
Definition: vtkType.h:332
virtual bool HasAnyBlankCells()
Returns 1 if there are any blanking cells 0 otherwise.
Definition: vtkDataSet.h:472
int GetCellType(vtkIdType) override
This method always returns VTK_EMPTY_CELL, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:158
provides thread-safe access to cells
virtual int * GetDimensions()
Get dimensions of this structured points dataset.
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:33
abstract class to specify cell behavior
Definition: vtkCell.h:60
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for type information and printing.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual bool HasAnyBlankPoints()
Returns 1 if there are any blanking points 0 otherwise.
Definition: vtkDataSet.h:478
static vtkPointSet * New()
Standard instantiation method.
list of point or cell ids
Definition: vtkIdList.h:33
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:44
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:116
static void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, int dim[3])
Get the cells using a point.
static vtkPointSet * ExtendedNew()
topologically regular array of data
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.
Definition: vtkPointSet.h:138
void CopyStructure(vtkDataSet *pd) override
Copy the geometric structure of an input point set object.
general representation of visualization data
Definition: vtkDataObject.h:65
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:79
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.