Loading...
Searching...
No Matches
Dune::GeometryType Class Reference
dune-geometry » Geometry Type

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.

## Public Member Functions

constexpr | operator Id () const
| Construct an Id representing this GeometryType.
constexpr Id | toId () const
| Create an Id representation of this GeometryType.
constexpr | GeometryType (Id id)
| Reconstruct a Geometry type from a GeometryType::Id.
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.
constexpr | GeometryType (unsigned int topologyId, unsigned int dim)
| Constructor, using the topologyId (integer) and the dimension.
template<class TopologyType, class = std::void_t<decltype(TopologyType::dimension), decltype(TopologyType::id)>>
| GeometryType (TopologyType t)
| Constructor from static TopologyType class.
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.
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.
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:

// define a template with a GeometryType::Id parameter
template<GeometryType::Id gtid>
class Foo
{
// reconstruct a full-blown constexpr GeometryType as needed to access
// information like the dimension etc.
static constexpr GeometryType gt = gtid;
};
// Instantiate a Foo template
Foo<GeometryTypes::triangle> foo;
Dune::GeometryType::GeometryType
constexpr GeometryType(Id id)
Reconstruct a Geometry type from a GeometryType::Id.
Definition type.hh:222

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

enum Dune::GeometryType::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/5]

Dune::GeometryType::GeometryType | ( | Id | id | ) |

inline constexpr

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/5]

Dune::GeometryType::GeometryType | ( |  | ) |

inline constexpr

Default constructor, not initializing anything.

## GeometryType() [3/5]

Dune::GeometryType::GeometryType | ( | unsigned int | topologyId,
|  | unsigned int | dim,
|  | bool | isNone )

inline constexpr

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() [4/5]

Dune::GeometryType::GeometryType | ( | unsigned int | topologyId,
|  | unsigned int | dim )

inline constexpr

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() [5/5]

template<class TopologyType, class = std::void_t<decltype(TopologyType::dimension), decltype(TopologyType::id)>>

Dune::GeometryType::GeometryType | ( | TopologyType | t | ) |

inline explicit

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.

## Member Function Documentation

## dim()

unsigned int Dune::GeometryType::dim | ( |  | ) | const

inline constexpr

Return dimension of the type.

## id()

unsigned int Dune::GeometryType::id | ( |  | ) | const

inline constexpr

Return the topology id of the type.

## isConical() [1/2]

bool Dune::GeometryType::isConical | ( |  | ) | const

inline constexpr

Return true if entity was constructed with a conical product in the last step.

## isConical() [2/2]

bool Dune::GeometryType::isConical | ( | const int & | step | ) | const

inline constexpr

Return true if entity was constructed with a conical product in the chosen step.

Parameters

  step | 0 <= step <= dim-1

## isCube()

bool Dune::GeometryType::isCube | ( |  | ) | const

inline constexpr

Return true if entity is a cube of any dimension.

## isHexahedron()

bool Dune::GeometryType::isHexahedron | ( |  | ) | const

inline constexpr

Return true if entity is a hexahedron.

## isLine()

bool Dune::GeometryType::isLine | ( |  | ) | const

inline constexpr

Return true if entity is a line segment.

## isNone()

bool Dune::GeometryType::isNone | ( |  | ) | const

inline constexpr

Return true if entity is a singular of any dimension.

## isPrism()

bool Dune::GeometryType::isPrism | ( |  | ) | const

inline constexpr

Return true if entity is a prism.

## isPrismatic() [1/2]

bool Dune::GeometryType::isPrismatic | ( |  | ) | const

inline constexpr

Return true if entity was constructed with a prismatic product in the last step.

## isPrismatic() [2/2]

bool Dune::GeometryType::isPrismatic | ( | const int & | step | ) | const

inline constexpr

Return true if entity was constructed with a prismatic product in the chosen step.

Parameters

  step | 0 <= step <= dim-1

## isPyramid()

bool Dune::GeometryType::isPyramid | ( |  | ) | const

inline constexpr

Return true if entity is a pyramid.

## isQuadrilateral()

bool Dune::GeometryType::isQuadrilateral | ( |  | ) | const

inline constexpr

Return true if entity is a quadrilateral.

## isSimplex()

bool Dune::GeometryType::isSimplex | ( |  | ) | const

inline constexpr

Return true if entity is a simplex of any dimension.

## isTetrahedron()

bool Dune::GeometryType::isTetrahedron | ( |  | ) | const

inline constexpr

Return true if entity is a tetrahedron.

## isTriangle()

bool Dune::GeometryType::isTriangle | ( |  | ) | const

inline constexpr

Return true if entity is a triangle.

## isVertex()

bool Dune::GeometryType::isVertex | ( |  | ) | const

inline constexpr

Return true if entity is a vertex.

## operator Id()

Dune::GeometryType::operator Id | ( |  | ) | const

inline constexpr

Construct an Id representing this GeometryType.

This constructor exists mostly to transparently support using a GeometryType as a template parameter.

See also
  Id

## operator!=()

bool Dune::GeometryType::operator!= | ( | const GeometryType & | other | ) | const

inline constexpr

Check for inequality.

## operator<()

bool Dune::GeometryType::operator< | ( | const GeometryType & | other | ) | const

inline constexpr

less-than operation for use with maps

## operator==()

bool Dune::GeometryType::operator== | ( | const GeometryType & | other | ) | const

inline constexpr

Check for equality. This method knows that in dimension 0 and 1 all BasicTypes are equal.

## toId()

Id Dune::GeometryType::toId | ( |  | ) | const

inline constexpr

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:

- type.hh