VTK  9.3.0
vtkDGCell.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
19#ifndef vtkDGCell_h
20#define vtkDGCell_h
21
22#include "vtkFiltersCellGridModule.h" // for export macro
23
24#include "vtkCellMetadata.h"
25#include "vtkStringToken.h" // for vtkStringToken::Hash
26
27#include <vector> // for side connectivity
28
29VTK_ABI_NAMESPACE_BEGIN
31class vtkCellGrid;
33class vtkTypeFloat32Array;
34class vtkTypeInt32Array;
35
36class VTKFILTERSCELLGRID_EXPORT vtkDGCell : public vtkCellMetadata
37{
38public:
39 vtkTypeMacro(vtkDGCell, vtkCellMetadata);
40 void PrintSelf(ostream& os, vtkIndent indent) override;
41
43 enum Shape : int
44 {
52 Pyramid
53
54 // It is probably more efficient to create a new cell type for arbitrary shapes
55 // than to attempt generalizing vtkDGCell, but for the sake of completeness:
56 // Polygon //!< We may one day support an n-sided polygonal face.
57 // Polyhedron //!< We may one day support an n-faced polyhedral volume with polygonal sides.
58 };
59
60 static int GetShapeCornerCount(Shape shape);
61 static int GetShapeDimension(Shape shape);
63
65 virtual Shape GetShape() const = 0;
66
68 virtual int GetDimension() const { return vtkDGCell::GetShapeDimension(this->GetShape()); }
69
71 virtual int GetNumberOfCorners() const
72 {
73 return vtkDGCell::GetShapeCornerCount(this->GetShape());
74 }
75
81 virtual const std::array<double, 3>& GetCornerParameter(int corner) const = 0;
82
86 virtual int GetNumberOfSideTypes() const = 0;
87
100 virtual std::pair<int, int> GetSideRangeForType(int sideType) const = 0;
101
112 virtual int GetNumberOfSidesOfDimension(int dimension) const = 0;
113
120 virtual Shape GetSideShape(int side) const = 0;
121
130 virtual const std::vector<vtkIdType>& GetSideConnectivity(int side) const = 0;
131
137 virtual vtkTypeFloat32Array* GetReferencePoints() const = 0;
138
146 virtual vtkTypeInt32Array* GetSideConnectivity() const = 0;
147
153 virtual vtkTypeInt32Array* GetSideOffsetsAndShapes() const = 0;
154
156 void FillReferencePoints(vtkTypeFloat32Array* arr) const;
157
159 void FillSideConnectivity(vtkTypeInt32Array* arr) const;
160
181 void FillSideOffsetsAndShapes(vtkTypeInt32Array* arr) const;
182
183protected:
185 ~vtkDGCell() override;
186
187private:
188 vtkDGCell(const vtkDGCell&) = delete;
189 void operator=(const vtkDGCell&) = delete;
190};
191
192VTK_ABI_NAMESPACE_END
193#endif
A function defined over the physical domain of a vtkCellGrid.
Visualization data composed of cells of arbitrary type.
Definition vtkCellGrid.h:42
Metadata for a particular type of cell (finite element).
Base class for a discontinuous Galerkin cells of all shapes.
Definition vtkDGCell.h:37
void FillSideConnectivity(vtkTypeInt32Array *arr) const
Fill the passed array with the connectivity (point IDs) of all the element's sides.
virtual const std::array< double, 3 > & GetCornerParameter(int corner) const =0
Return the coordinates of the reference element's corner vertex.
~vtkDGCell() override
Shape
All possible shapes for DG cells.
Definition vtkDGCell.h:44
@ Hexahedron
An eight-cornered volume; a quadrilateral prism.
Definition vtkDGCell.h:50
@ Triangle
A three-cornered face bounded by 3 edges.
Definition vtkDGCell.h:47
@ Tetrahedron
A four-cornered volume bounded by 4 triangular shapes.
Definition vtkDGCell.h:49
@ Quadrilateral
A four-cornered face bounded by 4 edges.
Definition vtkDGCell.h:48
@ Wedge
A volumetric, triangular prism.
Definition vtkDGCell.h:51
@ Edge
A curve connecting two vertices.
Definition vtkDGCell.h:46
@ Vertex
A corner point.
Definition vtkDGCell.h:45
static int GetShapeDimension(Shape shape)
virtual Shape GetSideShape(int side) const =0
For a given side, return its cell shape.
static int GetShapeCornerCount(Shape shape)
void FillReferencePoints(vtkTypeFloat32Array *arr) const
Fill the passed array with the parametric coordinates of all the element's corners.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual Shape GetShape() const =0
Return the topological shape of this cell type.
virtual const std::vector< vtkIdType > & GetSideConnectivity(int side) const =0
Return the connectivity of the given side.
virtual vtkTypeInt32Array * GetSideConnectivity() const =0
Return a singleton array initialized with point-ids of each side's corners.
void FillSideOffsetsAndShapes(vtkTypeInt32Array *arr) const
Fill the passed array with tuples of (1) offsets into the side-connectivity and (2) shapes for each t...
virtual vtkTypeFloat32Array * GetReferencePoints() const =0
Return a singleton array initialized with the reference-cell's corner point coordinates.
virtual std::pair< int, int > GetSideRangeForType(int sideType) const =0
Return the range of sides of the ii-th type, where ii is in [0, this->GetNumberOfSideTypes()[.
virtual int GetDimension() const
Return the parametric dimension of this cell type (0, 1, 2, or 3).
Definition vtkDGCell.h:68
virtual int GetNumberOfSideTypes() const =0
Return the number of different side shapes of this cell type.
virtual vtkTypeInt32Array * GetSideOffsetsAndShapes() const =0
Return a singleton array initialized with 2-tuples of (offset, shape) values.
static vtkStringToken GetShapeName(Shape shape)
virtual int GetNumberOfSidesOfDimension(int dimension) const =0
Return the number of boundaries this type of cell has of a given dimension.
virtual int GetNumberOfCorners() const
Return the number of corner points for this cell type.
Definition vtkDGCell.h:71
represent and manipulate attribute data in a dataset
a simple class to control print indentation
Definition vtkIndent.h:29
Represent a string by its integer hash.