dune-geometry  2.7.0
Public Types | Public Member Functions | List of all members
Dune::GeometryType Class Reference

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. More...
 
DUNE_NO_DEPRECATED_BEGIN GeometryType (BasicType basicType, unsigned int dim) DUNE_DEPRECATED_MSG("The GeometryType const ructor taking BasicType is deprecated and will be removed after DUNE 2.6")
 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...
 
 DUNE_DEPRECATED_MSG ("GeometryType(unsigned dim) is deprecated in DUNE 2.7, please use Dune::GeometryTypes::cube(dim) instead") explicit GeometryType(unsigned int dim)
 Constructor for vertices and segments. More...
 
 DUNE_DEPRECATED_MSG ("GeometryType(dim) is deprecated in DUNE 2.7, please use Dune::GeometryTypes::cube(dim) instead") explicit GeometryType(int dim)
 Constructor for vertices and segments. More...
 
Setup Methods
 DUNE_DEPRECATED_MSG ("makeVertex() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::vertex instead") void makeVertex()
 Make a vertex. More...
 
 DUNE_DEPRECATED_MSG ("makeLine() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::line instead") void makeLine()
 Make a line segment. More...
 
 DUNE_DEPRECATED_MSG ("makeTriangle() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::triangle instead") void makeTriangle()
 Make a triangle. More...
 
 DUNE_DEPRECATED_MSG ("makeQuadrilateral() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::quadrilateral instead") void makeQuadrilateral()
 Make a quadrilateral. More...
 
 DUNE_DEPRECATED_MSG ("makeTetrahedron() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::tetrahedron instead") void makeTetrahedron()
 Make a tetrahedron. More...
 
 DUNE_DEPRECATED_MSG ("makePyramid() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::pyramid instead") void makePyramid()
 Make a pyramid. More...
 
 DUNE_DEPRECATED_MSG ("makePrism() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::prism instead") void makePrism()
 Make a prism. More...
 
 DUNE_DEPRECATED_MSG ("makeHexahedron() is deprecated in DUNE 2.6, please use Dune::GeometryTypes::hexahedron instead") void makeHexahedron()
 Make a hexahedron. More...
 
 DUNE_DEPRECATED_MSG ("makeSimplex(dim) is deprecated in DUNE 2.6, please use Dune::GeometryTypes::simplex(dim) instead") void makeSimplex(unsigned int dim)
 Make a simplex of given dimension. More...
 
 DUNE_DEPRECATED_MSG ("makeCube(dim) is deprecated in DUNE 2.6, please use Dune::GeometryTypes::cube(dim) instead") void makeCube(unsigned int dim)
 Make a hypercube of given dimension. More...
 
 DUNE_DEPRECATED_MSG ("makeNone(dim) is deprecated in DUNE 2.6, please use Dune::GeometryTypes::none(dim) instead") void makeNone(unsigned int dim)
 Make a singular of given dimension. More...
 
void makeFromVertices (unsigned int dim, unsigned int vertices) DUNE_DEPRECATED_MSG("Use the utility function geometryTypeFromVertexCount(...) instead.")
 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. More...
 
constexpr bool isLine () const
 Return true if entity is a line segment. More...
 
constexpr bool isTriangle () const
 Return true if entity is a triangle. More...
 
constexpr bool isQuadrilateral () const
 Return true if entity is a quadrilateral. More...
 
constexpr bool isTetrahedron () const
 Return true if entity is a tetrahedron. More...
 
constexpr bool isPyramid () const
 Return true if entity is a pyramid. More...
 
constexpr bool isPrism () const
 Return true if entity is a prism. More...
 
constexpr bool isHexahedron () const
 Return true if entity is a hexahedron. More...
 
constexpr bool isSimplex () const
 Return true if entity is a simplex of any dimension. More...
 
constexpr bool isCube () const
 Return true if entity is a cube of any dimension. More...
 
constexpr bool isNone () const
 Return true if entity is a singular of any dimension. More...
 
constexpr unsigned int dim () const
 Return dimension of the type. More...
 
constexpr unsigned int id () const
 Return the topology id of the type. More...
 
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. More...
 
constexpr bool operator!= (const GeometryType &other) const
 Check for inequality. More...
 
constexpr bool operator< (const GeometryType &other) const
 less-than operation for use with maps More...
 

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;

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

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

constexpr Dune::GeometryType::GeometryType ( )
inlineconstexpr

Default constructor, not initializing anything.

◆ GeometryType() [3/6]

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

Constructor, using the basic type and the dimension.

◆ GeometryType() [4/6]

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

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

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.

Member Function Documentation

◆ dim()

constexpr unsigned int Dune::GeometryType::dim ( ) const
inlineconstexpr

Return dimension of the type.

◆ DUNE_DEPRECATED_MSG() [1/13]

Dune::GeometryType::DUNE_DEPRECATED_MSG ( "GeometryType(dim) is deprecated in DUNE 2.  7,
please use Dune::GeometryTypes::cube(dim) instead"   
)
inline

Constructor for vertices and segments.

◆ DUNE_DEPRECATED_MSG() [2/13]

Dune::GeometryType::DUNE_DEPRECATED_MSG ( "GeometryType(unsigned dim) is deprecated in DUNE 2.  7,
please use Dune::GeometryTypes::cube(dim) instead"   
)
inline

Constructor for vertices and segments.

◆ DUNE_DEPRECATED_MSG() [3/13]

