VTK  9.1.0
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=========================================================================*/
151#ifndef vtkStructuredGrid_h
152#define vtkStructuredGrid_h
153
154#include "vtkCommonDataModelModule.h" // For export macro
155#include "vtkPointSet.h"
156
157#include "vtkStructuredData.h" // Needed for inline methods
158
159class vtkEmptyCell;
160class vtkHexahedron;
161class vtkLine;
162class vtkQuad;
164class vtkVertex;
165
166class VTKCOMMONDATAMODEL_EXPORT vtkStructuredGrid : public vtkPointSet
167{
168public:
171
173 void PrintSelf(ostream& os, vtkIndent indent) override;
174
178 int GetDataObjectType() override { return VTK_STRUCTURED_GRID; }
179
183 void CopyStructure(vtkDataSet* ds) override;
184
186
190 double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override
191 {
192 return this->vtkPointSet::GetPoint(ptId);
193 }
194 void GetPoint(vtkIdType ptId, double p[3]) override { this->vtkPointSet::GetPoint(ptId, p); }
195 vtkCell* GetCell(vtkIdType cellId) override;
196 vtkCell* GetCell(int i, int j, int k) override;
197 void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
198 void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
199 int GetCellType(vtkIdType cellId) override;
200 vtkIdType GetNumberOfCells() override;
201 void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override;
202 void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override
203 {
204 vtkStructuredData::GetPointCells(ptId, cellIds, this->GetDimensions());
205 }
206 void Initialize() override;
207 int GetMaxCellSize() override { return 8; } // hexahedron is the largest
208 void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds) override;
209 void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds, int* seedLoc);
211
213
216 void SetDimensions(int i, int j, int k);
217 void SetDimensions(const int dim[3]);
219
221
224 virtual int* GetDimensions() VTK_SIZEHINT(3);
225 virtual void GetDimensions(int dim[3]);
227
231 int GetDataDimension();
232
234
239 void SetExtent(int extent[6]);
240 void SetExtent(int xMin, int xMax, int yMin, int yMax, int zMin, int zMax);
241 vtkGetVector6Macro(Extent, int);
243
252 unsigned long GetActualMemorySize() override;
253
255
258 void ShallowCopy(vtkDataObject* src) override;
259 void DeepCopy(vtkDataObject* src) override;
261
265 int GetExtentType() override { return VTK_3D_EXTENT; }
266
268
277
279
288
294 unsigned char IsPointVisible(vtkIdType ptId);
295
301 unsigned char IsCellVisible(vtkIdType cellId);
302
307 bool HasAnyBlankPoints() override;
312 bool HasAnyBlankCells() override;
313
320 void GetCellDims(int cellDims[3]);
321
327 void Crop(const int* updateExtent) override;
328
330
336
346 void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true);
347
348protected:
351
352 // for the GetCell method
358
359 int Dimensions[3];
361
362 int Extent[6];
363
368 void ComputeScalarRange() override;
369
370private:
374 void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
375 {
376 this->GetCellNeighbors(cellId, &ptIds, &cellIds);
377 }
378
379 // Internal method used by DeepCopy and ShallowCopy.
380 void InternalStructuredGridCopy(vtkStructuredGrid* src);
381
382private:
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:147
general representation of visualization data
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds)
Topological inquiry to get all cells using list of points exclusive of cell specified (e....
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:30
provides thread-safe access to cells
a cell that represents a linear 3D hexahedron
list of point or cell ids
Definition: vtkIdList.h:140
a simple class to control print indentation
Definition: vtkIndent.h:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
cell represents a 1D line
Definition: vtkLine.h:140
concrete class for storing a set of points
Definition: vtkPointSet.h:106
vtkIdType GetNumberOfCells() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:165
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:152
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:95
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
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
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 methdos for type information and printing.
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.
~vtkStructuredGrid() override
void ComputeScalarRange() override
Compute the range of the scalars and cache it into ScalarRange only if the cache became invalid (Scal...
vtkIdType GetNumberOfPoints() override
Standard vtkDataSet API methods.
double * GetPoint(vtkIdType ptId) override
Standard vtkDataSet API methods.
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.
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 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:100
@ 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(...)