39#include "../../tapes/interfaces/reverseTapeInterface.hpp"
40#include "../../traits/expressionTraits.hpp"
41#include "../binaryExpression.hpp"
42#include "../constantExpression.hpp"
43#include "../expressionInterface.hpp"
44#include "../static/staticContextActiveType.hpp"
45#include "../unaryExpression.hpp"
46#include "nodeInterface.hpp"
69 template<
typename T_Rhs,
typename T_Tape,
size_t T_primalValueOffset,
size_t T_constantValueOffset,
typename =
void>
77 CODI_DD(T_primalValueOffset, 0);
79 CODI_DD(T_constantValueOffset, 0);
81 using Real =
typename Tape::Real;
97#ifndef DOXYGEN_DISABLE
99 template<
typename T_Rhs,
typename T_Tape,
size_t T_primalValueOffset,
size_t T_constantValueOffset>
101 ExpressionTraits::EnableIfLhsExpression<T_Rhs>> {
109 using Real =
typename Tape::Real;
110 using Identifier =
typename Tape::Identifier;
122 Real const primal = primalVector[identifier];
128 template<
typename T_Rhs,
typename T_Tape,
size_t T_primalValueOffset,
size_t T_constantValueOffset>
129 struct ConstructStaticContextLogic<T_Rhs, T_Tape, T_primalValueOffset, T_constantValueOffset,
138 using Real =
typename Tape::Real;
139 using Identifier =
typename Tape::Identifier;
143 using ResultType = ConstantExpression<typename Rhs::Real>;
150 using ConversionOperator =
typename Rhs::template ConversionOperator<PassiveReal>;
156 template<
typename T_Real,
typename T_ArgA,
typename T_ArgB,
template<
typename>
class T_Operation,
typename T_Tape,
157 size_t T_primalValueOffset,
size_t T_constantValueOffset>
158 struct ConstructStaticContextLogic<BinaryExpression<T_Real, T_ArgA, T_ArgB, T_Operation>, T_Tape, T_primalValueOffset,
159 T_constantValueOffset> {
162 using OpReal = T_Real;
166 using Operation = T_Operation<T>;
171 using Real =
typename Tape::Real;
172 using Identifier =
typename Tape::Identifier;
176 using ArgAConstructor = ConstructStaticContextLogic<ArgA, Tape, primalValueOffset, constantValueOffset>;
177 using ArgAMod =
typename ArgAConstructor::ResultType;
180 static size_t constexpr primalValueOffsetArgB =
182 static size_t constexpr constantValueOffsetArgB =
184 using ArgBConstructor = ConstructStaticContextLogic<ArgB, Tape, primalValueOffsetArgB, constantValueOffsetArgB>;
185 using ArgBMod =
typename ArgBConstructor::ResultType;
187 using ResultType = BinaryExpression<OpReal, ArgAMod, ArgBMod, Operation>;
191 return ResultType(ArgAConstructor::construct(primalVector, identifiers, constantData),
192 ArgBConstructor::construct(primalVector, identifiers, constantData));
196 template<
typename T_Real,
typename T_Arg,
template<
typename>
class T_Operation,
typename T_Tape,
197 size_t T_primalValueOffset,
size_t T_constantValueOffset>
198 struct ConstructStaticContextLogic<UnaryExpression<T_Real, T_Arg, T_Operation>, T_Tape, T_primalValueOffset,
199 T_constantValueOffset> {
202 using OpReal = T_Real;
205 using Operation = T_Operation<T>;
210 using Real =
typename Tape::Real;
211 using Identifier =
typename Tape::Identifier;
215 using ArgConstructor = ConstructStaticContextLogic<Arg, Tape, primalValueOffset, constantValueOffset>;
216 using ArgMod =
typename ArgConstructor::ResultType;
218 using ResultType = UnaryExpression<OpReal, ArgMod, Operation>;
222 return ResultType(ArgConstructor::construct(primalVector, identifiers, constantData));
#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
typename std::enable_if< IsConstantExpression< Expr >::value, T >::type EnableIfConstantExpression
Enable if wrapper for IsConstantExpression.
Definition expressionTraits.hpp:156
CoDiPack - Code Differentiation Package.
Definition codi.hpp:90
void CODI_UNUSED(Args const &...)
Disable unused warnings for an arbitrary number of arguments.
Definition macros.hpp:46
Represents a concrete lvalue in the CoDiPack expression tree.
Definition activeType.hpp:52
Helper class for the construction of an expression in a different context.
Definition constructStaticContext.hpp:70
T_Rhs ResultType
The resulting expression type after all nodes are replaced.
Definition constructStaticContext.hpp:86
static ResultType construct(Real *primalVector, Identifier const *const identifiers, PassiveReal const *const constantData)
Perform the construction.
typename Tape::PassiveReal PassiveReal
Basic computation type.
Definition constructStaticContext.hpp:83
T_Rhs Rhs
See ConstructStaticContextLogic.
Definition constructStaticContext.hpp:73
typename Tape::Real Real
See TapeTypesInterface.
Definition constructStaticContext.hpp:81
static constexpr size_t constantValueOffset
See ConstructStaticContextLogic.
Definition constructStaticContext.hpp:78
typename Tape::Identifier Identifier
See TapeTypesInterface.
Definition constructStaticContext.hpp:82
static constexpr size_t primalValueOffset
See ConstructStaticContextLogic.
Definition constructStaticContext.hpp:76
T_Tape Tape
See ConstructStaticContextLogic.
Definition constructStaticContext.hpp:74
Base class for all CoDiPack expressions.
Definition expressionInterface.hpp:59
static size_t constexpr value
See NumberOfActiveTypeArguments.
Definition expressionTraits.hpp:198
static size_t constexpr value
See NumberOfConstantTypeArguments.
Definition expressionTraits.hpp:224
Minimum tape interface for a working reverse tape implementation.
Definition reverseTapeInterface.hpp:78
Replacement type of LhsExpressionInterface types in ConstructStaticContext.
Definition staticContextActiveType.hpp:56