dune-functions  2.5.0
subspacelocalview.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_SUBSPACELOCALVIEW_HH
4 #define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACELOCALVIEW_HH
5 
6 
7 #include <tuple>
8 
9 #include <dune/common/concept.hh>
10 
11 #include <dune/typetree/childextraction.hh>
12 
14 
15 
16 
17 namespace Dune {
18 namespace Functions {
19 
20 
21 
22 template<class RB, class PP>
23 class SubspaceBasis;
24 
25 
26 
28 template<class RLV, class PP>
30 {
31  using PrefixPath = PP;
32 
33 public:
34 
35  using RootLocalView = RLV;
36 
39 
41  using GridView = typename GlobalBasis::GridView;
42 
44  using Element = typename GridView::template Codim<0>::Entity;
45 
47  using size_type = std::size_t;
48 
50  using RootTree = typename RootLocalView::Tree;
51 
53  using Tree = typename TypeTree::ChildForTreePath<RootTree, PrefixPath>;
54 
56  SubspaceLocalView(const GlobalBasis& globalBasis, const PrefixPath& prefixPath) :
57  globalBasis_(&globalBasis),
58  rootLocalView_(globalBasis.rootBasis().localView())
59  {
60 // static_assert(models<Concept::BasisTree<GridView>, Tree>(), "Tree type passed to SubspaceLocalView does not model the BasisNode concept.");
61  }
62 
68  void bind(const Element& e)
69  {
70  rootLocalView_.bind(e);
71  }
72 
77  const Element& element() const
78  {
79  return rootLocalView_.element();
80  }
81 
86  void unbind()
87  {
88  rootLocalView_.unbind();
89  }
90 
95  const Tree& tree() const
96  {
97  return TypeTree::child(rootLocalView_.tree(), globalBasis_->prefixPath());
98  }
99 
102  size_type size() const
103  {
104  return rootLocalView_.size();
105  }
106 
114  {
115  return rootLocalView_.maxSize();
116  }
117 
120  const GlobalBasis& globalBasis() const
121  {
122  return *globalBasis_;
123  }
124 
126  {
127  return rootLocalView_;
128  }
129 
130 protected:
133 };
134 
135 
136 
137 } // end namespace Functions
138 } // end namespace Dune
139 
140 
141 
142 #endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACELOCALVIEW_HH
const PrefixPath & prefixPath() const
Definition: subspacebasis.hh:100
The restriction of a finite element basis to a single element.
Definition: subspacelocalview.hh:29
const GlobalBasis & globalBasis() const
Return the global basis that we are a view on.
Definition: subspacelocalview.hh:120
RootLocalView rootLocalView_
Definition: subspacelocalview.hh:132
std::size_t size_type
The type used for sizes.
Definition: subspacelocalview.hh:47
const GlobalBasis * globalBasis_
Definition: subspacelocalview.hh:131
Definition: polynomial.hh:7
const Tree & tree() const
Return the local ansatz tree associated to the bound entity.
Definition: subspacelocalview.hh:95
const Element & element() const
Return the grid element that the view is bound to.
Definition: subspacelocalview.hh:77
size_type maxSize() const
Maximum local size for any element on the GridView.
Definition: subspacelocalview.hh:113
const RootLocalView & rootLocalView() const
Definition: subspacelocalview.hh:125
typename TypeTree::ChildForTreePath< RootTree, PrefixPath > Tree
Tree of local finite elements / local shape function sets.
Definition: subspacelocalview.hh:53
typename GridView::template Codim< 0 >::Entity Element
Type of the grid element we are bound to.
Definition: subspacelocalview.hh:44
void bind(const Element &e)
Bind the view to a grid element.
Definition: subspacelocalview.hh:68
typename RootLocalView::Tree RootTree
Tree of local finite elements / local shape function sets.
Definition: subspacelocalview.hh:50
typename RootBasis::GridView GridView
The grid view that the FE space is defined on.
Definition: subspacebasis.hh:33
Definition: subspacebasis.hh:22
void unbind()
Unbind from the current element.
Definition: subspacelocalview.hh:86
RLV RootLocalView
Definition: subspacelocalview.hh:35
typename GlobalBasis::GridView GridView
The grid view the global FE basis lives on.
Definition: subspacelocalview.hh:41
size_type size() const
Total number of degrees of freedom on this element.
Definition: subspacelocalview.hh:102
SubspaceLocalView(const GlobalBasis &globalBasis, const PrefixPath &prefixPath)
Construct local view for a given global finite element basis.
Definition: subspacelocalview.hh:56