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 >
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>
301 template<
typename... T>
302 struct DefaultReferenceElementExtractor;
304 template<typename T, typename std::enable_if<IsNumber<T>::value,
int>::type dim>
305 struct DefaultReferenceElementExtractor<T,Dim<dim>>
310 template<
typename... T>
311 using DefaultReferenceElement =
typename DefaultReferenceElementExtractor<T...>::type;
322 template<
typename... T>
323 using LookupReferenceElement =
decltype(
referenceElement(std::declval<T>()...));
327 namespace [[deprecated]] Transitional {
337 template<
typename... T>
339 Impl::DefaultReferenceElement,
340 LookupReferenceElement,
346 template<
typename... T>
A unique label for each type of element that can occur in a grid.
constexpr GeometryType cube(unsigned int dim)
Returns a GeometryType representing a hypercube of dimension dim.
Definition type.hh:462
constexpr GeometryType prism
GeometryType representing a 3D prism.
Definition type.hh:528
constexpr GeometryType pyramid
GeometryType representing a 3D pyramid.
Definition type.hh:522
constexpr GeometryType simplex(unsigned int dim)
Returns a GeometryType representing a simplex of dimension dim.
Definition type.hh:453
unspecified value type referenceElement(T &&... t)
Returns a reference element for the objects t....
Definition affinegeometry.hh:21
decltype(referenceElement(std::declval< T >()...)) ReferenceElement
Definition referenceelements.hh:347
detected_or_fallback_t< Impl::DefaultReferenceElement, LookupReferenceElement, T... > ReferenceElement
Definition referenceelements.hh:338
This class provides access to geometric and topological properties of a reference element.
Definition referenceelement.hh:52
Class providing access to the singletons of the reference elements.
Definition referenceelements.hh:128
static Iterator begin()
Definition referenceelements.hh:173
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 & cube()
get hypercube reference elements
Definition referenceelements.hh:168
static Iterator end()
Definition referenceelements.hh:178
ctype_ ctype
The coordinate field type of the contained reference elements.
Definition referenceelements.hh:131
static const ReferenceElement & general(const GeometryType &type)
get general reference elements
Definition referenceelements.hh:156
static const ReferenceElement & simplex()
get simplex reference elements
Definition referenceelements.hh:162
typename Container::const_iterator Iterator
Iterator over available reference elements.
Definition referenceelements.hh:149
static constexpr int dimension
The dimension of the contained reference elements.
Definition referenceelements.hh:137
ctype CoordinateField
The coordinate field type of the contained reference elements.
Definition referenceelements.hh:134
Static tag representing a dimension.
Definition dimension.hh:16
Unique label for each type of entities that can occur in DUNE grids.
Definition type.hh:114
constexpr unsigned int id() const
Return the topology id of the type.
Definition type.hh:365