|
template<typename Tree1 , typename Tree2 , typename Visitor > |
void | Dune::TypeTree::applyToTreePair (Tree1 &&tree1, Tree2 &&tree2, Visitor &&visitor) |
| Apply visitor to a pair of TypeTrees. More...
|
|
template<class Tree , TreePathType::Type pathType = TreePathType::dynamic> |
constexpr auto | Dune::TypeTree::leafTreePathTuple () |
| Create tuple of tree paths to leafs. More...
|
|
template<typename Tree , typename Visitor > |
void | Dune::TypeTree::applyToTree (Tree &&tree, Visitor &&visitor) |
| Apply visitor to TypeTree. More...
|
|
template<class Tree , class PreFunc , class LeafFunc , class PostFunc > |
void | Dune::TypeTree::forEachNode (Tree &&tree, PreFunc &&preFunc, LeafFunc &&leafFunc, PostFunc &&postFunc) |
| Traverse tree and visit each node. More...
|
|
template<class Tree , class InnerFunc , class LeafFunc > |
void | Dune::TypeTree::forEachNode (Tree &&tree, InnerFunc &&innerFunc, LeafFunc &&leafFunc) |
| Traverse tree and visit each node. More...
|
|
template<class Tree , class NodeFunc > |
void | Dune::TypeTree::forEachNode (Tree &&tree, NodeFunc &&nodeFunc) |
| Traverse tree and visit each node. More...
|
|
template<class Tree , class LeafFunc > |
void | Dune::TypeTree::forEachLeafNode (Tree &&tree, LeafFunc &&leafFunc) |
| Traverse tree and visit each leaf node. More...
|
|
template<typename ResultType , typename Tree , typename F , typename R > |
ResultType | Dune::TypeTree::reduceOverLeafs (const Tree &tree, F functor, R reduction, ResultType startValue) |
| Calculate a quantity as a reduction over the leaf nodes of a TypeTree. More...
|
|
template<typename Tree1 , typename Tree2 , typename Visitor >
void Dune::TypeTree::applyToTreePair |
( |
Tree1 && |
tree1, |
|
|
Tree2 && |
tree2, |
|
|
Visitor && |
visitor |
|
) |
| |
Apply visitor to a pair of TypeTrees.
This function applies the given visitor to the given tree. Both visitor and tree may be const or non-const. If the compiler supports rvalue references, they may even be a non-const temporary; otherwise both trees must be either const or non-const. If they have different constness, both will be promoted to const.
- Note
- The visitor must implement the interface laid out by DefaultPairVisitor (most easily achieved by inheriting from it) and specify the required type of tree traversal (static or dynamic) by inheriting from either StaticTraversal or DynamicTraversal.
- Parameters
-
tree1 | The first tree the visitor will be applied to. |
tree2 | The second tree the visitor will be applied to. |
visitor | The visitor to apply to the trees. |
template<class Tree , class PreFunc , class LeafFunc , class PostFunc >
void Dune::TypeTree::forEachNode |
( |
Tree && |
tree, |
|
|
PreFunc && |
preFunc, |
|
|
LeafFunc && |
leafFunc, |
|
|
PostFunc && |
postFunc |
|
) |
| |
Traverse tree and visit each node.
All passed callback functions are called with the node and corresponding treepath as arguments.
- Parameters
-
tree | The tree to traverse |
preFunc | This function is called for each inner node before visiting its children |
leafFunc | This function is called for each leaf node |
postFunc | This function is called for each inner node after visiting its children |
template<typename ResultType , typename Tree , typename F , typename R >
ResultType Dune::TypeTree::reduceOverLeafs |
( |
const Tree & |
tree, |
|
|
F |
functor, |
|
|
R |
reduction, |
|
|
ResultType |
startValue |
|
) |
| |
Calculate a quantity as a reduction over the leaf nodes of a TypeTree.
This function can be used to easily calculate a quantity that is a result of applying a functor to the leaf nodes of a TypeTree and combining the functor return values. The functor, reduction and result should all have cheap copy constructors to ensure good performance.
The functor must conform to the pattern
struct Functor
{
template<typename Node, typename TreePath>
{
return ...;
}
};
- Parameters
-
tree | The tree on which to perform the calculation. |
functor | The functor to apply to the leaf nodes. |
reduction | The operation used to combine the individual results. |
startValue | The initial value for the result. |
- Returns
- The value obtained by combining the individual results for all leafs.