dune-functions 2.9.0
subspacebasis.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACEBASIS_HH
4#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACEBASIS_HH
5
6#include <dune/common/reservedvector.hh>
7#include <dune/common/typeutilities.hh>
8#include <dune/common/concept.hh>
9
13
14
15
16namespace Dune {
17namespace Functions {
18
19
20
21namespace Impl {
22
23 template<class... Inner, class... Outer>
24 auto joinTreePaths(const TypeTree::HybridTreePath<Inner...>& inner, const TypeTree::HybridTreePath<Outer...> outer)
25 {
26 return TypeTree::HybridTreePath<Inner..., Outer...>(std::tuple_cat(inner._data, outer._data));
27 }
28
29 template<class InnerTP, class OuterTP>
30 using JoinTreePath_t = std::decay_t<decltype(joinTreePaths(std::declval<InnerTP>(), std::declval<OuterTP>()))>;
31
32}
33
34
35
36template<class RB, class TP>
38{
39public:
40
41 using RootBasis = RB;
42
43 using RootLocalView = typename RootBasis::LocalView;
44
45 using PrefixPath = TP;
46
48 using GridView = typename RootBasis::GridView;
49
51 using MultiIndex = typename RootBasis::MultiIndex;
52
53 using size_type = std::size_t;
54
57
58 using SizePrefix = typename RootBasis::SizePrefix;
59
60
65 {}
66
72 template<class RootRootBasis, class InnerTP, class OuterTP>
75 {}
76
77
80 const GridView& gridView() const
81 {
82 return rootBasis_->gridView();
83 }
84
89 {
90 return rootBasis_->dimension();
91 }
92
95 {
96 return rootBasis_->size();
97 }
98
100 size_type size(const SizePrefix& prefix) const
101 {
102 return rootBasis_->size(prefix);
103 }
104
109 {
110 return LocalView(*this, prefixPath_);
111 }
112
113 const RootBasis& rootBasis() const
114 {
115 return *rootBasis_;
116 }
117
118 const PrefixPath& prefixPath() const
119 {
120 return prefixPath_;
121 }
122
123protected:
126};
127
128
129// CTAD guide for a non-SubspaceBasis root basis
130template<class RB, class TP>
131SubspaceBasis(const RB&, const TP) -> SubspaceBasis<RB, TP>;
132
133// CTAD guide for a SubspaceBasis root basis
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>>;
137
138
139
150template<class RootBasis, class... PrefixTreeIndices>
151auto subspaceBasis(const RootBasis& rootBasis, const TypeTree::HybridTreePath<PrefixTreeIndices...>& prefixPath)
152{
153 return SubspaceBasis(rootBasis, prefixPath);
154}
155
156template<class RootBasis, class... PrefixTreeIndices>
157auto subspaceBasis(const RootBasis& rootBasis, const PrefixTreeIndices&... prefixTreeIndices)
158{
159 return subspaceBasis(rootBasis, TypeTree::hybridTreePath(prefixTreeIndices...));
160}
161
162
163
164} // end namespace Functions
165} // end namespace Dune
166
167
168
169#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_DEFAULTGLOBALBASIS_HH
Definition: polynomial.hh:10
SubspaceBasis(const RB &, const TP) -> SubspaceBasis< RB, TP >
auto subspaceBasis(const RootBasis &rootBasis, const TypeTree::HybridTreePath< PrefixTreeIndices... > &prefixPath)
Create SubspaceBasis from a root basis and a prefixPath.
Definition: subspacebasis.hh:151
Definition: subspacebasis.hh:38
typename RootBasis::LocalView RootLocalView
Definition: subspacebasis.hh:43
LocalView localView() const
Return local view for basis.
Definition: subspacebasis.hh:108
const RootBasis * rootBasis_
Definition: subspacebasis.hh:124
typename RootBasis::SizePrefix SizePrefix
Definition: subspacebasis.hh:58
TP PrefixPath
Definition: subspacebasis.hh:45
SubspaceLocalView< RootLocalView, PrefixPath > LocalView
Type of the local view on the restriction of the basis to a single element.
Definition: subspacebasis.hh:56
size_type size(const SizePrefix &prefix) const
Return number possible values for next position in multi index.
Definition: subspacebasis.hh:100
typename RootBasis::GridView GridView
The grid view that the FE space is defined on.
Definition: subspacebasis.hh:48
const PrefixPath & prefixPath() const
Definition: subspacebasis.hh:118
SubspaceBasis(const SubspaceBasis< RootRootBasis, InnerTP > &rootBasis, const OuterTP &prefixPath)
Constructor from another SubspaceBasis.
Definition: subspacebasis.hh:73
const GridView & gridView() const
Obtain the grid view that the basis is defined on.
Definition: subspacebasis.hh:80
RB RootBasis
Definition: subspacebasis.hh:41
PrefixPath prefixPath_
Definition: subspacebasis.hh:125
size_type size() const
Return number of possible values for next position in empty multi index.
Definition: subspacebasis.hh:94
const RootBasis & rootBasis() const
Definition: subspacebasis.hh:113
typename RootBasis::MultiIndex MultiIndex
Type used for global numbering of the basis vectors.
Definition: subspacebasis.hh:51
size_type dimension() const
Definition: subspacebasis.hh:88
std::size_t size_type
Definition: subspacebasis.hh:53
SubspaceBasis(const RootBasis &rootBasis, const PrefixPath &prefixPath)
Constructor for a given grid view object.
Definition: subspacebasis.hh:62
The restriction of a finite element basis to a single element.
Definition: subspacelocalview.hh:30