DUNE PDELab (git)

subspacelocalview.hh
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_SUBSPACELOCALVIEW_HH
8#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACELOCALVIEW_HH
9
10
11#include <tuple>
12
14
15#include <dune/typetree/childextraction.hh>
16
17#include <dune/functions/functionspacebases/concepts.hh>
18
19
20
21namespace Dune {
22namespace Functions {
23
24
25
26template<class RB, class PP>
27class SubspaceBasis;
28
29
30
32template<class RLV, class PP>
34{
35 using PrefixPath = PP;
36
37public:
38
39 using RootLocalView = RLV;
40
42 using GlobalBasis = SubspaceBasis<typename RootLocalView::GlobalBasis, PrefixPath>;
43
45 using GridView = typename GlobalBasis::GridView;
46
48 using Element = typename GridView::template Codim<0>::Entity;
49
51 using size_type = std::size_t;
52
54 using RootTree = typename RootLocalView::Tree;
55
58
60 using MultiIndex = typename RootLocalView::MultiIndex;
61
63 SubspaceLocalView(const GlobalBasis& globalBasis, const PrefixPath& /*prefixPath*/) :
64 globalBasis_(&globalBasis),
65 rootLocalView_(globalBasis.rootBasis().localView())
66 {
67// static_assert(models<Concept::BasisTree<GridView>, Tree>(), "Tree type passed to SubspaceLocalView does not model the BasisNode concept.");
68 }
69
75 void bind(const Element& e)
76 {
77 rootLocalView_.bind(e);
78 }
79
84 const Element& element() const
85 {
86 return rootLocalView_.element();
87 }
88
93 void unbind()
94 {
95 rootLocalView_.unbind();
96 }
97
100 bool bound() const
101 {
102 return rootLocalView_.bound();
103 }
104
109 const Tree& tree() const
110 {
111 return TypeTree::child(rootLocalView_.tree(), globalBasis_->prefixPath());
112 }
113
117 {
118 return rootLocalView_.size();
119 }
120
128 {
129 return rootLocalView_.maxSize();
130 }
131
134 {
135 return rootLocalView_.index(i);
136 }
137
141 {
142 return *globalBasis_;
143 }
144
145 const RootLocalView& rootLocalView() const
146 {
147 return rootLocalView_;
148 }
149
150protected:
151 const GlobalBasis* globalBasis_;
152 RootLocalView rootLocalView_;
153};
154
155
156
157} // end namespace Functions
158} // end namespace Dune
159
160
161
162#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACELOCALVIEW_HH
The restriction of a finite element basis to a single element.
Definition: subspacelocalview.hh:34
typename TypeTree::ChildForTreePath< RootTree, PrefixPath > Tree
Tree of local finite elements / local shape function sets.
Definition: subspacelocalview.hh:57
void unbind()
Unbind from the current element.
Definition: subspacelocalview.hh:93
const Element & element() const
Return the grid element that the view is bound to.
Definition: subspacelocalview.hh:84
bool bound() const
Return if the view is bound to a grid element.
Definition: subspacelocalview.hh:100
typename RootLocalView::MultiIndex MultiIndex
Type used for global numbering of the basis vectors.
Definition: subspacelocalview.hh:60
SubspaceBasis< typename RootLocalView::GlobalBasis, PrefixPath > GlobalBasis
The global FE basis that this is a view on.
Definition: subspacelocalview.hh:42
size_type size() const
Total number of degrees of freedom on this element.
Definition: subspacelocalview.hh:116
void bind(const Element &e)
Bind the view to a grid element.
Definition: subspacelocalview.hh:75
typename GlobalBasis::GridView GridView
The grid view the global FE basis lives on.
Definition: subspacelocalview.hh:45
SubspaceLocalView(const GlobalBasis &globalBasis, const PrefixPath &)
Construct local view for a given global finite element basis.
Definition: subspacelocalview.hh:63
std::size_t size_type
The type used for sizes.
Definition: subspacelocalview.hh:51
typename GridView::template Codim< 0 >::Entity Element
Type of the grid element we are bound to.
Definition: subspacelocalview.hh:48
const GlobalBasis & globalBasis() const
Return the global basis that we are a view on.
Definition: subspacelocalview.hh:140
size_type maxSize() const
Maximum local size for any element on the GridView.
Definition: subspacelocalview.hh:127
const Tree & tree() const
Return the local ansatz tree associated to the bound entity.
Definition: subspacelocalview.hh:109
MultiIndex index(size_type i) const
Maps from subtree index set [0..size-1] to a globally unique multi index in global basis.
Definition: subspacelocalview.hh:133
typename RootLocalView::Tree RootTree
Tree of local finite elements / local shape function sets.
Definition: subspacelocalview.hh:54
Infrastructure for concepts.
ImplementationDefined child(Node &&node, Indices... indices)
Extracts the child of a node given by a sequence of compile-time and run-time indices.
Definition: childextraction.hh:128
typename impl::_ChildForTreePath< Node, TreePath >::type ChildForTreePath
Template alias for the type of a child node given by a TreePath or a HybridTreePath type.
Definition: childextraction.hh:252
Dune namespace.
Definition: alignedallocator.hh:13
Static tag representing a codimension.
Definition: dimension.hh:24
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)