DUNE PDELab (git)

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// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-PDELab-exception
5
6#ifndef DUNE_TYPETREE_NODEINTERFACE_HH
7#define DUNE_TYPETREE_NODEINTERFACE_HH
8
9#include <cstddef>
10#include <type_traits>
11
13
14namespace Dune {
15 namespace TypeTree {
16
35 {
37 static const bool isLeaf = implementationDefined;
38
40 static const bool isPower = implementationDefined;
41
44
46
51 static auto degree();
52
54
60
62
66 };
67
69 template<typename Node>
71
73 template<typename T>
75
76
78 template<typename Node>
79 std::size_t degree(const Node& node)
80 {
81 return degree(&node,NodeTag<Node>());
82 }
83
84#ifndef DOXYGEN
85
87
93 template<typename Node, typename NodeTag>
94 std::size_t degree(const Node* node, NodeTag)
95 {
96 return node->degree();
97 }
98
99#endif // DOXYGEN
100
102
106 template<typename Node>
107 using StaticDegree = decltype(Node::degree());
108
110
111 } // namespace TypeTree
112} //namespace Dune
113
114#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:79
typename std::decay_t< Node >::NodeTag NodeTag
Returns the node tag of the given Node.
Definition: nodeinterface.hh:70
typename std::decay_t< T >::ImplementationTag ImplementationTag
Returns the implementation tag of the given Node.
Definition: nodeinterface.hh:74
decltype(Node::degree()) StaticDegree
Returns the statically known degree of the given Node type as a std::integral_constant.
Definition: nodeinterface.hh:107
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:35
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:40
static const bool isLeaf
Whether this is a leaf node in a dune-typetree.
Definition: nodeinterface.hh:37
ImplementationDefined NodeStorage
container type to pass around a collection of children
Definition: nodeinterface.hh:65
static const bool isComposite
Whether this is a composite node in the dune-typetree.
Definition: nodeinterface.hh:43
ImplementationDefined NodeTag
The type tag that describes what kind of node this is.
Definition: nodeinterface.hh:59
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 24, 23:30, 2024)