AMDiS  0.3
The Adaptive Multi-Dimensional Simulation Toolbox
Concepts.hpp
1 #pragma once
2 
3 #include <type_traits>
4 
5 #include <dune/typetree/treepath.hh>
6 #include <amdis/typetree/TreePath.hpp>
7 
8 namespace AMDiS {
9 namespace Traits {
10 
11 template <class Tree, class TreePath, class NodeTag = typename Tree::NodeTag>
13 
14 // empty treepath
15 template <class Tree, class NodeTag>
16 struct IsValidTreePath<Tree, Dune::TypeTree::HybridTreePath<>, NodeTag>
17  : std::true_type {};
18 
19 // leaf nodes
20 template <class Tree, class I0, class... II>
21 struct IsValidTreePath<Tree, Dune::TypeTree::HybridTreePath<I0,II...>, Dune::TypeTree::LeafNodeTag>
22  : std::false_type {};
23 
24 // power nodes
25 template <class Tree, class I0, class... II>
26 struct IsValidTreePath<Tree, Dune::TypeTree::HybridTreePath<I0,II...>, Dune::TypeTree::PowerNodeTag>
27  : IsValidTreePath<typename Tree::ChildType, Dune::TypeTree::HybridTreePath<II...>> {};
28 
29 // composite node with integer index
30 template <class Tree, class I0, class... II>
31 struct IsValidTreePath<Tree, Dune::TypeTree::HybridTreePath<I0,II...>, Dune::TypeTree::CompositeNodeTag>
32  : std::false_type {};
33 
34 // composite node with integral-constant index
35 template <class Tree, class Int, Int i, class... II>
36 struct IsValidTreePath<Tree, Dune::TypeTree::HybridTreePath<std::integral_constant<Int,i>,II...>, Dune::TypeTree::CompositeNodeTag>
37  : std::conditional_t<(i >= 0 && i < Tree::degree()),
38  IsValidTreePath<typename Tree::template Child<(i >= 0 && i < Tree::degree()) ? i : 0>::Type, Dune::TypeTree::HybridTreePath<II...>>,
39  std::false_type> {};
40 
41 } // end namespace Traits
42 
43 
44 namespace Concepts {
45 
47 template <class Tree, class Path>
48 static constexpr bool ValidTreePath = Traits::IsValidTreePath<Tree,TYPEOF(makeTreePath(std::declval<Path>()))>::value;
49 
50 } // end namespace Concepts
51 } // end namespace AMDiS
Definition: AdaptiveGrid.hpp:373
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
Definition: Concepts.hpp:12