Dune Core Modules (2.8.0)
Unique label for each type of entities that can occur in DUNE grids. More...
#include <dune/geometry/type.hh>
Public Types | |
enum | BasicType { simplex , cube , pyramid , prism , extended , none } |
Each entity can be tagged by one of these basic types plus its space dimension. More... | |
using | Id = IdType |
An integral id representing a GeometryType. More... | |
Public Member Functions | |
constexpr | operator Id () const |
Construct an Id representing this GeometryType. More... | |
constexpr Id | toId () const |
Create an Id representation of this GeometryType. More... | |
constexpr | GeometryType (Id id) |
Reconstruct a Geometry type from a GeometryType::Id. More... | |
Constructors | |
constexpr | GeometryType () |
Default constructor, not initializing anything. | |
constexpr | GeometryType (unsigned int topologyId, unsigned int dim, bool isNone) |
Constructor, using the topologyId (integer), the dimension and a flag for type none. More... | |
constexpr | GeometryType (unsigned int topologyId, unsigned int dim) |
Constructor, using the topologyId (integer) and the dimension. More... | |
template<class TopologyType , class = std::void_t<decltype(TopologyType::dimension), decltype(TopologyType::id)>> | |
GeometryType (TopologyType t) | |
Constructor from static TopologyType class. More... | |
Query Methods | |
constexpr bool | isVertex () const |
Return true if entity is a vertex. | |
constexpr bool | isLine () const |
Return true if entity is a line segment. | |
constexpr bool | isTriangle () const |
Return true if entity is a triangle. | |
constexpr bool | isQuadrilateral () const |
Return true if entity is a quadrilateral. | |
constexpr bool | isTetrahedron () const |
Return true if entity is a tetrahedron. | |
constexpr bool | isPyramid () const |
Return true if entity is a pyramid. | |
constexpr bool | isPrism () const |
Return true if entity is a prism. | |
constexpr bool | isHexahedron () const |
Return true if entity is a hexahedron. | |
constexpr bool | isSimplex () const |
Return true if entity is a simplex of any dimension. | |
constexpr bool | isCube () const |
Return true if entity is a cube of any dimension. | |
constexpr bool | isConical () const |
Return true if entity was constructed with a conical product in the last step. | |
constexpr bool | isConical (const int &step) const |
Return true if entity was constructed with a conical product in the chosen step. More... | |
constexpr bool | isPrismatic () const |
Return true if entity was constructed with a prismatic product in the last step. | |
constexpr bool | isPrismatic (const int &step) const |
Return true if entity was constructed with a prismatic product in the chosen step. More... | |
constexpr bool | isNone () const |
Return true if entity is a singular of any dimension. | |
constexpr unsigned int | dim () const |
Return dimension of the type. | |
constexpr unsigned int | id () const |
Return the topology id of the type. | |
Comparison operators | |
constexpr bool | operator== (const GeometryType &other) const |
Check for equality. This method knows that in dimension 0 and 1 all BasicTypes are equal. | |
constexpr bool | operator!= (const GeometryType &other) const |
Check for inequality. | |
constexpr bool | operator< (const GeometryType &other) const |
less-than operation for use with maps | |
Detailed Description
Unique label for each type of entities that can occur in DUNE grids.
This class has to be extended if a grid implementation with new entity types is added to DUNE.
GeometryType is a C++ "literal type" and can be used in constexpr
context if created with a constexpr
constructor.
If you want to use a GeometryType as a template parameter, see GeometryType::Id.
Member Typedef Documentation
◆ Id
using Dune::GeometryType::Id = IdType |
An integral id representing a GeometryType.
Id is an unspecified built-in integral type that uniquely represents a GeometryType. It mostly exists to be able to use a geometry type as a template parameter, as C++ does not let us use GeometryType directly for this purpose.
GeometryType and GeometryType::Id are implicitly convertible to each other, while the Id does not implicitly convert into other integral types. They should be used as follows:
As you can see, the conversion between GeometryType and the id is completely transparent to the user (apart from the slightly different template parameter type).
- Note
- The Id really only exists for this template parameter workaround. Do not use it to store a more compact version of the GeometryType - GeometryType and GeometryType::Id use the same amount of storage (64 bits).
Member Enumeration Documentation
◆ BasicType
Each entity can be tagged by one of these basic types plus its space dimension.
Enumerator | |
---|---|
simplex | Simplicial element in any nonnegative dimension. |
cube | Cube element in any nonnegative dimension. |
pyramid | Four sided pyramid in three dimensions. |
prism | Prism element in three dimensions. |
extended | Other, more general topology, representable as topologyId. |
none | Even more general topology, cannot be specified by a topologyId. Two GeometryTypes with 'none' type are equal if and only if they have the same dimension. |
Constructor & Destructor Documentation
◆ GeometryType() [1/4]
|
inlineconstexpr |
Reconstruct a Geometry type from a GeometryType::Id.
This constructor exists mostly to transparently support using a GeometryType as a template parameter.
- See also
- Id
◆ GeometryType() [2/4]
|
inlineconstexpr |
Constructor, using the topologyId (integer), the dimension and a flag for type none.
- Note
- With this constructor, you can easily create an invalid GeometryType, it is mostly here for internal use! the TypologyType, users are encouraged to use the GeometryType(TopologyType t) constructor.
◆ GeometryType() [3/4]
|
inlineconstexpr |
Constructor, using the topologyId (integer) and the dimension.
- Note
- the topologyId is a binary encoded representation of the TypologyType, users are encouraged to use the GeometryType(TopologyType t) constructor.
◆ GeometryType() [4/4]
|
inlineexplicit |
Constructor from static TopologyType class.
Constructs the GeometryType object from a static topology representation.
- Template Parameters
-
TopologyType A class providing public static unsigned int members TopologyType::dimension and TopologyType::id. You can e.g. use the Point, Prism and Pyramid structs from the Impl namespace.
- Parameters
-
t Any object of type TopologyType. The object t itself is ignored.
References DUNE_UNUSED_PARAMETER.
Member Function Documentation
◆ isConical()
|
inlineconstexpr |
Return true if entity was constructed with a conical product in the chosen step.
- Parameters
-
step 0 <= step <= dim-1
◆ isPrismatic()
|
inlineconstexpr |
Return true if entity was constructed with a prismatic product in the chosen step.
- Parameters
-
step 0 <= step <= dim-1
◆ operator Id()
|
inlineconstexpr |
Construct an Id representing this GeometryType.
This constructor exists mostly to transparently support using a GeometryType as a template parameter.
- See also
- Id
References id().
◆ toId()
|
inlineconstexpr |
Create an Id representation of this GeometryType.
The returned Id encapsulates the whole information of this GeometryType into an enum suitable for being used as template parameter. The GeometryType can be reconstructed from the Id using GeometryType{id}.
This function was mainly introduced to support older GCC versions (<10.2). There the implicit conversion from GeometryType to Id failed if a pure r-value template argument based on a static class member was used. (See dune/geometry/test/test-geometrytype-id.cc)
The documentation for this class was generated from the following file:
- dune/geometry/type.hh