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 = (1u << dim);
74 using Implementation = ReferenceElementImplementation< ctype, dim >;
75 using ConstructibleDeprecatedReferenceElement = Dune::Geo::ConstructibleDeprecatedReferenceElement<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() ];
102 return reference_elements_[ Dune::Impl::SimplexTopology< dim >::type::id ];
107 return reference_elements_[ Dune::Impl::CubeTopology< dim >::type::id ];
112 return reference_elements_[ Dune::Impl::PyramidTopology< dim >::type::id ];
117 return reference_elements_[ Dune::Impl::PrismTopology< dim >::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 >
167 struct ReferenceElements
177 static constexpr
int dimension = 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;
292 template<
typename... T>
312 template<
typename T,
int dim>
332 template<
typename T,
int dim>
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>
415 using ReferenceElement = unspecified-type;
433 struct ValidReferenceElementTypeSignature
439 struct DeprecatedReferenceElementTypeSignature
441 DUNE_DEPRECATED_MSG(
"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>,
494 template<
typename T,
int dim>
503 #endif // #ifndef DUNE_GEOMETRY_REFERENCEELEMENTS_HH ctype CoordinateField
The coordinate field type of the contained reference elements.
Definition: referenceelements.hh:174
static const ReferenceElement & general(const GeometryType &type)
get general reference elements
Definition: referenceelements.hh:196
typename Container::const_iterator Iterator
Iterator over available reference elements.
Definition: referenceelements.hh:189
typename Container::ReferenceElement ReferenceElement
The reference element type.
Definition: referenceelements.hh:186
constexpr GeometryType prism
GeometryType representing a 3D prism.
Definition: type.hh:763
Iterator iterator
Iterator over available reference elements.
Definition: referenceelements.hh:192
unspecified-type ReferenceElement
Returns the type of reference element for the argument types T...
Definition: referenceelements.hh:415
ctype_ ctype
The coordinate field type of the contained reference elements.
Definition: referenceelements.hh:171
Static tag representing a dimension.
Definition: dimension.hh:12
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:276
static Iterator begin()
Definition: referenceelements.hh:213
static const ReferenceElement & cube()
get hypercube reference elements
Definition: referenceelements.hh:208
Definition: referenceelement.hh:27
static Iterator end()
Definition: referenceelements.hh:218
A unique label for each type of element that can occur in a grid.
This class provides access to geometric and topological properties of a reference element...
Definition: affinegeometry.hh:28
unspecified-type ReferenceElement
Returns the type of reference element for the argument type T.
Definition: referenceelements.hh:495
static const ReferenceElement & simplex()
get simplex reference elements
Definition: referenceelements.hh:202
constexpr GeometryType pyramid
GeometryType representing a 3D pyramid.
Definition: type.hh:757
Class providing access to the singletons of the reference elements.
Definition: affinegeometry.hh:34
unspecified value type referenceElement(T &&... t)
Returns a reference element for the objects t....
Definition: affinegeometry.hh:18
constexpr GeometryType cube(unsigned int dim)
Returns a GeometryType representing a hypercube of dimension dim.
Definition: type.hh:705
constexpr GeometryType simplex(unsigned int dim)
Returns a GeometryType representing a simplex of dimension dim.
Definition: type.hh:696