dune-functions  2.5.0
defaultlocalindexset.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_DEFAULTLOCALINDEXSET_HH
4 #define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_DEFAULTLOCALINDEXSET_HH
5 
7 
8 
9 namespace Dune {
10 namespace Functions {
11 
12 
13 
14 template<class LV, class NIS>
16 {
17 public:
18  using LocalView = LV;
19  using NodeIndexSet = NIS;
20 
22  using MultiIndex = typename NodeIndexSet::MultiIndex;
23  using size_type = std::size_t;
24 
25 
26  DefaultLocalIndexSet(const NodeIndexSet& nodeIndexSet) :
27  nodeIndexSet_(nodeIndexSet)
28  {}
29 
31  nodeIndexSet_(nodeIndexSet)
32  {}
33 
36  void bind(const LocalView& localView)
37  {
39  nodeIndexSet_.bind(localView_->tree());
40  }
41 
44  template<class TreePath>
45  void bind(const SubspaceLocalView<LocalView, TreePath>& subspaceLocalView)
46  {
47  bind(subspaceLocalView.rootLocalView());
48  }
49 
52  void unbind()
53  {
54  localView_ = nullptr;
55  nodeIndexSet_.unbind();
56  }
57 
60  size_type size() const
61  {
62  return nodeIndexSet_.size();
63  }
64 
67  {
68  return nodeIndexSet_.index(i);
69  }
70 
73  const LocalView& localView() const
74  {
75  return *localView_;
76  }
77 
78 protected:
79 
81 
83 };
84 
85 
86 
87 } // end namespace Functions
88 } // end namespace Dune
89 
90 
91 
92 #endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_DEFAULTLOCALINDEXSET_HH
Definition: defaultlocalindexset.hh:15
The restriction of a finite element basis to a single element.
Definition: subspacelocalview.hh:29
typename NodeIndexSet::MultiIndex MultiIndex
Type used for global numbering of the basis vectors.
Definition: defaultlocalindexset.hh:22
void bind(const LocalView &localView)
Bind the index set to a LocalView.
Definition: defaultlocalindexset.hh:36
const LocalView & localView() const
Return the local view that we are attached to.
Definition: defaultlocalindexset.hh:73
MultiIndex index(size_type i) const
Maps from subtree index set [0..size-1] to a globally unique multi index in global basis...
Definition: defaultlocalindexset.hh:66
size_type size() const
Size of subtree rooted in this node (element-local)
Definition: defaultlocalindexset.hh:60
NodeIndexSet nodeIndexSet_
Definition: defaultlocalindexset.hh:82
DefaultLocalIndexSet(NodeIndexSet &&nodeIndexSet)
Definition: defaultlocalindexset.hh:30
Definition: polynomial.hh:7
const RootLocalView & rootLocalView() const
Definition: subspacelocalview.hh:125
void bind(const SubspaceLocalView< LocalView, TreePath > &subspaceLocalView)
Bind the index set to a SubspaceLocalView.
Definition: defaultlocalindexset.hh:45
LV LocalView
Definition: defaultlocalindexset.hh:18
std::size_t size_type
Definition: defaultlocalindexset.hh:23
DefaultLocalIndexSet(const NodeIndexSet &nodeIndexSet)
Definition: defaultlocalindexset.hh:26
NIS NodeIndexSet
Definition: defaultlocalindexset.hh:19
const LocalView * localView_
Definition: defaultlocalindexset.hh:80
void unbind()
Unbind the view.
Definition: defaultlocalindexset.hh:52