VTK: Common/DataModel/vtkExplicitStructuredGrid.h Source File

| VTK 9.3.1

vtkExplicitStructuredGrid.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
54 #ifndef vtkExplicitStructuredGrid_h
55 #define vtkExplicitStructuredGrid_h
56
57 #include "vtkAbstractCellLinks.h" // For vtkAbstractCellLinks
58 #include "vtkCellArray.h" // For vtkCellArray
59 #include "vtkCommonDataModelModule.h" // For export macro
60 #include "vtkNew.h" // for vtkNew
61 #include "vtkPointSet.h"
62 #include "vtkStructuredData.h" // For static method usage
63
64 VTK_ABI_NAMESPACE_BEGIN
65 class vtkCellArray;
66 class vtkEmptyCell;
67 class vtkHexahedron;
68
69 class VTKCOMMONDATAMODEL_EXPORT vtkExplicitStructuredGrid : public vtkPointSet
70 {
71 public:
73
76 static vtkExplicitStructuredGrid* New();
77 vtkTypeMacro(vtkExplicitStructuredGrid, vtkPointSet);
78 void PrintSelf(ostream& os, vtkIndent indent) override;
80
84 int GetDataObjectType() override { return VTK_EXPLICIT_STRUCTURED_GRID; }
85
87
90 void Initialize() override;
91 using vtkDataSet::GetCell;
92 vtkCell* GetCell(vtkIdType cellId) override;
93 void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
94 void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
95 int GetCellType(vtkIdType cellId) override;
96 vtkIdType GetCellSize(vtkIdType cellId) override;
97 vtkIdType GetNumberOfCells() override;
98 void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override;
99 void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override;
100 int GetMaxCellSize() override { return 8; } // hexahedron is the largest
101 void GetCellNeighbors(vtkIdType cellId, vtkIdList* ptIds, vtkIdList* cellIds) override;
103
107 void CopyStructure(vtkDataSet* ds) override;
108
110
113 void ShallowCopy(vtkDataObject* src) override;
114 void DeepCopy(vtkDataObject* src) override;
116
120 inline int GetDataDimension() { return 3; }
121
123
128 void SetDimensions(int i, int j, int k);
129 void SetDimensions(int dim[3]);
130 void GetDimensions(int dim[3]);
132
138 void GetCellDims(int cellDims[3]);
139
143 int GetExtentType() override { return VTK_3D_EXTENT; }
144
146
153 void SetExtent(int x0, int x1, int y0, int y1, int z0, int z1);
154 void SetExtent(int extent[6]);
155 vtkGetVector6Macro(Extent, int);
157
159
162 vtkSetSmartPointerMacro(Cells, vtkCellArray);
163 vtkGetSmartPointerMacro(Cells, vtkCellArray);
165
170 void BuildLinks();
171
173
176 vtkSetSmartPointerMacro(Links, vtkAbstractCellLinks);
177 vtkGetSmartPointerMacro(Links, vtkAbstractCellLinks);
179
185 vtkIdType* GetCellPoints(vtkIdType cellId);
186
192 void GetCellPoints(vtkIdType cellId, vtkIdType& npts, vtkIdType*& pts);
193
202 void GetCellPoints(
203 vtkIdType cellId, vtkIdType& npts, vtkIdType const*& pts, vtkIdList* ptIds) override;
204
208 void GetCellNeighbors(vtkIdType cellId, vtkIdType neighbors[6], int* wholeExtent = nullptr);
209
218 void ComputeCellStructuredCoords(
219 vtkIdType cellId, int& i, int& j, int& k, bool adjustForExtent = true);
220
229 vtkIdType ComputeCellId(int i, int j, int k, bool adjustForExtent = true);
230
236 void ComputeFacesConnectivityFlagsArray();
237
239
242 vtkSetStringMacro(FacesConnectivityFlagsArrayName);
243 vtkGetStringMacro(FacesConnectivityFlagsArrayName);
245
247
253 void BlankCell(vtkIdType cellId);
254 void UnBlankCell(vtkIdType cellId);
256
260 bool HasAnyBlankCells() override;
261
267 unsigned char IsCellVisible(vtkIdType cellId);
268
274 unsigned char IsCellGhost(vtkIdType cellId);
275
279 bool HasAnyGhostCells();
280
282
287 void Crop(const int* updateExtent) override;
288 virtual void Crop(
289 vtkExplicitStructuredGrid* input, const int* updateExtent, bool generateOriginalCellIds);
291
293
296 static vtkExplicitStructuredGrid* GetData(vtkInformation* info);
297 static vtkExplicitStructuredGrid* GetData(vtkInformationVector* v, int i = 0);
299
308 unsigned long GetActualMemorySize() override;
309
320 void CheckAndReorderFaces();
321
323
328 using vtkDataSet::GenerateGhostArray;
329 void GenerateGhostArray(int zeroExt[6], bool cellOnly) override;
331
332 protected:
333 vtkExplicitStructuredGrid();
334 ~vtkExplicitStructuredGrid() override;
335
336 void ReportReferences(vtkGarbageCollector*) override;
337
342 void ComputeScalarRange() override;
343
347 virtual void InternalCopy(vtkExplicitStructuredGrid* src);
348
352 void GetCell(vtkIdType, vtkCell*);
353
357 void InternalCheckAndReorderFaces(bool swap);
358
363 int FindConnectedFaces(int foundFaces[3]);
364
369 static void CheckConnectedFaces(int& nFoundFaces, int foundFaces[3]);
370
374 static void ComputeSwapFlag(int foundFaces[3], int swap[3]);
375
379 static void ComputeMirrorFlag(int foundFaces[3], int mirror[3]);
380
384 void ReorderCellsPoints(const int* ptsMap, const int transformFlag[3]);
385
386 // Used by GetCell method
387 vtkNew<vtkHexahedron> Hexahedron;
388 vtkNew<vtkEmptyCell> EmptyCell;
389
390 vtkSmartPointer<vtkCellArray> Cells;
391 vtkSmartPointer<vtkAbstractCellLinks> Links;
392 int Extent[6];
393 char* FacesConnectivityFlagsArrayName;
394
395 private:
396 vtkExplicitStructuredGrid(const vtkExplicitStructuredGrid&) = delete;
397 void operator=(const vtkExplicitStructuredGrid&) = delete;
398 };
399
400 //----------------------------------------------------------------------------
401 inline void vtkExplicitStructuredGrid::GetDimensions(int dim[3])
402 {
403 vtkStructuredData::GetDimensionsFromExtent(this->Extent, dim);
404 }
405
406 //----------------------------------------------------------------------------
407 inline void vtkExplicitStructuredGrid::GetCellDims(int cellDims[3])
408 {
409 vtkStructuredData::GetCellDimensionsFromExtent(this->Extent, cellDims);
410 }
411
412 //----------------------------------------------------------------------------
413 inline void vtkExplicitStructuredGrid::ComputeCellStructuredCoords(
414 vtkIdType cellId, int& i, int& j, int& k, bool adjustForExtent)
415 {
416 int ijk[3];
417 if (adjustForExtent)
418 {
419 vtkStructuredData::ComputeCellStructuredCoordsForExtent(cellId, this->Extent, ijk);
420 }
421 else
422 {
423 int dims[3];
424 this->GetDimensions(dims);
425 vtkStructuredData::ComputeCellStructuredCoords(cellId, dims, ijk);
426 }
427 i = ijk[0];
428 j = ijk[1];
429 k = ijk[2];
430 }
431
432 //----------------------------------------------------------------------------
433 inline vtkIdType vtkExplicitStructuredGrid::ComputeCellId(int i, int j, int k, bool adjustForExtent)
434 {
435 int ijk[] = { i, j, k };
436 if (adjustForExtent)
437 {
438 return vtkStructuredData::ComputeCellIdForExtent(this->Extent, ijk);
439 }
440 else
441 {
442 int dims[3];
443 this->GetDimensions(dims);
444 return vtkStructuredData::ComputeCellId(dims, ijk);
445 }
446 }
447 VTK_ABI_NAMESPACE_END
448 #endif
vtkAbstractCellLinks
an abstract base class for classes that build topological links from points to cells
Definition: vtkAbstractCellLinks.h:32
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:185
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:59
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkDataSet::GetCell
virtual vtkCell * GetCell(vtkIdType cellId)=0
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
vtkDataSet::GenerateGhostArray
virtual void GenerateGhostArray(int zeroExt[6])
Normally called by pipeline executives or algorithms only.
Definition: vtkDataSet.h:442
vtkEmptyCell
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:22
vtkExplicitStructuredGrid
structured grid with explicit topology and geometry
Definition: vtkExplicitStructuredGrid.h:70
vtkExplicitStructuredGrid::DeepCopy
void DeepCopy(vtkDataObject *src) override
Shallow and Deep copy.
vtkExplicitStructuredGrid::Hexahedron
vtkNew< vtkHexahedron > Hexahedron
Definition: vtkExplicitStructuredGrid.h:387
vtkExplicitStructuredGrid::InternalCheckAndReorderFaces
void InternalCheckAndReorderFaces(bool swap)
Internal method used by CheckAndReorderFaces.
vtkExplicitStructuredGrid::Links
vtkSmartPointer< vtkAbstractCellLinks > Links
Definition: vtkExplicitStructuredGrid.h:391
vtkExplicitStructuredGrid::Initialize
void Initialize() override
Standard vtkDataSet API methods.
vtkExplicitStructuredGrid::GetCellBounds
void GetCellBounds(vtkIdType cellId, double bounds[6]) override
Standard vtkDataSet API methods.
vtkExplicitStructuredGrid::GetCellNeighbors
void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds) override
Standard vtkDataSet API methods.
vtkExplicitStructuredGrid::ComputeScalarRange
void ComputeScalarRange() override
Compute the range of the scalars and cache it into ScalarRange only if the cache became invalid (Scal...
vtkExplicitStructuredGrid::GetDataObjectType
int GetDataObjectType() override
Return what type of dataset this is.
Definition: vtkExplicitStructuredGrid.h:84
vtkExplicitStructuredGrid::ReportReferences
void ReportReferences(vtkGarbageCollector *) override
vtkExplicitStructuredGrid::Crop
void Crop(const int *updateExtent) override
Reallocates and copies to set the Extent to the UpdateExtent.
vtkExplicitStructuredGrid::EmptyCell
vtkNew< vtkEmptyCell > EmptyCell
Definition: vtkExplicitStructuredGrid.h:388
vtkExplicitStructuredGrid::GetCellDims
void GetCellDims(int cellDims[3])
Computes the cell dimensions according to internal point dimensions.
Definition: vtkExplicitStructuredGrid.h:407
vtkExplicitStructuredGrid::GetCell
void GetCell(vtkIdType cellId, vtkGenericCell *cell) override
Standard vtkDataSet API methods.
vtkExplicitStructuredGrid::GetCellPoints
void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) override
Standard vtkDataSet API methods.
vtkExplicitStructuredGrid::vtkGetSmartPointerMacro
vtkGetSmartPointerMacro(Cells, vtkCellArray)
Set/Get the cell array defining hexahedron.
vtkExplicitStructuredGrid::ReorderCellsPoints
void ReorderCellsPoints(const int *ptsMap, const int transformFlag[3])
Reorder all cells points based on a transformFlag for each axis and a points map.
vtkExplicitStructuredGrid::ComputeCellStructuredCoords
void ComputeCellStructuredCoords(vtkIdType cellId, int &i, int &j, int &k, bool adjustForExtent=true)
Given a cellId, get the structured coordinates (i-j-k).
Definition: vtkExplicitStructuredGrid.h:413
vtkExplicitStructuredGrid::GetDataDimension
int GetDataDimension()
Return the dimensionality of the data.
Definition: vtkExplicitStructuredGrid.h:120
vtkExplicitStructuredGrid::CopyStructure
void CopyStructure(vtkDataSet *ds) override
Copy the geometric and topological structure of an input poly data object.
vtkExplicitStructuredGrid::FacesConnectivityFlagsArrayName
char * FacesConnectivityFlagsArrayName
Definition: vtkExplicitStructuredGrid.h:393
vtkExplicitStructuredGrid::InternalCopy
virtual void InternalCopy(vtkExplicitStructuredGrid *src)
Internal method used by DeepCopy and ShallowCopy.
vtkExplicitStructuredGrid::SetExtent
void SetExtent(int x0, int x1, int y0, int y1, int z0, int z1)
Set/Get the extent of this structured dataset in term of number of points along each direction.
vtkExplicitStructuredGrid::FindConnectedFaces
int FindConnectedFaces(int foundFaces[3])
Find a connected face for each axis if any.
vtkExplicitStructuredGrid::Crop
virtual void Crop(vtkExplicitStructuredGrid *input, const int *updateExtent, bool generateOriginalCellIds)
Reallocates and copies to set the Extent to the UpdateExtent.
vtkExplicitStructuredGrid::ComputeCellId
vtkIdType ComputeCellId(int i, int j, int k, bool adjustForExtent=true)
Given a location in structured coordinates (i-j-k), return the cell id.
Definition: vtkExplicitStructuredGrid.h:433
vtkExplicitStructuredGrid::GetPointCells
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override
Standard vtkDataSet API methods.
vtkExplicitStructuredGrid::GetCellType
int GetCellType(vtkIdType cellId) override
Standard vtkDataSet API methods.
vtkExplicitStructuredGrid::IsCellVisible
unsigned char IsCellVisible(vtkIdType cellId)
Return non-zero value if specified cell is visible.
vtkExplicitStructuredGrid::GetData
static vtkExplicitStructuredGrid * GetData(vtkInformationVector *v, int i=0)
Retrieve an instance of this class from an information object.
vtkExplicitStructuredGrid::SetDimensions
void SetDimensions(int dim[3])
Set/Get the dimensions of this structured dataset in term of number of points along each direction.
vtkExplicitStructuredGrid::GetActualMemorySize
unsigned long GetActualMemorySize() override
Return the actual size of the data in kilobytes.
vtkExplicitStructuredGrid::GetCellNeighbors
void GetCellNeighbors(vtkIdType cellId, vtkIdType neighbors[6], int *wholeExtent=nullptr)
Get cell neighbors of the cell for every faces.
vtkExplicitStructuredGrid::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, type information, and printing.
vtkExplicitStructuredGrid::GetCell
void GetCell(vtkIdType, vtkCell *)
Internal method used by GetCell.
vtkExplicitStructuredGrid::vtkExplicitStructuredGrid
vtkExplicitStructuredGrid()
vtkExplicitStructuredGrid::~vtkExplicitStructuredGrid
~vtkExplicitStructuredGrid() override
vtkExplicitStructuredGrid::vtkGetSmartPointerMacro
vtkGetSmartPointerMacro(Links, vtkAbstractCellLinks)
Set/Get the links that you created possibly without using BuildLinks.
vtkExplicitStructuredGrid::HasAnyGhostCells
bool HasAnyGhostCells()
Returns true if one or more cells are ghost, false otherwise.
vtkExplicitStructuredGrid::GetCellPoints
void GetCellPoints(vtkIdType cellId, vtkIdType &npts, vtkIdType *&pts)
More efficient method to obtain cell points.
vtkExplicitStructuredGrid::BuildLinks
void BuildLinks()
Build topological links from points to lists of cells that use each point.
vtkExplicitStructuredGrid::GetCellPoints
void GetCellPoints(vtkIdType cellId, vtkIdType &npts, vtkIdType const *&pts, vtkIdList *ptIds) override
More efficient method to obtain cell points.
vtkExplicitStructuredGrid::CheckConnectedFaces
static void CheckConnectedFaces(int &nFoundFaces, int foundFaces[3])
Check a list of connected faces and remove invalid face or extrapolate missing faces.
vtkExplicitStructuredGrid::GetMaxCellSize
int GetMaxCellSize() override
Standard vtkDataSet API methods.
Definition: vtkExplicitStructuredGrid.h:100
vtkExplicitStructuredGrid::ComputeSwapFlag
static void ComputeSwapFlag(int foundFaces[3], int swap[3])
Compute a swap flag based if a face have been found.
vtkExplicitStructuredGrid::GetExtentType
int GetExtentType() override
The extent type is a 3D extent.
Definition: vtkExplicitStructuredGrid.h:143
vtkExplicitStructuredGrid::vtkSetSmartPointerMacro
vtkSetSmartPointerMacro(Links, vtkAbstractCellLinks)
Set/Get the links that you created possibly without using BuildLinks.
vtkExplicitStructuredGrid::SetDimensions
void SetDimensions(int i, int j, int k)
Set/Get the dimensions of this structured dataset in term of number of points along each direction.
vtkExplicitStructuredGrid::BlankCell
void BlankCell(vtkIdType cellId)
Methods for supporting blanking of cells.
vtkExplicitStructuredGrid::vtkSetSmartPointerMacro
vtkSetSmartPointerMacro(Cells, vtkCellArray)
Set/Get the cell array defining hexahedron.
vtkExplicitStructuredGrid::ShallowCopy
void ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
vtkExplicitStructuredGrid::CheckAndReorderFaces
void CheckAndReorderFaces()
Check faces are numbered correctly regarding ijk numbering If not this will reorganize cell points or...
vtkExplicitStructuredGrid::GetCell
vtkCell * GetCell(vtkIdType cellId) override
Standard vtkDataSet API methods.
vtkExplicitStructuredGrid::UnBlankCell
void UnBlankCell(vtkIdType cellId)
Methods for supporting blanking of cells.
vtkExplicitStructuredGrid::GetDimensions
void GetDimensions(int dim[3])
Set/Get the dimensions of this structured dataset in term of number of points along each direction.
Definition: vtkExplicitStructuredGrid.h:401
vtkExplicitStructuredGrid::ComputeMirrorFlag
static void ComputeMirrorFlag(int foundFaces[3], int mirror[3])
Compute a mirror flag based if a face have been found.
vtkExplicitStructuredGrid::GetNumberOfCells
vtkIdType GetNumberOfCells() override
Standard vtkDataSet API methods.
vtkExplicitStructuredGrid::HasAnyBlankCells
bool HasAnyBlankCells() override
Returns true if one or more cells are blanked, false otherwise.
vtkExplicitStructuredGrid::GetCellSize
vtkIdType GetCellSize(vtkIdType cellId) override
Standard vtkDataSet API methods.
vtkExplicitStructuredGrid::GetData
static vtkExplicitStructuredGrid * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
vtkExplicitStructuredGrid::Extent
int Extent[6]
Definition: vtkExplicitStructuredGrid.h:392
vtkExplicitStructuredGrid::New
static vtkExplicitStructuredGrid * New()
Standard methods for instantiation, type information, and printing.
vtkExplicitStructuredGrid::GetCellPoints
vtkIdType * GetCellPoints(vtkIdType cellId)
Get direct raw pointer to the 8 points indices of an hexahedra.
vtkExplicitStructuredGrid::IsCellGhost
unsigned char IsCellGhost(vtkIdType cellId)
Return non-zero value if specified cell is a ghost cell.
vtkExplicitStructuredGrid::ComputeFacesConnectivityFlagsArray
void ComputeFacesConnectivityFlagsArray()
Compute the faces connectivity flags array.
vtkExplicitStructuredGrid::GenerateGhostArray
void GenerateGhostArray(int zeroExt[6], bool cellOnly) override
Normally called by pipeline executives or algorithms only.
vtkExplicitStructuredGrid::SetExtent
void SetExtent(int extent[6])
Set/Get the extent of this structured dataset in term of number of points along each direction.
vtkExplicitStructuredGrid::Cells
vtkSmartPointer< vtkCellArray > Cells
Definition: vtkExplicitStructuredGrid.h:390
vtkGarbageCollector
Detect and break reference loops.
Definition: vtkGarbageCollector.h:80
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:38
vtkHexahedron
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:43
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:32
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:40
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkNew< vtkHexahedron >
vtkPointSet
concrete class for storing a set of points
Definition: vtkPointSet.h:68
vtkSmartPointer< vtkCellArray >
vtkStructuredData::GetCellDimensionsFromExtent
static void GetCellDimensionsFromExtent(const int ext[6], int celldims[3], int dataDescription=VTK_EMPTY)
Returns the cell dimensions, i.e., the number of cells along the i,j,k for the grid with the given gr...
Definition: vtkStructuredData.h:290
vtkStructuredData::GetDimensionsFromExtent
static void GetDimensionsFromExtent(const int ext[6], int dims[3], int dataDescription=VTK_EMPTY)
Computes the structured grid dimensions based on the given extent.
Definition: vtkStructuredData.h:348
vtkStructuredData::ComputeCellStructuredCoords
static void ComputeCellStructuredCoords(vtkIdType cellId, const int dim[3], int ijk[3], int dataDescription=VTK_EMPTY)
Given a cellId and grid dimensions 'dim', get the structured coordinates (i-j-k).
Definition: vtkStructuredData.h:409
vtkStructuredData::ComputeCellStructuredCoordsForExtent
static void ComputeCellStructuredCoordsForExtent(vtkIdType cellIdx, const int ext[6], int ijk[3], int dataDescription=VTK_EMPTY)
Given the global grid extent and the linear index of a cell within the grid extent,...
Definition: vtkStructuredData.h:417
vtkStructuredData::ComputeCellIdForExtent
static vtkIdType ComputeCellIdForExtent(const int extent[6], const int ijk[3], int dataDescription=VTK_EMPTY)
Given a location in structured coordinates (i-j-k), and the extent of the structured dataset,...
Definition: vtkStructuredData.h:396
vtkStructuredData::ComputeCellId
static vtkIdType ComputeCellId(const int dim[3], const int ijk[3], int dataDescription=VTK_EMPTY)
Given a location in structured coordinates (i-j-k), and the dimensions of the structured dataset,...
Definition: vtkStructuredData.h:304
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkX3D::extent
@ extent
Definition: vtkX3D.h:345
vtkAbstractCellLinks.h
vtkCellArray.h
VTK_3D_EXTENT
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:60
vtkNew.h
vtkPointSet.h
vtkStructuredData.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315
VTK_EXPLICIT_STRUCTURED_GRID
#define VTK_EXPLICIT_STRUCTURED_GRID
Definition: vtkType.h:105