Dune Core Modules (2.9.0)

Classes

struct  Dune::TypeTree::or_< result_type >
 Statically combine two values of type result_type using ||. More...
 
struct  Dune::TypeTree::and_< result_type >
 Statically combine two values of type result_type using &&. More...
 
struct  Dune::TypeTree::plus< result_type >
 Statically combine two values of type result_type using +. More...
 
struct  Dune::TypeTree::minus< result_type >
 Statically combine two values of type result_type using -. More...
 
struct  Dune::TypeTree::multiply< result_type >
 Statically combine two values of type result_type using *. More...
 
struct  Dune::TypeTree::min< result_type >
 Statically combine two values of type result_type by returning their minimum. More...
 
struct  Dune::TypeTree::max< result_type >
 Statically combine two values of type result_type by returning their maximum. More...
 
struct  Dune::TypeTree::AccumulateValue< Tree, Functor, Reduction, startValue, ParentChildReduction >
 Statically accumulate a value over the nodes of a TypeTree. More...
 
struct  Dune::TypeTree::TypeAccumulationPolicy< Functor, Reduction, StartType, ParentChildReduction, ReductionAlgorithm >
 
struct  Dune::TypeTree::AccumulateType< Tree, Policy >
 Statically accumulate a type over the nodes of a TypeTree. More...
 
struct  Dune::TypeTree::DefaultVisitor
 Visitor interface and base class for TypeTree visitors. More...
 
struct  Dune::TypeTree::DefaultPairVisitor
 Visitor interface and base class for visitors of pairs of TypeTrees. More...
 
struct  Dune::TypeTree::VisitDirectChildren
 Mixin base class for visitors that only want to visit the direct children of a node. More...
 
struct  Dune::TypeTree::VisitTree
 Mixin base class for visitors that want to visit the complete tree. More...
 
struct  Dune::TypeTree::StaticTraversal
 Mixin base class for visitors that require a static TreePath during traversal. More...
 
struct  Dune::TypeTree::DynamicTraversal
 Mixin base class for visitors that only need a dynamic TreePath during traversal. More...
 
struct  Dune::TypeTree::TreeVisitor
 Convenience base class for visiting the entire tree. More...
 
struct  Dune::TypeTree::DirectChildrenVisitor
 Convenience base class for visiting the direct children of a node. More...
 
struct  Dune::TypeTree::TreePairVisitor
 Convenience base class for visiting an entire tree pair. More...
 
struct  Dune::TypeTree::DirectChildrenPairVisitor
 Convenience base class for visiting the direct children of a node pair. More...
 

Functions

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...
 

Detailed Description

Function Documentation

◆ applyToTree()

template<typename Tree , typename Visitor >
void Dune::TypeTree::applyToTree ( Tree &&  tree,
Visitor &&  visitor 
)

Apply visitor to TypeTree.

#include <dune/typetree/traversal.hh>

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).

Note
The visitor must implement the interface laid out by DefaultVisitor (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
treeThe tree the visitor will be applied to.
visitorThe visitor to apply to the tree.

References Dune::TypeTree::applyToTree(), and Dune::TypeTree::hybridTreePath().

Referenced by Dune::TypeTree::applyToTree(), Dune::Functions::DefaultNodeToRangeMap< Tree >::DefaultNodeToRangeMap(), Dune::Functions::TreeData< T, ND, LO >::destroy(), Dune::Functions::TreeData< T, ND, LO >::init(), Dune::Functions::TreeData< T, ND, LO >::operator=(), Dune::TypeTree::reduceOverLeafs(), Dune::Functions::TreeData< T, ND, LO >::TreeData(), and Dune::Functions::TreeData< T, ND, LO >::~TreeData().

◆ applyToTreePair()

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
tree1The first tree the visitor will be applied to.
tree2The second tree the visitor will be applied to.
visitorThe visitor to apply to the trees.

References Dune::TypeTree::applyToTreePair(), and Dune::TypeTree::hybridTreePath().

Referenced by Dune::TypeTree::applyToTreePair().

◆ forEachLeafNode()

template<class 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(), and Dune::TypeTree::hybridTreePath().

Referenced by Dune::Functions::SubEntityDOFs< GridView >::bind(), and Dune::Functions::DiscreteGlobalBasisFunctionDerivative< DGBF >::LocalFunction::operator()().

◆ forEachNode() [1/3]

template<class Tree , class InnerFunc , class LeafFunc >
void Dune::TypeTree::forEachNode ( Tree &&  tree,
InnerFunc &&  innerFunc,
LeafFunc &&  leafFunc 
)

Traverse tree and visit each node.

All passed callback functions are called with the node and corresponding treepath as arguments.

Parameters
treeThe tree to traverse
innerFuncThis function is called for each inner node before visiting its children
leafFuncThis function is called for each leaf node
Deprecated:
Use the more general applyToTree instead.

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

◆ forEachNode() [2/3]

template<class 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(), and Dune::TypeTree::hybridTreePath().

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

◆ forEachNode() [3/3]

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
treeThe tree to traverse
preFuncThis function is called for each inner node before visiting its children
leafFuncThis function is called for each leaf node
postFuncThis function is called for each inner node after visiting its children
Deprecated:
Use the more general applyToTree instead.

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

◆ leafTreePathTuple()

template<class Tree , TreePathType::Type pathType = TreePathType::dynamic>
constexpr auto Dune::TypeTree::leafTreePathTuple ( )
constexpr

Create tuple of tree paths to leafs.

This creates a tuple of HybridTreePath objects refering to the leaf nodes in the tree. The generated tree paths are always HybridTreePath instances. If pathType is TreePathType::dynamic then path entries for power nodes are of type std::size_t. For all other nodes and if pathType is not TreePathType::dynamic, the entries are instances of Dune::index_constant.

Template Parameters
TreeType of tree to generate tree paths for
pathTypeType of paths to generate

References Dune::TypeTree::hybridTreePath().

◆ reduceOverLeafs()

template<typename ResultType , typename Tree , typename F , typename R >
ResultType Dune::TypeTree::reduceOverLeafs ( const Tree &  tree,
functor,
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>
ResultType operator()(const Node& node, TreePath treePath) const
{
return ...;
}
};
A hybrid version of TreePath that supports both compile time and run time indices.
Definition: treepath.hh:79
constexpr HybridTreePath< T... > treePath(const T &... t)
Constructs a new HybridTreePath from the given indices.
Definition: treepath.hh:191
Parameters
treeThe tree on which to perform the calculation.
functorThe functor to apply to the leaf nodes.
reductionThe operation used to combine the individual results.
startValueThe initial value for the result.
Returns
The value obtained by combining the individual results for all leafs.

References Dune::TypeTree::applyToTree().

Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)