VTK  9.2.5
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 =========================================================================*/
157 #ifndef vtkStructuredGrid_h
158 #define vtkStructuredGrid_h
159 
160 #include "vtkCommonDataModelModule.h" // For export macro
161 #include "vtkPointSet.h"
162 
163 #include "vtkStructuredData.h" // Needed for inline methods
164 
165 class vtkEmptyCell;
166 class vtkHexahedron;
167 class vtkLine;
168 class vtkQuad;
170 class vtkVertex;
171 
172 class VTKCOMMONDATAMODEL_EXPORT vtkStructuredGrid : public vtkPointSet
173 {
174 public:
177 
179  void PrintSelf(ostream& os, vtkIndent indent) override;
180 
184  int GetDataObjectType() override { return VTK_STRUCTURED_GRID; }
185 
189  void CopyStructure(vtkDataSet* ds) override;
190 
192 
196  double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override
197  {
198  return this->vtkPointSet::GetPoint(ptId);
199  }
200  void GetPoint(vtkIdType ptId, double p[3]) override { this->vtkPointSet::GetPoint(ptId, p); }
201  vtkCell* GetCell(vtkIdType cellId) override;
202  vtkCell* GetCell(int i, int j, int k) override;
203  void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
204  void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
205  int GetCellType(vtkIdType cellId) override;
206  vtkIdType GetCellSize(vtkIdType cellId) override;
207  vtkIdType GetNumberOfCells() override;
209  void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override;
210  void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override
211  {
212  vtkStructuredData::GetPointCells(ptId, cellIds, this->GetDimensions());
213  }
214  void Initialize() override;
215  int GetMaxCellSize() override { return 8; } // hexahedron is the largest
216  void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds) override;
217  void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds, int* seedLoc);
219 
221 
224  void SetDimensions(int i, int j, int k);
225  void SetDimensions(const int dim[3]);
227 
229 
232  virtual int* GetDimensions() VTK_SIZEHINT(3);
233  virtual void GetDimensions(int dim[3]);
235 
239  int GetDataDimension();
240 
242 
247  void SetExtent(int extent[6]);
248  void SetExtent(int xMin, int xMax, int yMin, int yMax, int zMin, int zMax);
249  vtkGetVector6Macro(Extent, int);
251 
260  unsigned long GetActualMemorySize() override;
261 
263 
266  void ShallowCopy(vtkDataObject* src) override;
267  void DeepCopy(vtkDataObject* src) override;
269 
273  int GetExtentType() override { return VTK_3D_EXTENT; }
274 
276 
282  void BlankPoint(vtkIdType ptId);
285 
287 
293  void BlankCell(vtkIdType ptId);
294  void UnBlankCell(vtkIdType ptId);
296 
302  unsigned char IsPointVisible(vtkIdType ptId);
303 
309  unsigned char IsCellVisible(vtkIdType cellId);
310 
315  bool HasAnyBlankPoints() override;
320  bool HasAnyBlankCells() override;
321 
328  void GetCellDims(int cellDims[3]);
329 
335  void Crop(const int* updateExtent) override;
336 
338 
344 
354  void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true);
355 
356 protected:
358  ~vtkStructuredGrid() override;
359 
360  // for the GetCell method
366 
367  int Dimensions[3];
369 
370  int Extent[6];
371 
376  void ComputeScalarRange() override;
377 
378 private:
379  // Internal method used by DeepCopy and ShallowCopy.
380  void InternalStructuredGridCopy(vtkStructuredGrid* src);
381 
382 private:
383  vtkStructuredGrid(const vtkStructuredGrid&) = delete;
384  void operator=(const vtkStructuredGrid&) = delete;
385 };
386 
388 {
389  vtkIdType nCells = 1;
390  int dims[3];
391  int i;
392 
393  this->GetDimensions(dims);
394  for (i = 0; i < 3; i++)
395  {
396  if (dims[i] <= 0)
397  {
398  return 0;
399  }
400  if (dims[i] > 1)
401  {
402  nCells *= (dims[i] - 1);
403  }
404  }
405 
406  return nCells;
407 }
408 
410 {
412 }
413 
414 #endif
abstract class to specify cell behavior
Definition: vtkCell.h:150
general representation of visualization data
abstract class to specify dataset behavior
Definition: vtkDataSet.h:172
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
Definition: vtkEmptyCell.h:33
provides thread-safe access to cells
a cell that represents a linear 3D hexahedron
list of point or cell ids
Definition: vtkIdList.h:143
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
cell represents a 1D line
Definition: vtkLine.h:143
concrete class for storing a set of points
Definition: vtkPointSet.h:109
vtkIdType GetNumberOfCells() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:168
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:328
void GetPoint(vtkIdType ptId, double x[3]) override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:155
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:98
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.
topologically regular array of data
vtkHexahedron * Hexahedron
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.
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 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.
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.
int GetDataDimension()
Return the dimensionality of the data.
static vtkStructuredGrid * New()
~vtkStructuredGrid() override
void ComputeScalarRange() override
Compute the range of the scalars and cache it into ScalarRange only if the cache became invalid (Scal...
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.
virtual int * GetDimensions()
Get dimensions of this structured points dataset.
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.
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.
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
vtkCell * GetCell(int i, int j, int k) override
Standard vtkDataSet API methods.
dynamic, self-adjusting array of unsigned char
a cell that represents a 3D point
Definition: vtkVertex.h:103
@ info
Definition: vtkX3D.h:382
@ extent
Definition: vtkX3D.h:351
#define VTK_3D_EXTENT
int vtkIdType
Definition: vtkType.h:332
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:79
#define VTK_SIZEHINT(...)