3 #include <dune/common/version.hh> 4 #include <dune/functions/functionspacebases/basistags.hh> 5 #include <dune/functions/functionspacebases/compositebasis.hh> 6 #include <dune/functions/functionspacebases/lagrangebasis.hh> 7 #include <dune/functions/functionspacebases/powerbasis.hh> 8 #include <dune/functions/functionspacebases/flatmultiindex.hh> 10 #include <amdis/Output.hpp> 11 #include <amdis/common/TypeTraits.hpp> 12 #include <amdis/typetree/FiniteElementType.hpp> 18 template <
class PreBasis,
19 class MultiIndex = Dune::Functions::FlatMultiIndex<std::size_t>>
22 using type = PreBasis;
25 static type create(PB
const& preBasis)
27 return {preBasis.gridView()};
30 static PreBasis
const& create(PreBasis
const& preBasis)
36 template <
class PreBasis,
37 class MultiIndex = Dune::Functions::FlatMultiIndex<std::size_t>>
38 using FlatPreBasis_t =
typename FlatPreBasis<PreBasis, MultiIndex>::type;
40 template <
class PreBasis>
41 auto flatPreBasis(PreBasis
const& preBasis)
47 template <
class GV,
class MI,
class MultiIndex>
48 struct FlatPreBasis<Dune::Functions::LagrangePreBasis<GV,-1,MI>, MultiIndex>
50 using type = Dune::Functions::LagrangePreBasis<GV,-1,MultiIndex>;
53 static type create(PB
const& preBasis)
55 auto node = preBasis.makeNode();
56 node.bind(*preBasis.gridView().template begin<0>());
57 return {preBasis.gridView(), (
unsigned int)(node.finiteElement().localBasis().order())};
60 static type
const& create(type
const& preBasis)
70 template <
class PreBasis>
71 class DerivedPreBasis {
74 template <
class PB,
class SPB =
typename PB::SubPreBasis>
75 static SPB
const& subPreBasis(PB
const& pb)
77 return access(pb).subPreBasis_;
81 template <std::
size_t I,
class PB,
class SPB =
typename PB::
template SubPreBasis<I>>
82 static SPB
const& subPreBasis(PB
const& pb, Dune::index_constant<I>)
84 return std::get<I>(access(pb).subPreBases_);
88 class Accessor :
public T {
friend class DerivedPreBasis<PreBasis>; };
91 static Accessor<T>
const& access(T
const& obj) {
return static_cast<Accessor<T> const&
>(obj); }
94 template <
class PreBasis,
class... Index>
95 static auto const& subPreBasis(PreBasis
const& preBasis, Index... ii)
97 return DerivedPreBasis<PreBasis>::subPreBasis(preBasis,ii...);
104 template <
class MI,
class IMS,
class... SPB,
class MultiIndex>
105 struct FlatPreBasis<Dune::Functions::CompositePreBasis<MI, IMS, SPB...>, MultiIndex>
107 using FIMS = Dune::Functions::BasisFactory::FlatLexicographic;
108 using type = Dune::Functions::CompositePreBasis<MultiIndex, FIMS, FlatPreBasis_t<SPB, MultiIndex>...>;
110 template <
class PreBasis>
111 static type create(PreBasis
const& preBasis)
113 return create(preBasis, std::index_sequence_for<SPB...>{});
116 template <
class PreBasis, std::size_t... I>
117 static type create(PreBasis
const& preBasis, std::index_sequence<I...>)
119 test_warning(std::is_same_v<IMS,FIMS>,
"Basis converted into flat index-merging strategy.");
125 template <
class MI,
class IMS,
class SPB, std::
size_t C,
class MultiIndex>
126 struct FlatPreBasis<Dune::Functions::PowerPreBasis<MI, IMS, SPB, C>, MultiIndex>
128 using type = Dune::Functions::PowerPreBasis<MultiIndex, IMS, SPB, C>;
130 template <
class PreBasis>
131 static type create(PreBasis
const& preBasis)
138 template <
class MI,
class SPB, std::
size_t C,
class MultiIndex>
140 <MI, Dune::Functions::BasisFactory::BlockedInterleaved, SPB, C>, MultiIndex>
142 using FIMS = Dune::Functions::BasisFactory::FlatInterleaved;
143 using type = Dune::Functions::PowerPreBasis<MultiIndex, FIMS, FlatPreBasis_t<SPB, MultiIndex>, C>;
145 template <
class PreBasis>
146 static type create(PreBasis
const& preBasis)
148 warning(
"Basis converted into flat index-merging strategy.");
154 template <
class MI,
class SPB, std::
size_t C,
class MultiIndex>
156 <MI, Dune::Functions::BasisFactory::BlockedLexicographic, SPB, C>, MultiIndex>
158 using FIMS = Dune::Functions::BasisFactory::FlatLexicographic;
159 using type = Dune::Functions::PowerPreBasis<MultiIndex, FIMS, FlatPreBasis_t<SPB, MultiIndex>, C>;
161 template <
class PreBasis>
162 static type create(PreBasis
const& preBasis)
164 warning(
"Basis converted into flat index-merging strategy.");
constexpr bool MultiIndex
A multi-index type.
Definition: Concepts.hpp:150
Definition: AdaptBase.hpp:6
Definition: FlatPreBasis.hpp:20