dune-functions 2.10
Loading...
Searching...
No Matches
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
4// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
5// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
6
7#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACEBASIS_HH
8#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACEBASIS_HH
9
10#include <dune/common/reservedvector.hh>
11#include <dune/common/typeutilities.hh>
12#include <dune/common/concept.hh>
13
17
18
19
20namespace Dune {
21namespace Functions {
22
23
24
25namespace Impl {
26
27 template<class... Inner, class... Outer>
28 auto joinTreePaths(const TypeTree::HybridTreePath<Inner...>& inner, const TypeTree::HybridTreePath<Outer...> outer)
29 {
30 return TypeTree::HybridTreePath<Inner..., Outer...>(std::tuple_cat(inner._data, outer._data));
31 }
32
33 template<class InnerTP, class OuterTP>
34 using JoinTreePath_t = std::decay_t<decltype(joinTreePaths(std::declval<InnerTP>(), std::declval<OuterTP>()))>;
35
36}
37
38
39
40template<class RB, class TP>
42{
43public:
44
45 using RootBasis = RB;
46
47 using RootLocalView = typename RootBasis::LocalView;
48
49 using PrefixPath = TP;
50
52 using GridView = typename RootBasis::GridView;
53
55 using MultiIndex = typename RootBasis::MultiIndex;
56
57 using size_type = std::size_t;
58
61
62 using SizePrefix = typename RootBasis::SizePrefix;
63
64
70
76 template<class RootRootBasis, class InnerTP, class OuterTP>
80
81
84 const GridView& gridView() const
85 {
86 return rootBasis_->gridView();
87 }
88
93 {
94 return rootBasis_->dimension();
95 }
96
99 {
100 return rootBasis_->size();
101 }
102
104 size_type size(const SizePrefix& prefix) const
105 {
106 return rootBasis_->size(prefix);
107 }
108
113 {
114 return LocalView(*this, prefixPath_);
115 }
116
117 const RootBasis& rootBasis() const
118 {
119 return *rootBasis_;
120 }
121
122 const PrefixPath& prefixPath() const
123 {
124 return prefixPath_;
125 }
126
127protected:
130};
131
132
133// CTAD guide for a non-SubspaceBasis root basis
134template<class RB, class TP>
135SubspaceBasis(const RB&, const TP) -> SubspaceBasis<RB, TP>;
136
137// CTAD guide for a SubspaceBasis root basis
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>>;
141
142
143
154template<class RootBasis, class... PrefixTreeIndices>
155auto subspaceBasis(const RootBasis& rootBasis, const TypeTree::HybridTreePath<PrefixTreeIndices...>& prefixPath)
156{
157 return SubspaceBasis(rootBasis, prefixPath);
158}
159
160template<class RootBasis, class... PrefixTreeIndices>
161auto subspaceBasis(const RootBasis& rootBasis, const PrefixTreeIndices&... prefixTreeIndices)
162{
163 return subspaceBasis(rootBasis, TypeTree::hybridTreePath(prefixTreeIndices...));
164}
165
166
167
168} // end namespace Functions
169} // end namespace Dune
170
171
172
173#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_DEFAULTGLOBALBASIS_HH
Definition polynomial.hh:17
auto subspaceBasis(const RootBasis &rootBasis, const TypeTree::HybridTreePath< PrefixTreeIndices... > &prefixPath)
Create SubspaceBasis from a root basis and a prefixPath.
Definition subspacebasis.hh:155
Definition subspacebasis.hh:42
typename RootBasis::LocalView RootLocalView
Definition subspacebasis.hh:47
LocalView localView() const
Return local view for basis.
Definition subspacebasis.hh:112
const RootBasis * rootBasis_
Definition subspacebasis.hh:128
typename RootBasis::SizePrefix SizePrefix
Definition subspacebasis.hh:62
TP PrefixPath
Definition subspacebasis.hh:49
SubspaceLocalView< RootLocalView, PrefixPath > LocalView
Type of the local view on the restriction of the basis to a single element.
Definition subspacebasis.hh:60
size_type size(const SizePrefix &prefix) const
Return number possible values for next position in multi index.
Definition subspacebasis.hh:104
typename RootBasis::GridView GridView
The grid view that the FE space is defined on.
Definition subspacebasis.hh:52
const PrefixPath & prefixPath() const
Definition subspacebasis.hh:122
SubspaceBasis(const SubspaceBasis< RootRootBasis, InnerTP > &rootBasis, const OuterTP &prefixPath)
Constructor from another SubspaceBasis.
Definition subspacebasis.hh:77
const GridView & gridView() const
Obtain the grid view that the basis is defined on.
Definition subspacebasis.hh:84
RB RootBasis
Definition subspacebasis.hh:45
PrefixPath prefixPath_
Definition subspacebasis.hh:129
size_type size() const
Return number of possible values for next position in empty multi index.
Definition subspacebasis.hh:98
const RootBasis & rootBasis() const
Definition subspacebasis.hh:117
typename RootBasis::MultiIndex MultiIndex
Type used for global numbering of the basis vectors.
Definition subspacebasis.hh:55
size_type dimension() const
Definition subspacebasis.hh:92
std::size_t size_type
Definition subspacebasis.hh:57
SubspaceBasis(const RootBasis &rootBasis, const PrefixPath &prefixPath)
Constructor for a given grid view object.
Definition subspacebasis.hh:66
The restriction of a finite element basis to a single element.
Definition subspacelocalview.hh:34