Dune Core Modules (2.8.0)

subspacebasis.hh
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
9
10#include <dune/functions/common/type_traits.hh>
11#include <dune/functions/functionspacebases/subspacelocalview.hh>
12#include <dune/functions/functionspacebases/concepts.hh>
13
14
15
16namespace Dune {
17namespace Functions {
18
19
20
21template<class RB, class TP>
22class SubspaceBasis
23{
24public:
25
26 using RootBasis = RB;
27
28 using RootLocalView = typename RootBasis::LocalView;
29
30 using PrefixPath = TP;
31
33 using GridView = typename RootBasis::GridView;
34
36 using MultiIndex = typename RootBasis::MultiIndex;
37
38 using size_type = std::size_t;
39
41 using LocalView = SubspaceLocalView<RootLocalView, PrefixPath>;
42
43 using SizePrefix = typename RootBasis::SizePrefix;
44
45
47 SubspaceBasis(const RootBasis& rootBasis, const PrefixPath& prefixPath) :
48 rootBasis_(&rootBasis),
49 prefixPath_(prefixPath)
50 {
51// static_assert(models<Concept::NodeFactory<GridView>, NodeFactory>(), "Type passed to DefaultGlobalBasis does not model the NodeFactory concept.");
52 }
53
56 const GridView& gridView() const
57 {
58 return rootBasis_->gridView();
59 }
60
64 size_type dimension() const
65 {
66 return rootBasis_->dimension();
67 }
68
70 size_type size() const
71 {
72 return rootBasis_->size();
73 }
74
76 size_type size(const SizePrefix& prefix) const
77 {
78 return rootBasis_->size(prefix);
79 }
80
84 LocalView localView() const
85 {
86 return LocalView(*this, prefixPath_);
87 }
88
89 const RootBasis& rootBasis() const
90 {
91 return *rootBasis_;
92 }
93
94 const PrefixPath& prefixPath() const
95 {
96 return prefixPath_;
97 }
98
99protected:
100 const RootBasis* rootBasis_;
101 PrefixPath prefixPath_;
102};
103
104
105template<class RootBasis, class... PrefixTreeIndices>
106auto subspaceBasis(const RootBasis& rootBasis, const TypeTree::HybridTreePath<PrefixTreeIndices...>& prefixPath)
107{
108 using PrefixPath = TypeTree::HybridTreePath<PrefixTreeIndices...>;
109 return SubspaceBasis<RootBasis, PrefixPath>{rootBasis, prefixPath};
110}
111
112template<class RootBasis, class... PrefixTreeIndices>
113auto subspaceBasis(const RootBasis& rootBasis, const PrefixTreeIndices&... prefixTreeIndices)
114{
115 return subspaceBasis(rootBasis, TypeTree::hybridTreePath(prefixTreeIndices...));
116}
117
118
119
120} // end namespace Functions
121} // end namespace Dune
122
123
124
125#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_DEFAULTGLOBALBASIS_HH
Infrastructure for concepts.
constexpr HybridTreePath< T... > hybridTreePath(const T &... t)
Constructs a new HybridTreePath from the given indices.
Definition: treepath.hh:177
Dune namespace.
Definition: alignedallocator.hh:11
An stl-compliant random-access container which stores everything on the stack.
Utilities for type computations, constraining overloads, ...
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 22, 23:30, 2024)