7#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACEBASIS_HH
8#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACEBASIS_HH
10#include <dune/common/reservedvector.hh>
11#include <dune/common/typeutilities.hh>
12#include <dune/common/concept.hh>
14#include <dune/functions/common/type_traits.hh>
15#include <dune/functions/functionspacebases/subspacelocalview.hh>
16#include <dune/functions/functionspacebases/concepts.hh>
27 template<
class... Inner,
class... Outer>
28 auto joinTreePaths(
const TypeTree::HybridTreePath<Inner...>& inner,
const TypeTree::HybridTreePath<Outer...> outer)
30 return TypeTree::HybridTreePath<Inner..., Outer...>(std::tuple_cat(inner._data, outer._data));
33 template<
class InnerTP,
class OuterTP>
34 using JoinTreePath_t = std::decay_t<decltype(joinTreePaths(std::declval<InnerTP>(), std::declval<OuterTP>()))>;
40template<
class RB,
class TP>
47 using RootLocalView =
typename RootBasis::LocalView;
49 using PrefixPath = TP;
52 using GridView =
typename RootBasis::GridView;
55 using MultiIndex =
typename RootBasis::MultiIndex;
57 using size_type = std::size_t;
60 using LocalView = SubspaceLocalView<RootLocalView, PrefixPath>;
62 using SizePrefix =
typename RootBasis::SizePrefix;
66 SubspaceBasis(
const RootBasis& rootBasis,
const PrefixPath& prefixPath) :
67 rootBasis_(&rootBasis),
68 prefixPath_(prefixPath)
76 template<
class RootRootBasis,
class InnerTP,
class OuterTP>
77 SubspaceBasis(
const SubspaceBasis<RootRootBasis, InnerTP>& rootBasis,
const OuterTP& prefixPath) :
78 SubspaceBasis(rootBasis.rootBasis(), Impl::joinTreePaths(rootBasis.prefixPath(), prefixPath))
84 const GridView& gridView()
const
86 return rootBasis_->gridView();
92 size_type dimension()
const
94 return rootBasis_->dimension();
98 size_type size()
const
100 return rootBasis_->size();
104 size_type size(
const SizePrefix& prefix)
const
106 return rootBasis_->size(prefix);
112 LocalView localView()
const
114 return LocalView(*
this, prefixPath_);
117 const RootBasis& rootBasis()
const
122 const PrefixPath& prefixPath()
const
128 const RootBasis* rootBasis_;
129 PrefixPath prefixPath_;
134template<
class RB,
class TP>
135SubspaceBasis(
const RB&,
const TP) -> SubspaceBasis<RB, TP>;
138template<
class RootRootBasis,
class InnerTP,
class OuterTP>
139SubspaceBasis(
const SubspaceBasis<RootRootBasis, InnerTP>& rootBasis,
const OuterTP& prefixPath)
140 -> SubspaceBasis<std::decay_t<
decltype(rootBasis.rootBasis())>, Impl::JoinTreePath_t<InnerTP, OuterTP>>;
154template<
class RootBasis,
class... PrefixTreeIndices>
155auto subspaceBasis(
const RootBasis& rootBasis,
const TypeTree::HybridTreePath<PrefixTreeIndices...>& prefixPath)
157 return SubspaceBasis(rootBasis, prefixPath);
160template<
class RootBasis,
class... PrefixTreeIndices>
161auto subspaceBasis(
const RootBasis& rootBasis,
const PrefixTreeIndices&... prefixTreeIndices)
163 return subspaceBasis(rootBasis, TypeTree::hybridTreePath(prefixTreeIndices...));
Definition: polynomial.hh:17