Dune::GeometryType::DUNE_DEPRECATED_MSG ( "makeCube(dim) is deprecated in DUNE 2.  6,
please use Dune::GeometryTypes::cube(dim) instead"   
)
inline

Make a hypercube of given dimension.

◆ DUNE_DEPRECATED_MSG() [4/13]

Dune::GeometryType::DUNE_DEPRECATED_MSG ( "makeHexahedron() is deprecated in DUNE 2.  6,
please use Dune::GeometryTypes::hexahedron instead"   
)
inline

Make a hexahedron.

◆ DUNE_DEPRECATED_MSG() [5/13]

Dune::GeometryType::DUNE_DEPRECATED_MSG ( "makeLine() is deprecated in DUNE 2.  6,
please use Dune::GeometryTypes::line instead"   
)
inline

Make a line segment.

◆ DUNE_DEPRECATED_MSG() [6/13]

Dune::GeometryType::DUNE_DEPRECATED_MSG ( "makeNone(dim) is deprecated in DUNE 2.  6,
please use Dune::GeometryTypes::none(dim) instead"   
)
inline

Make a singular of given dimension.

◆ DUNE_DEPRECATED_MSG() [7/13]

Dune::GeometryType::DUNE_DEPRECATED_MSG ( "makePrism() is deprecated in DUNE 2.  6,
please use Dune::GeometryTypes::prism instead"   
)
inline

Make a prism.

◆ DUNE_DEPRECATED_MSG() [8/13]

Dune::GeometryType::DUNE_DEPRECATED_MSG ( "makePyramid() is deprecated in DUNE 2.  6,
please use Dune::GeometryTypes::pyramid instead"   
)
inline

Make a pyramid.

◆ DUNE_DEPRECATED_MSG() [9/13]

Dune::GeometryType::DUNE_DEPRECATED_MSG ( "makeQuadrilateral() is deprecated in DUNE 2.  6,
please use Dune::GeometryTypes::quadrilateral instead"   
)
inline

Make a quadrilateral.

◆ DUNE_DEPRECATED_MSG() [10/13]

Dune::GeometryType::DUNE_DEPRECATED_MSG ( "makeSimplex(dim) is deprecated in DUNE 2.  6,
please use Dune::GeometryTypes::simplex(dim) instead"   
)
inline

Make a simplex of given dimension.

◆ DUNE_DEPRECATED_MSG() [11/13]

Dune::GeometryType::DUNE_DEPRECATED_MSG ( "makeTetrahedron() is deprecated in DUNE 2.  6,
please use Dune::GeometryTypes::tetrahedron instead"   
)
inline

Make a tetrahedron.

◆ DUNE_DEPRECATED_MSG() [12/13]

Dune::GeometryType::DUNE_DEPRECATED_MSG ( "makeTriangle() is deprecated in DUNE 2.  6,
please use Dune::GeometryTypes::triangle instead"   
)
inline

Make a triangle.

◆ DUNE_DEPRECATED_MSG() [13/13]

Dune::GeometryType::DUNE_DEPRECATED_MSG ( "makeVertex() is deprecated in DUNE 2.  6,
please use Dune::GeometryTypes::vertex instead"   
)
inline

Make a vertex.

◆ id()

constexpr unsigned int Dune::GeometryType::id ( ) const
inlineconstexpr

Return the topology id of the type.

◆ isCube()

constexpr bool Dune::GeometryType::isCube ( ) const
inlineconstexpr

Return true if entity is a cube of any dimension.

◆ isHexahedron()

constexpr bool Dune::GeometryType::isHexahedron ( ) const
inlineconstexpr

Return true if entity is a hexahedron.

◆ isLine()

constexpr bool Dune::GeometryType::isLine ( ) const
inlineconstexpr

Return true if entity is a line segment.

◆ isNone()

constexpr bool Dune::GeometryType::isNone ( ) const
inlineconstexpr

Return true if entity is a singular of any dimension.

◆ isPrism()

constexpr bool Dune::GeometryType::isPrism ( ) const
inlineconstexpr

Return true if entity is a prism.

◆ isPyramid()

constexpr bool Dune::GeometryType::isPyramid ( ) const
inlineconstexpr

Return true if entity is a pyramid.

◆ isQuadrilateral()

constexpr bool Dune::GeometryType::isQuadrilateral ( ) const
inlineconstexpr

Return true if entity is a quadrilateral.

◆ isSimplex()

constexpr bool Dune::GeometryType::isSimplex ( ) const
inlineconstexpr

Return true if entity is a simplex of any dimension.

◆ isTetrahedron()

constexpr bool Dune::GeometryType::isTetrahedron ( ) const
inlineconstexpr

Return true if entity is a tetrahedron.

◆ isTriangle()

constexpr bool Dune::GeometryType::isTriangle ( ) const
inlineconstexpr

Return true if entity is a triangle.

◆ isVertex()

constexpr bool Dune::GeometryType::isVertex ( ) const
inlineconstexpr

Return true if entity is a vertex.

◆ 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.

◆ 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

◆ operator!=()

constexpr bool Dune::GeometryType::operator!= ( const GeometryType other) const
inlineconstexpr

Check for inequality.

◆ operator<()

constexpr bool Dune::GeometryType::operator< ( const GeometryType other) const
inlineconstexpr

less-than operation for use with maps

◆ operator==()

constexpr bool Dune::GeometryType::operator== ( const GeometryType other) const
inlineconstexpr

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


The documentation for this class was generated from the following file:
Dune::GeometryType::GeometryType
constexpr GeometryType()
Default constructor, not initializing anything.
Definition: type.hh:380