dune-typetree  2.8-git
nodeinterface.hh
Go to the documentation of this file.
1 // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=8 sw=2 sts=2:
3 
4 #ifndef DUNE_TYPETREE_NODEINTERFACE_HH
5 #define DUNE_TYPETREE_NODEINTERFACE_HH
6 
7 #include <cstddef>
8 #include <type_traits>
9 
10 #include <dune/common/documentation.hh>
11 
12 namespace Dune {
13  namespace TypeTree {
14 
33  {
35  static const bool isLeaf = implementationDefined;
36 
38  static const bool isPower = implementationDefined;
39 
41  static const bool isComposite = implementationDefined;
42 
44 
48  static const std::size_t CHILDREN = implementationDefined;
49 
51 
56  typedef ImplementationDefined NodeTag;
57 
59 
62  typedef ImplementationDefined NodeStorage;
63  };
64 
66  template<typename Node>
68 
70  template<typename T>
72 
73 
75  template<typename Node>
76  std::size_t degree(const Node& node)
77  {
78  return degree(&node,NodeTag<Node>());
79  }
80 
81 #ifndef DOXYGEN
82 
84 
90  template<typename Node, typename NodeTag>
91  std::size_t degree(const Node* node, NodeTag)
92  {
93  return node->degree();
94  }
95 
96 #endif // DOXYGEN
97 
99 
103  template<typename Node>
104  using StaticDegree = decltype(Node::degree());
105 
107 
108  } // namespace TypeTree
109 } //namespace Dune
110 
111 #endif // DUNE_TYPETREE_NODEINTERFACE_HH
std::size_t degree(const Node &node)
Returns the degree of node as run time information.
Definition: nodeinterface.hh:76
typename std::decay_t< Node >::NodeTag NodeTag
Returns the node tag of the given Node.
Definition: nodeinterface.hh:67
typename std::decay_t< T >::ImplementationTag ImplementationTag
Returns the implementation tag of the given Node.
Definition: nodeinterface.hh:71
decltype(Node::degree()) StaticDegree
Returns the statically known degree of the given Node type as a std::integral_constant.
Definition: nodeinterface.hh:104
Definition: accumulate_static.hh:13
Interface for nodes in a dune-typetree.
Definition: nodeinterface.hh:33
static const std::size_t CHILDREN
Number of children of this node in the dune-typetree.
Definition: nodeinterface.hh:48
static const bool isPower
Whether this is a power node in the dune-typetree.
Definition: nodeinterface.hh:38
static const bool isLeaf
Whether this is a leaf node in a dune-typetree.
Definition: nodeinterface.hh:35
ImplementationDefined NodeStorage
container type to pass around a collection of children
Definition: nodeinterface.hh:62
static const bool isComposite
Whether this is a composite node in the dune-typetree.
Definition: nodeinterface.hh:41
ImplementationDefined NodeTag
The type tag that describes what kind of node this is.
Definition: nodeinterface.hh:56