29template <
class T,
class TreePath,
class PowerFunc,
class LeafFunc>
31 using Tree = std::decay_t<T>;
32 if constexpr (Tree::isLeaf) {
33 leafFunc(tree, treePath);
34 }
else if constexpr (Tree::isPower) {
35 if constexpr (Tree::template Child<Dune::Indices::_0>::Type::isLeaf) {
36 powerFunc(tree, treePath);
38 for (std::size_t i = 0; i < tree.degree(); ++i) {
39 auto childTreePath = Dune::TypeTree::push_back(treePath, i);
44 auto indices = std::make_index_sequence<Tree::degree()>{};
45 Dune::Hybrid::forEach(indices, [&](
auto i) {
46 auto childTreePath = Dune::TypeTree::push_back(treePath, i);
Definition: algorithms.hh:17
void forEachLeafOrPowerLeafNode(T &&tree, TreePath &&treePath, PowerFunc &&powerFunc, LeafFunc &&leafFunc)
A function which loops over all the nodes of a tree and performs different actions for a power node (...
Definition: traversal.hh:30