6#ifndef DUNE_TYPETREE_TRAVERSALUTILITIES_HH
7#define DUNE_TYPETREE_TRAVERSALUTILITIES_HH
27 template<
typename F,
typename R,
typename ResultType>
28 struct LeafReductionVisitor
29 :
public TypeTree::TreeVisitor
34 template<
typename Node,
typename TreePath>
35 void leaf(
const Node& node, TreePath
treePath)
40 LeafReductionVisitor(F functor, R reduction, ResultType startValue)
82 template<
typename ResultType,
typename Tree,
typename F,
typename R>
83 ResultType
reduceOverLeafs(
const Tree& tree, F functor, R reduction, ResultType startValue)
85 LeafReductionVisitor<F,R,ResultType> visitor(functor,reduction,startValue);
87 return visitor.result();
static const result_type result
Definition accumulate_static.hh:113
R _reduction
Definition traversalutilities.hh:49
F _functor
Definition traversalutilities.hh:48
static const TreePathType::Type treePathType
Definition traversalutilities.hh:32
ResultType _value
Definition traversalutilities.hh:50
ResultType reduceOverLeafs(const Tree &tree, F functor, R reduction, ResultType startValue)
Calculate a quantity as a reduction over the leaf nodes of a TypeTree.
Definition traversalutilities.hh:83
void applyToTree(Tree &&tree, Visitor &&visitor)
Apply visitor to TypeTree.
Definition traversal.hh:239
constexpr auto treePath(const T &... t)
Constructs a new HybridTreePath from the given indices.
Definition treepath.hh:326
Definition accumulate_static.hh:16
Type
Definition treepath.hh:106
@ dynamic
Definition treepath.hh:106