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
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>
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 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>,
455 Impl::DeprecatedReferenceElementTypeSignature<Geo::DeprecatedReferenceElement<T,dim>>
494 template<
typename T,
int dim>
503 #endif // #ifndef DUNE_GEOMETRY_REFERENCEELEMENTS_HH