DUNE PDELab (2.7)

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
32 {
34 static const bool isLeaf = implementationDefined;
35
37 static const bool isPower = implementationDefined;
38
41
43 static const std::size_t CHILDREN = implementationDefined;
44
46
52
54
58 };
59
61 template<typename Node>
63
65 template<typename T>
67
68
70 template<typename Node>
71 std::size_t degree(const Node& node)
72 {
73 return degree(&node,NodeTag<Node>());
74 }
75
76#ifndef DOXYGEN
77
79
85 template<typename Node, typename NodeTag>
86 constexpr std::size_t degree(const Node* node, NodeTag)
87 {
88 return Node::degree();
89 }
90
91#endif // DOXYGEN
92
94
98 template<typename Node>
99 using StaticDegree = std::integral_constant<
100 std::size_t,
101 degree(
102 static_cast<std::decay_t<Node>*>(nullptr),
103 NodeTag<std::decay_t<Node>>()
104 )
105 >;
106
108
109 } // namespace TypeTree
110} //namespace Dune
111
112#endif // DUNE_TYPETREE_NODEINTERFACE_HH
Documentation related stuff.
@ implementationDefined
Dummy integral value used for documentation purposes.
Definition: documentation.hh:53
std::size_t degree(const Node &node)
Returns the degree of node as run time information.
Definition: nodeinterface.hh:71
typename std::decay_t< Node >::NodeTag NodeTag
Returns the node tag of the given Node.
Definition: nodeinterface.hh:62
std::integral_constant< std::size_t, degree(static_cast< std::decay_t< Node > * >(nullptr), NodeTag< std::decay_t< Node > >()) > StaticDegree
Returns the statically known degree of the given Node type as a std::integral_constant.
Definition: nodeinterface.hh:105
typename std::decay_t< T >::ImplementationTag ImplementationTag
Returns the implementation tag of the given Node.
Definition: nodeinterface.hh:66
Dune namespace.
Definition: alignedallocator.hh:14
Dummy struct used for documentation purposes.
Definition: documentation.hh:40
Interface for nodes in a dune-typetree.
Definition: nodeinterface.hh:32
static const std::size_t CHILDREN
Number of children of this node in the dune-typetree.
Definition: nodeinterface.hh:43
static const bool isPower
Whether this is a power node in the dune-typetree.
Definition: nodeinterface.hh:37
static const bool isLeaf
Whether this is a leaf node in a dune-typetree.
Definition: nodeinterface.hh:34
ImplementationDefined NodeStorage
container type to pass around a collection of children
Definition: nodeinterface.hh:57
static const bool isComposite
Whether this is a composite node in the dune-typetree.
Definition: nodeinterface.hh:40
ImplementationDefined NodeTag
The type tag that describes what kind of node this is.
Definition: nodeinterface.hh:51
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)