Dune Core Modules (2.7.1)

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 GeometryType (Id id)
 Reconstruct a Geometry type from a GeometryType::Id. More...
 
Constructors
constexpr GeometryType ()
 Default constructor, not initializing anything.
 
DUNE_NO_DEPRECATED_BEGIN GeometryType (BasicType basicType, unsigned int dim)
 Constructor, using the basic type and the dimension. More...
 
constexpr DUNE_NO_DEPRECATED_END GeometryType (unsigned int topologyId, unsigned int dim, bool none)
 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 = Dune::void_t<decltype(TopologyType::dimension), decltype(TopologyType::id)>>
 GeometryType (TopologyType t)
 Constructor from static TopologyType class. More...
 
 GeometryType (unsigned int dim)
 Constructor for vertices and segments. More...
 
 GeometryType (int dim)
 Constructor for vertices and segments. More...
 
Setup Methods
void makeVertex ()
 Make a vertex. More...
 
void makeLine ()
 Make a line segment. More...
 
void makeTriangle ()
 Make a triangle. More...
 
void makeQuadrilateral ()
 Make a quadrilateral. More...
 
void makeTetrahedron ()
 Make a tetrahedron. More...
 
void makePyramid ()
 Make a pyramid. More...
 
void makePrism ()
 Make a prism. More...
 
void makeHexahedron ()
 Make a hexahedron. More...
 
void makeSimplex (unsigned int dim)
 Make a simplex of given dimension. More...
 
void makeCube (unsigned int dim)
 Make a hypercube of given dimension. More...
 
void makeNone (unsigned int dim)
 Make a singular of given dimension. More...
 
void makeFromVertices (unsigned int dim, unsigned int vertices)
 Construct the correct geometry type given the dimension and the number of vertices. 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 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;
constexpr GeometryType()
Default constructor, not initializing anything.
Definition: type.hh:380
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:156

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

constexpr Dune::GeometryType::GeometryType ( Id  id)
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/7]

DUNE_NO_DEPRECATED_BEGIN Dune::GeometryType::GeometryType ( BasicType  basicType,
unsigned int  dim 
)
inline

Constructor, using the basic type and the dimension.

Deprecated:
"The GeometryType constructor taking BasicType is deprecated and will be removed after DUNE 2.6"

◆ GeometryType() [3/7]

constexpr DUNE_NO_DEPRECATED_END Dune::GeometryType::GeometryType ( unsigned int  topologyId,
unsigned int  dim,
bool  none 
)
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() [4/7]

constexpr Dune::GeometryType::GeometryType ( unsigned int  topologyId,
unsigned int  dim 
)
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() [5/7]

template<class TopologyType , class = Dune::void_t<decltype(TopologyType::dimension), decltype(TopologyType::id)>>
Dune::GeometryType::GeometryType ( TopologyType  t)
inlineexplicit

Constructor from static TopologyType class.

Constructs the GeometryType object from a static topology representation.

Template Parameters
TopologyTypeA 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
tAny object of type TopologyType. The object t itself is ignored.

◆ GeometryType() [6/7]

Dune::GeometryType::GeometryType ( unsigned int  dim)
inlineexplicit

Constructor for vertices and segments.

Deprecated:
"GeometryType(unsigned dim) is deprecated in DUNE 2.7, please use Dune::GeometryTypes::cube(dim) instead"

◆ GeometryType() [7/7]

Dune::GeometryType::GeometryType ( int  dim)
inlineexplicit

Constructor for vertices and segments.

Deprecated:
"GeometryType(dim) is deprecated in DUNE 2.7, please use Dune::GeometryTypes::cube(dim) instead"

Member Function Documentation

◆ makeCube()

void Dune::GeometryType::makeCube ( unsigned int  dim)
inline

Make a hypercube of given dimension.

Deprecated:
"makeCube(dim) is deprecated in DUNE 2.6, please use Dune::GeometryTypes::cube(dim) instead"

◆ makeFromVertices()

void Dune::GeometryType::makeFromVertices ( unsigned int  dim,
unsigned int  vertices 
)
inline

Construct the correct geometry type given the dimension and the number of vertices.

Note
This code only works up to dimension 3. In higher dimensions the number of vertices does not uniquely identify the type of polyhedron.
Deprecated:
"Use the utility function geometryTypeFromVertexCount(...) instead."

◆ makeHexahedron()

void Dune::GeometryType::makeHexahedron ( )
inline

Make a hexahedron.

Deprecated:
"makeHexahedron() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::hexahedron instead"

◆ makeLine()

void Dune::GeometryType::makeLine ( )
inline

Make a line segment.

Deprecated:
"makeLine() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::line instead"

◆ makeNone()

void Dune::GeometryType::makeNone ( unsigned int  dim)
inline

Make a singular of given dimension.

Deprecated:
"makeNone(dim) is deprecated in DUNE 2.6, please use Dune::GeometryTypes::none(dim) instead"

◆ makePrism()

void Dune::GeometryType::makePrism ( )
inline

Make a prism.

Deprecated:
"makePrism() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::prism instead"

◆ makePyramid()

void Dune::GeometryType::makePyramid ( )
inline

Make a pyramid.

Deprecated:
"makePyramid() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::pyramid instead"

◆ makeQuadrilateral()

void Dune::GeometryType::makeQuadrilateral ( )
inline

Make a quadrilateral.

Deprecated:
"makeQuadrilateral() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::quadrilateral instead"

◆ makeSimplex()

void Dune::GeometryType::makeSimplex ( unsigned int  dim)
inline

Make a simplex of given dimension.

Deprecated:
"makeSimplex(dim) is deprecated in DUNE 2.6, please use Dune::GeometryTypes::simplex(dim) instead"

◆ makeTetrahedron()

void Dune::GeometryType::makeTetrahedron ( )
inline

Make a tetrahedron.

Deprecated:
"makeTetrahedron() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::tetrahedron instead"

◆ makeTriangle()

void Dune::GeometryType::makeTriangle ( )
inline

Make a triangle.

Deprecated:
"makeTriangle() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::triangle instead"

◆ makeVertex()

void Dune::GeometryType::makeVertex ( )
inline

Make a vertex.

Deprecated:
"makeVertex() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::vertex instead"

◆ operator Id()

constexpr Dune::GeometryType::operator Id ( ) const
inlineconstexpr

Construct an Id representing this GeometryType.

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

See also
Id

The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Apr 27, 22:29, 2024)