3 #ifndef DUNE_GEOMETRY_REFERENCEELEMENTS_HH
4 #define DUNE_GEOMETRY_REFERENCEELEMENTS_HH
15 #include <dune/common/typetraits.hh>
16 #include <dune/common/std/type_traits.hh>
17 #include <dune/common/visibility.hh>
33 template<
typename ctype,
int dim>
34 class DeprecatedReferenceElement
40 DeprecatedReferenceElement() =
default;
44 DeprecatedReferenceElement(
const DeprecatedReferenceElement&) =
delete;
45 DeprecatedReferenceElement& operator=(
const DeprecatedReferenceElement&) =
delete;
47 DeprecatedReferenceElement(
const ReferenceElementImplementation<ctype,dim>& impl)
54 template<
typename ctype,
int dim>
55 class ConstructibleDeprecatedReferenceElement
56 :
public DeprecatedReferenceElement<ctype,dim>
59 ConstructibleDeprecatedReferenceElement() =
default;
69 template<
class ctype,
int dim >
70 class ReferenceElementContainer
72 static const unsigned int numTopologies = dim >= 0 ? (1u << dim) : 0;
74 using Implementation = ReferenceElementImplementation< ctype, dim >;
75 using ConstructibleDeprecatedReferenceElement = Dune::Geo::ConstructibleDeprecatedReferenceElement<ctype,dim>;
79 using DeprecatedReferenceElement = Dune::Geo::DeprecatedReferenceElement<ctype,dim>;
83 using const_iterator =
const value_type*;
85 ReferenceElementContainer ()
87 for(
unsigned int topologyId = 0; topologyId < numTopologies; ++topologyId )
89 implementations_[ topologyId ].initialize( topologyId );
90 reference_elements_[ topologyId ].setImplementation( implementations_[ topologyId ] );
96 assert( type.dim() == dim );
97 return reference_elements_[ type.id() ];
120 const_iterator begin ()
const
122 return reference_elements_.data();
125 const_iterator end ()
const
127 return reference_elements_.data() + numTopologies;
134 const DeprecatedReferenceElement& deprecated(
const ReferenceElement& v)
const
136 return reference_elements_[v.impl().type(0,0).id()];
141 std::array<Implementation,numTopologies> implementations_;
142 std::array<ConstructibleDeprecatedReferenceElement,numTopologies> reference_elements_;
166 template<
class ctype_,
int dim >
181 using Container = Impl::ReferenceElementContainer< ctype, dim >;
189 using Iterator =
typename Container::const_iterator;
198 return container() ( type );
204 return container().simplex();
210 return container().cube();
215 return container().begin();
220 return container().end();
224 static const typename Container::DeprecatedReferenceElement&
227 return container().deprecated(v);
233 DUNE_EXPORT
static const Container& container ()
235 static Container container;
243 using Geo::ReferenceElements;
292 template<
typename... T>
312 template<
typename T,
int dim>
332 template<
typename T,
int dim, std::enable_if_t<IsNumber<std::decay_t<T>>::value,
int> = 0>
348 template<
typename... T>
349 struct DefaultReferenceElementExtractor;
351 template<typename T, typename std::enable_if<IsNumber<T>::value,
int>::type dim>
352 struct DefaultReferenceElementExtractor<T,Dim<dim>>
357 template<
typename... T>
358 using DefaultReferenceElement =
typename DefaultReferenceElementExtractor<T...>::type;
369 template<
typename... T>
370 using LookupReferenceElement = decltype(
referenceElement(std::declval<T>()...));
374 namespace Transitional {
382 template<
typename... T>
384 Std::detected_t<LookupReferenceElement,T...>,
385 Impl::DefaultReferenceElement,
414 template<
typename... T>
433 struct ValidReferenceElementTypeSignature
439 struct DeprecatedReferenceElementTypeSignature
441 [[deprecated(
"Dune::ReferenceElement<T,int> is deprecated, please use Dune::ReferenceElement<Geometry> (if you have a geometry), Dune::ReferenceElements<T,int>::ReferenceElement or Dune::Transitional::ReferenceElement<T,Dune::Dim<int>> instead. After Dune 2.6, you will be able to use Dune::ReferenceElement<T,Dune::Dim<int>>.")]] T check();
449 template<
typename T,
int dim = -1>
452 typename std::conditional<
454 Impl::ValidReferenceElementTypeSignature<T>,
455 Impl::DeprecatedReferenceElementTypeSignature<Geo::DeprecatedReferenceElement<T,dim>>
494 template<
typename T,
int dim>
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:470
constexpr GeometryType prism
GeometryType representing a 3D prism.
Definition: type.hh:540
constexpr GeometryType pyramid
GeometryType representing a 3D pyramid.
Definition: type.hh:534
constexpr GeometryType simplex(unsigned int dim)
Returns a GeometryType representing a simplex of dimension dim.
Definition: type.hh:461
unspecified-type ReferenceElement
Returns the type of reference element for the argument types T...
Definition: referenceelements.hh:415
unspecified value type referenceElement(T &&... t)
Returns a reference element for the objects t....
unspecified-type ReferenceElement
Returns the type of reference element for the argument type T.
Definition: referenceelements.hh:495
Definition: affinegeometry.hh:19
This class provides access to geometric and topological properties of a reference element.
Definition: referenceelement.hh:25
Class providing access to the singletons of the reference elements.
Definition: referenceelements.hh:168
static Iterator begin()
Definition: referenceelements.hh:213
Iterator iterator
Iterator over available reference elements.
Definition: referenceelements.hh:192
typename Container::ReferenceElement ReferenceElement
The reference element type.
Definition: referenceelements.hh:186
static const ReferenceElement & general(const GeometryType &type)
get general reference elements
Definition: referenceelements.hh:196
static const ReferenceElement & simplex()
get simplex reference elements
Definition: referenceelements.hh:202
static const ReferenceElement & cube()
get hypercube reference elements
Definition: referenceelements.hh:208
static Iterator end()
Definition: referenceelements.hh:218
ctype_ ctype
The coordinate field type of the contained reference elements.
Definition: referenceelements.hh:171
typename Container::const_iterator Iterator
Iterator over available reference elements.
Definition: referenceelements.hh:189
static constexpr int dimension
The dimension of the contained reference elements.
Definition: referenceelements.hh:177
ctype CoordinateField
The coordinate field type of the contained reference elements.
Definition: referenceelements.hh:174
Static tag representing a dimension.
Definition: dimension.hh:14
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:123
constexpr unsigned int id() const
Return the topology id of the type.
Definition: type.hh:374