CoDiPack  3.0.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::CompileTimeTraversalLogic< T_ResultType, T_Impl > Struct Template Reference

Traversal of CoDiPack expressions during compile time. More...

#include <compileTimeTraversalLogic.hpp>

Inheritance diagram for codi::CompileTimeTraversalLogic< T_ResultType, T_Impl >:

Public Types

using Impl = T_Impl
 See CompileTimeTraversalLogic.
 
using ResultType = T_ResultType
 See CompileTimeTraversalLogic.
 

Public Member Functions

template<typename Node, typename... Args>
inlinestatic ResultType constexpr eval (Args &&... args)
 Start the evaluation of the logic on the given expression.
 
template<typename Node, typename... Args>
inlinestatic ResultType constexpr toLinks (Args &&... args)
 Helper method which calls the method 'link' on all links of the node and reduces the results.
 
Interface definition
inlinestatic ResultType constexpr reduce (ResultType a, ResultType b)
 Reduction operation for the results of two links.
 
template<typename Node, typename... Args>
inlinestatic ResultType constexpr node (Args &&... args)
 Called for each node in the expression.
 
template<typename Node, typename... Args>
inlinestatic ResultType constexpr leaf (Args &&...)
 Called for all leaf nodes in the expression.
 
template<size_t ChildNumber, typename Child, typename Root, typename... Args>
inlinestatic ResultType constexpr link (Args &&... args)
 Called for all links in the expression.
 

Static Public Attributes

static ResultType constexpr NeutralElement = {}
 Neutral element of the reduction.
 

Protected Member Functions

template<typename Node, typename... Args>
inlinestatic ResultType constexpr toNode (Args &&... args)
 Helper method to distinguish between leaf nodes and normal nodes.
 

Detailed Description

template<typename T_ResultType, typename T_Impl>
struct codi::CompileTimeTraversalLogic< T_ResultType, T_Impl >

Traversal of CoDiPack expressions during compile time.

For a detailed explanation of the traversal structure please see Expression traversal.

All information must be provided as arguments and all computations must be constexpr.

Template Parameters
T_ResultTypeType of the computed result.
T_ImplClass implementing this interface.

Member Function Documentation

◆ leaf()

template<typename T_ResultType, typename T_Impl>
template<typename Node, typename... Args>
inlinestatic ResultType constexpr codi::CompileTimeTraversalLogic< T_ResultType, T_Impl >::leaf ( Args && ...)
inlineconstexpr

Called for all leaf nodes in the expression.

Must be a constexpr.

Default: Returns NeutralElement.

◆ link()

template<typename T_ResultType, typename T_Impl>
template<size_t ChildNumber, typename Child, typename Root, typename... Args>
inlinestatic ResultType constexpr codi::CompileTimeTraversalLogic< T_ResultType, T_Impl >::link ( Args &&... args)
inlineconstexpr

Called for all links in the expression.

Implementations can call the toNode method in order to evaluate either leaf or node depending on the child.

Must be a constexpr.

Default: Call the child node and forward all arguments.

◆ node()

template<typename T_ResultType, typename T_Impl>
template<typename Node, typename... Args>
inlinestatic ResultType constexpr codi::CompileTimeTraversalLogic< T_ResultType, T_Impl >::node ( Args &&... args)
inlineconstexpr

Called for each node in the expression.

Implementations can call the toLinks method in order to evaluate all links of the node.

Must be a constexpr.

Default: Call each link of the node and forward all arguments.

◆ reduce()

template<typename T_ResultType, typename T_Impl>
inlinestatic ResultType constexpr codi::CompileTimeTraversalLogic< T_ResultType, T_Impl >::reduce ( ResultType a,
ResultType b )
inlineconstexpr

Reduction operation for the results of two links.

Must be a constexpr.

Default: summation.


The documentation for this struct was generated from the following file: