Dune Core Modules (2.9.0)

nodeinterface.hh
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
11
12namespace Dune {
13 namespace TypeTree {
14
33 {
35 static const bool isLeaf = implementationDefined;
36
38 static const bool isPower = implementationDefined;
39
42
44
49 static const std::size_t CHILDREN = implementationDefined;
50
52
57 static auto degree();
58
60
66
68
72 };
73
75 template<typename Node>
77
79 template<typename T>
81
82
84 template<typename Node>
85 std::size_t degree(const Node& node)
86 {
87 return degree(&node,NodeTag<Node>());
88 }
89
90#ifndef DOXYGEN
91
93
99 template<typename Node, typename NodeTag>
100 std::size_t degree(const Node* node, NodeTag)
101 {
102 return node->degree();
103 }
104
105#endif // DOXYGEN
106
108
112 template<typename Node>
113 using StaticDegree = decltype(Node::degree());
114
116
117 } // namespace TypeTree
118} //namespace Dune
119
120#endif // DUNE_TYPETREE_NODEINTERFACE_HH
Documentation related stuff.
@ implementationDefined
Dummy integral value used for documentation purposes.
Definition: documentation.hh:55
std::size_t degree(const Node &node)
Returns the degree of node as run time information.
Definition: nodeinterface.hh:85
typename std::decay_t< Node >::NodeTag NodeTag
Returns the node tag of the given Node.
Definition: nodeinterface.hh:76
typename std::decay_t< T >::ImplementationTag ImplementationTag
Returns the implementation tag of the given Node.
Definition: nodeinterface.hh:80
decltype(Node::degree()) StaticDegree
Returns the statically known degree of the given Node type as a std::integral_constant.
Definition: nodeinterface.hh:113
Dune namespace.
Definition: alignedallocator.hh:13
Dummy struct used for documentation purposes.
Definition: documentation.hh:42
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:49
static auto degree()
Number of children of this node in the dune-typetree.
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:71
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:65
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)