DUNE-FEM (unstable)

Traversal

Functions

template<Concept::InnerTreeNode Tree, class Callable >
constexpr void Dune::TypeTree::forEachChild (Tree &&container, Callable &&at_value)
 Traverse each child of a tree and apply a callable function. More...
 
template<class Tree , class PreNodeFunc , class LeafNodeFunc , class PostNodeFunc >
void Dune::TypeTree::forEachNode (Tree &&tree, PreNodeFunc &&preNodeFunc, LeafNodeFunc &&leafNodeFunc, PostNodeFunc &&postNodeFunc)
 Traverse tree and visit each node. More...
 
template<Concept::TreeNode Tree, class NodeFunc >
void Dune::TypeTree::forEachNode (Tree &&tree, NodeFunc &&nodeFunc)
 Traverse tree and visit each node. More...
 
template<Concept::TreeNode Tree, class LeafFunc >
void Dune::TypeTree::forEachLeafNode (Tree &&tree, LeafFunc &&leafFunc)
 Traverse tree and visit each leaf node. More...
 

Detailed Description

Function Documentation

◆ forEachChild()

template<Concept::InnerTreeNode Tree, class Callable >
constexpr void Dune::TypeTree::forEachChild ( Tree &&  container,
Callable &&  at_value 
)
constexpr

Traverse each child of a tree and apply a callable function.

This function iterates over each child node of a given tree and applies a callable function to each child. The callable function can accept either one or two arguments: the child node itself, and optionally, its index.

Template Parameters
TreeThe type of the tree container to be traversed. This must satisfy the Concept::InnerTreeNode concept.
CallableThe type of the callable function (functor) to be applied to each child node. This can be a lambda, function pointer, or any callable object.
Parameters
containerThe tree container whose children will be traversed.
at_valueThe callable function to be applied to each child node. This function can accept either one argument (the child node) or two arguments (the child node and its index).

References Dune::TypeTree::child(), and Dune::unpackIntegerSequence().

◆ forEachLeafNode()

template<Concept::TreeNode Tree, class LeafFunc >
void Dune::TypeTree::forEachLeafNode ( Tree &&  tree,
LeafFunc &&  leafFunc 
)

Traverse tree and visit each leaf node.

The passed callback function is called with the node and corresponding treepath as arguments.

Parameters
treeThe tree to traverse
leafFuncThis function is called for each leaf node

References Dune::TypeTree::forEachNode().

◆ forEachNode() [1/2]

template<Concept::TreeNode Tree, class NodeFunc >
void Dune::TypeTree::forEachNode ( Tree &&  tree,
NodeFunc &&  nodeFunc 
)

Traverse tree and visit each node.

The passed callback function is called with the node and corresponding treepath as arguments.

Parameters
treeThe tree to traverse
nodeFuncThis function is called for each node

References Dune::TypeTree::forEachNode().

Referenced by Dune::TypeTree::forEachLeafNode(), and Dune::TypeTree::forEachNode().

◆ forEachNode() [2/2]

template<class Tree , class PreNodeFunc , class LeafNodeFunc , class PostNodeFunc >
void Dune::TypeTree::forEachNode ( Tree &&  tree,
PreNodeFunc &&  preNodeFunc,
LeafNodeFunc &&  leafNodeFunc,
PostNodeFunc &&  postNodeFunc 
)

Traverse tree and visit each node.

This does an in-order traversal of the tree. For leaf node the leafNodeFunc callback is called. For each inner node this function first calls the preNodeFunc, then it traverses the children, and then it calls the postNodeFunc. All callback functions are called with the node and corresponding treepath as arguments.

Parameters
treeThe tree to traverse
preNodeFuncThis function is called for each inner node
leafNodeFuncThis function is called for each leaf node
postNodeFuncThis function is called for each inner node

References Dune::TypeTree::forEachNode(), and Dune::TypeTree::treePath().

Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Jan 8, 23:33, 2026)