AMDiS  2.10
The Adaptive Multi-Dimensional Simulation Toolbox
LocalView.hpp
1 #pragma once
2 
3 #include <dune/functions/functionspacebases/defaultlocalview.hh>
4 
5 #include <amdis/common/OptionalNoCopy.hpp>
6 #include <amdis/functions/NodeCache.hpp>
7 
8 // NOTE: This is a variant of dune-functions DefaultLocalView
9 
10 namespace AMDiS
11 {
13  template <class GB>
14  class LocalView
15  : public Dune::Functions::DefaultLocalView<GB>
16  {
17  using Super = Dune::Functions::DefaultLocalView<GB>;
18 
19  public:
21  using GlobalBasis = GB;
22 
24  using Tree = typename Super::Tree;
25 
27  using TreeCache = NodeCache_t<Tree>;
28 
29  public:
31  LocalView (GlobalBasis const& globalBasis)
32  : Super(globalBasis)
33  {}
34 
36  TreeCache const& treeCache () const
37  {
38  if (!treeCache_)
39  treeCache_.emplace(makeNodeCache(Super::tree_));
40 
41  return *treeCache_;
42  }
43 
45  LocalView const& rootLocalView () const
46  {
47  return *this;
48  }
49 
50  protected:
51  mutable OptionalNoCopy<TreeCache> treeCache_ = std::nullopt;
52  };
53 
54 } // end namespace AMDiS
LocalView const & rootLocalView() const
Return this local-view.
Definition: LocalView.hpp:45
Definition: AdaptBase.hpp:6
The restriction of a finite element basis to a single element.
Definition: LocalView.hpp:14
TreeCache const & treeCache() const
Cached version of the local ansatz tree.
Definition: LocalView.hpp:36
LocalView(GlobalBasis const &globalBasis)
Construct local view for a given global finite element basis.
Definition: LocalView.hpp:31
typename Super::Tree Tree
Tree of local finite elements / local shape function sets.
Definition: LocalView.hpp:24
B GlobalBasis
The global FE basis that this is a view on.
Definition: LocalView.hpp:21
NodeCache_t< Tree > TreeCache
Cached basis-tree.
Definition: LocalView.hpp:27