5 #ifndef DUNE_GEOMETRY_REFERENCEELEMENTS_HH 6 #define DUNE_GEOMETRY_REFERENCEELEMENTS_HH 17 #include <dune/common/typetraits.hh> 18 #include <dune/common/std/type_traits.hh> 19 #include <dune/common/visibility.hh> 41 template<
class ctype,
int dim >
42 class ReferenceElementContainer
44 static const unsigned int numTopologies = dim >= 0 ? (1u << dim) : 0;
46 using Implementation = ReferenceElementImplementation< ctype, dim >;
52 using const_iterator =
const value_type*;
54 ReferenceElementContainer ()
56 for(
unsigned int topologyId = 0; topologyId < numTopologies; ++topologyId )
58 implementations_[ topologyId ].initialize( topologyId );
59 reference_elements_[ topologyId ].setImplementation( implementations_[ topologyId ] );
65 assert( type.dim() == dim );
66 return reference_elements_[ type.id() ];
89 const_iterator begin ()
const 91 return reference_elements_.data();
94 const_iterator end ()
const 96 return reference_elements_.data() + numTopologies;
101 std::array<Implementation,numTopologies> implementations_;
102 std::array<ReferenceElement,numTopologies> reference_elements_;
126 template<
class ctype_,
int dim >
127 struct ReferenceElements
141 using Container = Impl::ReferenceElementContainer< ctype, dim >;
149 using Iterator =
typename Container::const_iterator;
158 return container() ( type );
164 return container().simplex();
170 return container().cube();
175 return container().begin();
180 return container().end();
185 DUNE_EXPORT
static const Container& container ()
187 static Container container;
195 using Geo::ReferenceElements;
244 template<
typename... T>
264 template<
typename T,
int dim>
284 template<
typename T,
int dim, std::enable_if_t<IsNumber<std::decay_t<T>>::value,
int> = 0>
290 template<
typename... T>
295 #endif // #ifndef DUNE_GEOMETRY_REFERENCEELEMENTS_HH decltype(referenceElement(std::declval< T >()...)) ReferenceElement
Definition: referenceelements.hh:291
This class provides access to geometric and topological properties of a reference element...
Definition: affinegeometry.hh:31
constexpr GeometryType pyramid
GeometryType representing a 3D pyramid.
Definition: type.hh:522
Static tag representing a dimension.
Definition: dimension.hh:14
typename Container::const_iterator Iterator
Iterator over available reference elements.
Definition: referenceelements.hh:149
A unique label for each type of element that can occur in a grid.
ctype CoordinateField
The coordinate field type of the contained reference elements.
Definition: referenceelements.hh:134
static Iterator begin()
Definition: referenceelements.hh:173
ctype_ ctype
The coordinate field type of the contained reference elements.
Definition: referenceelements.hh:131
constexpr GeometryType cube(unsigned int dim)
Returns a GeometryType representing a hypercube of dimension dim.
Definition: type.hh:462
constexpr GeometryType simplex(unsigned int dim)
Returns a GeometryType representing a simplex of dimension dim.
Definition: type.hh:453
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:113
static constexpr int dimension
The dimension of the contained reference elements.
Definition: referenceelements.hh:137
static const ReferenceElement & general(const GeometryType &type)
get general reference elements
Definition: referenceelements.hh:156
constexpr unsigned int id() const
Return the topology id of the type.
Definition: type.hh:365
constexpr GeometryType prism
GeometryType representing a 3D prism.
Definition: type.hh:528
Iterator iterator
Iterator over available reference elements.
Definition: referenceelements.hh:152
typename Container::ReferenceElement ReferenceElement
The reference element type.
Definition: referenceelements.hh:146
static const ReferenceElement & simplex()
get simplex reference elements
Definition: referenceelements.hh:162
static Iterator end()
Definition: referenceelements.hh:178
static const ReferenceElement & cube()
get hypercube reference elements
Definition: referenceelements.hh:168
Definition: affinegeometry.hh:21
unspecified value type referenceElement(T &&... t)
Returns a reference element for the objects t....