39#include "../traits/expressionTraits.hpp"
40#include "expressionInterface.hpp"
41#include "logic/compileTimeTraversalLogic.hpp"
42#include "logic/nodeInterface.hpp"
43#include "logic/traversalLogic.hpp"
55 template<
typename T_Real>
64 template<
typename ArgA,
typename ArgB>
70 template<
typename ArgA,
typename ArgB>
76 template<
typename ArgA,
typename ArgB>
90 template<
typename T_Real,
typename T_ArgA,
typename T_ArgB,
template<
typename>
class T_Operation>
98 typename ArgA::StoreAs
argA;
99 typename ArgB::StoreAs
argB;
103 template<
typename RealA,
typename RealB>
125 template<
size_t argNumber>
127 if (0 == argNumber) {
128 return Operation::gradientA(
argA.getValue(),
argB.getValue(),
result);
130 return Operation::gradientB(
argA.getValue(),
argB.getValue(),
result);
142 template<
typename Logic,
typename... Args>
144 logic.
cast().template link<0>(
argA, *
this, std::forward<Args>(args)...);
145 logic.
cast().template link<1>(
argB, *
this, std::forward<Args>(args)...);
149 template<
typename CompileTimeLogic,
typename... Args>
151 return CompileTimeLogic::reduce(
152 CompileTimeLogic::template link<0, ArgA, BinaryExpression>(std::forward<Args>(args)...),
153 CompileTimeLogic::template link<1, ArgB, BinaryExpression>(std::forward<Args>(args)...));
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition config.h:457
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:94
#define CODI_T(...)
Abbreviation for CODI_TEMPLATE.
Definition macros.hpp:111
CoDiPack - Code Differentiation Package.
Definition codi.hpp:90
Represents an operator with two arguments in the expression tree.
Definition binaryExpression.hpp:91
static CompileTimeLogic::ResultType constexpr forEachLinkConstExpr(Args &&... args)
Definition binaryExpression.hpp:150
static bool constexpr EndPoint
If this expression is handled as a leaf in the tree.
Definition binaryExpression.hpp:139
BinaryExpression(ExpressionInterface< RealA, ArgA > const &argA, ExpressionInterface< RealB, ArgB > const &argB)
Constructor.
Definition binaryExpression.hpp:104
ArgA::StoreAs argA
First argument of the expression.
Definition binaryExpression.hpp:98
ArgB::StoreAs argB
Second argument of the expression.
Definition binaryExpression.hpp:99
T_Operation< Real > Operation
See BinaryExpression.
Definition binaryExpression.hpp:96
Real result
Precomputed result.
Definition binaryExpression.hpp:100
T_ArgA ArgA
See BinaryExpression.
Definition binaryExpression.hpp:94
void forEachLink(TraversalLogic< Logic > &logic, Args &&... args) const
Definition binaryExpression.hpp:143
Real const & getValue() const
Compute the primal value that is usually evaluated by the statement/expression.
Definition binaryExpression.hpp:120
T_ArgB ArgB
See BinaryExpression.
Definition binaryExpression.hpp:95
Real getJacobian() const
Definition binaryExpression.hpp:126
typename ExpressionTraits::ValidateResult< typename ArgA::ActiveResult, typename ArgB::ActiveResult >:: ActiveResult ActiveResult
Type into which the expression can be converted. Usually also the type from which it is constructed.
Definition binaryExpression.hpp:115
T_Real Real
See BinaryExpression.
Definition binaryExpression.hpp:93
Interface for implementing the logic for a BinaryExpression.
Definition binaryExpression.hpp:56
static Real primal(ArgA const &argA, ArgB const &argB)
T_Real Real
See BinaryOperation.
Definition binaryExpression.hpp:59
static Real gradientB(ArgA const &argA, ArgB const &argB, Real const &result)
static Real gradientA(ArgA const &argA, ArgB const &argB, Real const &result)
Base class for all CoDiPack expressions.
Definition expressionInterface.hpp:59
Impl const & cast() const
Cast to the implementation.
Definition expressionInterface.hpp:75
Definition expressionTraits.hpp:69
Traversal of CoDiPack expressions.
Definition traversalLogic.hpp:56
Impl & cast()
Cast to the implementation.
Definition traversalLogic.hpp:62