AMDiS  0.1
The Adaptive Multi-Dimensional Simulation Toolbox
NodeIndices.hpp
1 #pragma once
2 
3 #include <dune/common/rangeutilities.hh>
4 
5 #include <amdis/common/Concepts.hpp>
6 #include <amdis/typetree/MultiIndex.hpp>
7 #include <amdis/utility/MappedRangeView.hpp>
8 
9 namespace AMDiS
10 {
12  template <class LocalView, class Node>
13  auto nodeIndices(LocalView const& localView, Node const& node)
14  {
15  static_assert(Concepts::LocalView<LocalView>, "");
16  static_assert(Concepts::BasisTree<Node, typename LocalView::GridView>, "");
17 
18  return mappedRangeView(Dune::range(node.size()), [&](std::size_t j) -> typename LocalView::MultiIndex {
19  return localView.index(node.localIndex(j));
20  });
21  }
22 
24  template <class LocalView>
25  auto nodeIndices(LocalView const& localView)
26  {
27  static_assert(Concepts::LocalView<LocalView>, "");
28 
29  return mappedRangeView(Dune::range(localView.size()), [&](std::size_t i) -> typename LocalView::MultiIndex {
30  return localView.index(i);
31  });
32  }
33 
34 
36  template <class LocalView, class Node>
37  std::size_t nodeIndexCount(LocalView const& /*localView*/, Node const& node)
38  {
39  return node.size();
40  }
41 
43  template <class LocalView>
44  std::size_t nodeIndexCount(LocalView const& localView)
45  {
46  return localView.size();
47  }
48 
49 } // end namespace AMDiS
std::size_t nodeIndexCount(LocalView const &, Node const &node)
Returns the number of DOF indices on a node, given by the localView.
Definition: NodeIndices.hpp:37
size_type size() const
Total number of degrees of freedom on this element.
Definition: LocalView.hpp:119
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
MultiIndex index(size_type i) const
Maps from subtree index set [0..size-1] to a globally unique multi index in global basis...
Definition: LocalView.hpp:135
The restriction of a finite element basis to a single element.
Definition: LocalView.hpp:19
auto mappedRangeView(R &&range, F const &f)
Create a MappedRangeView.
Definition: MappedRangeView.hpp:445
typename NodeIndexSet::MultiIndex MultiIndex
Type used for global numbering of the basis vectors.
Definition: LocalView.hpp:46
auto nodeIndices(LocalView const &localView, Node const &node)
Returns a range over (flat) DOF indices on a node, given by the localView.
Definition: NodeIndices.hpp:13