AMDiS  0.3
The Adaptive Multi-Dimensional Simulation Toolbox
Nodes.hpp
1 #pragma once
2 
3 #include <dune/common/version.hh>
4 
5 namespace AMDiS
6 {
7  // dune version independent creation of node from preBasis
8  template <class PB, class TP>
9  auto makeNode(PB const& preBasis, [[maybe_unused]] TP const& treePath)
10  {
11  return preBasis.makeNode();
12  }
13 
14  // dune version independent extraction of node type from preBasis
15  template <class PB, class TP>
16  using Node_t = decltype(makeNode(std::declval<PB>(), std::declval<TP>()));
17 
18 
19  template <class PB,
20  class Tree = typename PB::Node,
21  class Iter = typename std::vector<typename PB::MultiIndex>::iterator>
22  using PreBasisHasIndicesConcept
23  = decltype(std::declval<PB>().indices(std::declval<Tree>(), std::declval<Iter>()));
24 
25  struct DummyNodeIndexSet {};
26 
27  // dune version independent creation of node from preBasis
28  template <class PB, class TP>
29  auto makeNodeIndexSet(PB const& preBasis, [[maybe_unused]] TP const& treePath)
30  {
31  if constexpr(Dune::Std::is_detected_v<PreBasisHasIndicesConcept,PB>)
32  return DummyNodeIndexSet{};
33  else
34  return preBasis.makeIndexSet();
35  }
36 
37  // dune version independent extraction of node indexset type from preBasis
38  template <class PB, class TP>
39  using NodeIndexSet_t = decltype(makeNodeIndexSet(std::declval<PB>(), std::declval<TP>()));
40 
41 } // end namespace AMDiS
Definition: AdaptBase.hpp:6
Definition: Nodes.hpp:25