3#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACEBASIS_HH
4#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACEBASIS_HH
10#include <dune/functions/common/type_traits.hh>
11#include <dune/functions/functionspacebases/subspacelocalview.hh>
12#include <dune/functions/functionspacebases/concepts.hh>
23 template<
class... Inner,
class... Outer>
24 auto joinTreePaths(
const TypeTree::HybridTreePath<Inner...>& inner,
const TypeTree::HybridTreePath<Outer...> outer)
26 return TypeTree::HybridTreePath<Inner..., Outer...>(std::tuple_cat(inner._data, outer._data));
29 template<
class InnerTP,
class OuterTP>
30 using JoinTreePath_t = std::decay_t<decltype(joinTreePaths(std::declval<InnerTP>(), std::declval<OuterTP>()))>;
36template<
class RB,
class TP>
43 using RootLocalView =
typename RootBasis::LocalView;
45 using PrefixPath = TP;
48 using GridView =
typename RootBasis::GridView;
51 using MultiIndex =
typename RootBasis::MultiIndex;
53 using size_type = std::size_t;
56 using LocalView = SubspaceLocalView<RootLocalView, PrefixPath>;
58 using SizePrefix =
typename RootBasis::SizePrefix;
62 SubspaceBasis(
const RootBasis& rootBasis,
const PrefixPath& prefixPath) :
63 rootBasis_(&rootBasis),
64 prefixPath_(prefixPath)
72 template<
class RootRootBasis,
class InnerTP,
class OuterTP>
73 SubspaceBasis(
const SubspaceBasis<RootRootBasis, InnerTP>& rootBasis,
const OuterTP& prefixPath) :
74 SubspaceBasis(rootBasis.rootBasis(), Impl::joinTreePaths(rootBasis.prefixPath(), prefixPath))
80 const GridView& gridView()
const
82 return rootBasis_->gridView();
88 size_type dimension()
const
90 return rootBasis_->dimension();
94 size_type size()
const
96 return rootBasis_->size();
100 size_type size(
const SizePrefix& prefix)
const
102 return rootBasis_->size(prefix);
108 LocalView localView()
const
110 return LocalView(*
this, prefixPath_);
113 const RootBasis& rootBasis()
const
118 const PrefixPath& prefixPath()
const
124 const RootBasis* rootBasis_;
125 PrefixPath prefixPath_;
130template<
class RB,
class TP>
131SubspaceBasis(
const RB&,
const TP) -> SubspaceBasis<RB, TP>;
134template<
class RootRootBasis,
class InnerTP,
class OuterTP>
135SubspaceBasis(
const SubspaceBasis<RootRootBasis, InnerTP>& rootBasis,
const OuterTP& prefixPath)
136 -> SubspaceBasis<std::decay_t<
decltype(rootBasis.rootBasis())>, Impl::JoinTreePath_t<InnerTP, OuterTP>>;
150template<
class RootBasis,
class... PrefixTreeIndices>
151auto subspaceBasis(
const RootBasis& rootBasis,
const TypeTree::HybridTreePath<PrefixTreeIndices...>& prefixPath)
153 return SubspaceBasis(rootBasis, prefixPath);
156template<
class RootBasis,
class... PrefixTreeIndices>
157auto subspaceBasis(
const RootBasis& rootBasis,
const PrefixTreeIndices&... prefixTreeIndices)
Infrastructure for concepts.
constexpr HybridTreePath< T... > hybridTreePath(const T &... t)
Constructs a new HybridTreePath from the given indices.
Definition: treepath.hh:180
Dune namespace.
Definition: alignedallocator.hh:13
An stl-compliant random-access container which stores everything on the stack.
Utilities for type computations, constraining overloads, ...