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>
35 template<
typename ctype,
int dim>
36 class DeprecatedReferenceElement
42 DeprecatedReferenceElement() =
default;
46 DeprecatedReferenceElement(
const DeprecatedReferenceElement&) =
delete;
47 DeprecatedReferenceElement& operator=(
const DeprecatedReferenceElement&) =
delete;
49 DeprecatedReferenceElement(
const ReferenceElementImplementation<ctype,dim>& impl)
56 template<
typename ctype,
int dim>
57 class ConstructibleDeprecatedReferenceElement
58 :
public DeprecatedReferenceElement<ctype,dim>
61 ConstructibleDeprecatedReferenceElement() =
default;
71 template<
class ctype,
int dim >
72 class ReferenceElementContainer
74 static const unsigned int numTopologies = dim >= 0 ? (1u << dim) : 0;
76 using Implementation = ReferenceElementImplementation< ctype, dim >;
77 using ConstructibleDeprecatedReferenceElement = Dune::Geo::ConstructibleDeprecatedReferenceElement<ctype,dim>;
81 using DeprecatedReferenceElement = Dune::Geo::DeprecatedReferenceElement<ctype,dim>;
85 using const_iterator =
const value_type*;
87 ReferenceElementContainer ()
89 for(
unsigned int topologyId = 0; topologyId < numTopologies; ++topologyId )
91 implementations_[ topologyId ].initialize( topologyId );
92 reference_elements_[ topologyId ].setImplementation( implementations_[ topologyId ] );
98 assert( type.dim() == dim );
99 return reference_elements_[ type.id() ];
122 const_iterator begin ()
const
124 return reference_elements_.data();
127 const_iterator end ()
const
129 return reference_elements_.data() + numTopologies;
136 const DeprecatedReferenceElement& deprecated(
const ReferenceElement& v)
const
138 return reference_elements_[v.impl().type(0,0).id()];
143 std::array<Implementation,numTopologies> implementations_;
144 std::array<ConstructibleDeprecatedReferenceElement,numTopologies> reference_elements_;
168 template<
class ctype_,
int dim >
183 using Container = Impl::ReferenceElementContainer< ctype, dim >;
191 using Iterator =
typename Container::const_iterator;
200 return container() ( type );
206 return container().simplex();
212 return container().cube();
217 return container().begin();
222 return container().end();
226 static const typename Container::DeprecatedReferenceElement&
229 return container().deprecated(v);
235 DUNE_EXPORT
static const Container& container ()
237 static Container container;
245 using Geo::ReferenceElements;
294 template<
typename... T>
314 template<
typename T,
int dim>
334 template<
typename T,
int dim, std::enable_if_t<IsNumber<std::decay_t<T>>::value,
int> = 0>
350 template<
typename... T>
351 struct DefaultReferenceElementExtractor;
353 template<typename T, typename std::enable_if<IsNumber<T>::value,
int>::type dim>
354 struct DefaultReferenceElementExtractor<T,Dim<dim>>
359 template<
typename... T>
360 using DefaultReferenceElement =
typename DefaultReferenceElementExtractor<T...>::type;
371 template<
typename... T>
372 using LookupReferenceElement =
decltype(
referenceElement(std::declval<T>()...));
376 namespace Transitional {
384 template<
typename... T>
386 Std::detected_t<LookupReferenceElement,T...>,
387 Impl::DefaultReferenceElement,
416 template<
typename... T>
435 struct ValidReferenceElementTypeSignature
441 struct DeprecatedReferenceElementTypeSignature
443 [[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();
451 template<
typename T,
int dim = -1>
454 typename std::conditional<
456 Impl::ValidReferenceElementTypeSignature<T>,
457 Impl::DeprecatedReferenceElementTypeSignature<Geo::DeprecatedReferenceElement<T,dim>>
496 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:473
constexpr GeometryType prism
GeometryType representing a 3D prism.
Definition type.hh:543
constexpr GeometryType pyramid
GeometryType representing a 3D pyramid.
Definition type.hh:537
constexpr GeometryType simplex(unsigned int dim)
Returns a GeometryType representing a simplex of dimension dim.
Definition type.hh:464
unspecified-type ReferenceElement
Returns the type of reference element for the argument type T.
Definition referenceelements.hh:497
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 types T...
Definition referenceelements.hh:417
Definition affinegeometry.hh:21
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:170
static Iterator begin()
Definition referenceelements.hh:215
Iterator iterator
Iterator over available reference elements.
Definition referenceelements.hh:194
typename Container::ReferenceElement ReferenceElement
The reference element type.
Definition referenceelements.hh:188
static const ReferenceElement & cube()
get hypercube reference elements
Definition referenceelements.hh:210
static Iterator end()
Definition referenceelements.hh:220
ctype_ ctype
The coordinate field type of the contained reference elements.
Definition referenceelements.hh:173
static const ReferenceElement & general(const GeometryType &type)
get general reference elements
Definition referenceelements.hh:198
static const ReferenceElement & simplex()
get simplex reference elements
Definition referenceelements.hh:204
typename Container::const_iterator Iterator
Iterator over available reference elements.
Definition referenceelements.hh:191
static constexpr int dimension
The dimension of the contained reference elements.
Definition referenceelements.hh:179
ctype CoordinateField
The coordinate field type of the contained reference elements.
Definition referenceelements.hh:176
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:126
constexpr unsigned int id() const
Return the topology id of the type.
Definition type.hh:377