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 R,
class MultiIndex>
48 struct FlatPreBasis<Dune::Functions::LagrangePreBasis<GV,-1,MI,R>, MultiIndex>
50 using type = Dune::Functions::LagrangePreBasis<GV,-1,
MultiIndex,R>;
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)
68 template <
class PreBasis,
class... Index>
69 static auto const& subPreBasis(PreBasis
const& preBasis, Index... ii)
71 return preBasis.subPreBasis(ii...);
78 template <
class MI,
class IMS,
class... SPB,
class MultiIndex>
79 struct FlatPreBasis<Dune::Functions::CompositePreBasis<MI, IMS, SPB...>, MultiIndex>
81 using FIMS = Dune::Functions::BasisFactory::FlatLexicographic;
82 using type = Dune::Functions::CompositePreBasis<MultiIndex, FIMS, FlatPreBasis_t<SPB, MultiIndex>...>;
84 template <
class PreBasis>
85 static type create(PreBasis
const& preBasis)
87 return create(preBasis, std::index_sequence_for<SPB...>{});
90 template <
class PreBasis, std::size_t... I>
91 static type create(PreBasis
const& preBasis, std::index_sequence<I...>)
93 test_warning(std::is_same_v<IMS,FIMS>,
"Basis converted into flat index-merging strategy.");
99 template <
class MI,
class IMS,
class SPB, std::
size_t C,
class MultiIndex>
100 struct FlatPreBasis<Dune::Functions::PowerPreBasis<MI, IMS, SPB, C>, MultiIndex>
102 using type = Dune::Functions::PowerPreBasis<MultiIndex, IMS, SPB, C>;
104 template <
class PreBasis>
105 static type create(PreBasis
const& preBasis)
112 template <
class MI,
class SPB, std::
size_t C,
class MultiIndex>
114 <MI, Dune::Functions::BasisFactory::BlockedInterleaved, SPB, C>, MultiIndex>
116 using FIMS = Dune::Functions::BasisFactory::FlatInterleaved;
117 using type = Dune::Functions::PowerPreBasis<MultiIndex, FIMS, FlatPreBasis_t<SPB, MultiIndex>, C>;
119 template <
class PreBasis>
120 static type create(PreBasis
const& preBasis)
122 warning(
"Basis converted into flat index-merging strategy.");
128 template <
class MI,
class SPB, std::
size_t C,
class MultiIndex>
130 <MI, Dune::Functions::BasisFactory::BlockedLexicographic, SPB, C>, MultiIndex>
132 using FIMS = Dune::Functions::BasisFactory::FlatLexicographic;
133 using type = Dune::Functions::PowerPreBasis<MultiIndex, FIMS, FlatPreBasis_t<SPB, MultiIndex>, C>;
135 template <
class PreBasis>
136 static type create(PreBasis
const& preBasis)
138 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