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

Static Public Member Functions

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

Static Public Attributes

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

Static Protected Member Functions

template<typename Node , typename... Args>
static ResultType constexpr toLinks (Args &&... args)
 Helper method which calls forEachLinkConstExpr on the node.
 
template<typename Node , typename... Args>
static 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>
static ResultType constexpr codi::CompileTimeTraversalLogic< T_ResultType, T_Impl >::leaf ( Args &&  ...)
inlinestaticconstexpr

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>
static ResultType constexpr codi::CompileTimeTraversalLogic< T_ResultType, T_Impl >::link ( Args &&...  args)
inlinestaticconstexpr

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>
static ResultType constexpr codi::CompileTimeTraversalLogic< T_ResultType, T_Impl >::node ( Args &&...  args)
inlinestaticconstexpr

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 >
static ResultType constexpr codi::CompileTimeTraversalLogic< T_ResultType, T_Impl >::reduce ( ResultType  a,
ResultType  b 
)
inlinestaticconstexpr

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: