38#include "../../misc/compileTimeLoop.hpp"
39#include "../../misc/eventSystem.hpp"
41#include "../../traits/realTraits.hpp"
42#include "../lhsExpressionInterface.hpp"
43#include "../logic/constructStaticContext.hpp"
58 template<
typename T_Real,
typename T_InnerActiveType,
typename T_Impl,
bool T_isStatic>
64 CODI_DEFAULT_LHS_EXPRESSION);
68 using Tape =
typename InnerActiveType::Tape;
85 using StoreAs =
typename std::conditional<isStatic, Impl, Impl const&>::type;
92 Traits::template arrayAccess<i.value>(value) =
values[i.value].getValue();
98 template<
size_t argNumber>
107 template<
size_t argNumber>
109 return Traits::template adjointOfConstructor<argNumber>(
getValue(), adjoint);
123 template<
size_t argNumber>
132 return static_cast<Impl const&
>(*this);
137 return static_cast<Impl&
>(*this);
163 template<
typename T_Real,
typename T_InnerActiveType,
typename T_Impl>
179 template<
typename Expr>
181 store(expr, EventHints::Statement::Expression);
186 store(expr, EventHints::Statement::Copy);
192 Base::values[i.value] = Traits::template arrayAccess<i.value>(expr);
197 template<
typename Expr>
199 store(expr, EventHints::Statement::Expression);
206 store(expr, EventHints::Statement::Copy);
214 Base::values[i.value] = Traits::template arrayAccess<i.value>(expr);
223 template<
typename Rhs>
228 InnerActiveType::getTape(), lhs.getValue(), lhs.getIdentifier(),
229 Traits::template arrayAccess<i.value>(rhs.
cast().getValue()), eventType);
232 InnerActiveType::getTape().store(*
this, rhs.
cast());
#define CODI_LAMBDA_INLINE
See codi::Config::ForcedInlines.
Definition config.h:473
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition config.h:469
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:96
Statement
Classify statements.
Definition eventSystem.hpp:65
typename TraitsImplementation< Type >::PassiveReal PassiveReal
The original computation type that was used in the application.
Definition realTraits.hpp:123
CoDiPack - Code Differentiation Package.
Definition codi.hpp:94
inlinevoid static_for(F func, Args &&... args)
Static for with i = 0 .. (N - 1). See CompileTimeLoop for details.
Definition compileTimeLoop.hpp:110
inlinevoid CODI_UNUSED(Args const &...)
Disable unused warnings for an arbitrary number of arguments.
Definition macros.hpp:54
Defines an aggregated type via an array and implements the ExpressionInterface.
Definition aggregatedActiveType.hpp:59
typename Tape::Identifier InnerIdentifier
Identifier of the underlying tape.
Definition aggregatedActiveType.hpp:73
inlineInnerReal applyAdjoint(Real const &adjoint) const
Definition aggregatedActiveType.hpp:108
T_Impl Impl
See AggregatedActiveTypeBase.
Definition aggregatedActiveType.hpp:65
inlineInnerActiveType const & getLink() const
an expression.
Definition aggregatedActiveType.hpp:124
typename Traits::InnerType InnerReal
Inner real type of the active type.
Definition aggregatedActiveType.hpp:72
inlineReal const getValue() const
Compute the primal value that is usually evaluated by the statement/expression.
Definition aggregatedActiveType.hpp:89
T_InnerActiveType InnerActiveType
See AggregatedActiveTypeBase.
Definition aggregatedActiveType.hpp:63
InnerActiveType values[Elements]
Definition aggregatedActiveType.hpp:75
inlineReal applyTangent(InnerReal const &tangent) const
Definition aggregatedActiveType.hpp:99
inline ~AggregatedActiveTypeBase()=default
Destructor.
static bool constexpr isStatic
Definition aggregatedActiveType.hpp:66
static size_t constexpr LinkCount
Definition aggregatedActiveType.hpp:120
T_Real Real
See AggregatedActiveTypeBase.
Definition aggregatedActiveType.hpp:62
inlineImpl & cast()
Cast to implementation.
Definition aggregatedActiveType.hpp:136
Tape ADLogic
AD logic that governs the expression. Needs to be the same for all inputs of the expression.
Definition aggregatedActiveType.hpp:86
typename InnerActiveType::Tape Tape
The tape of the inner active type.
Definition aggregatedActiveType.hpp:68
typename std::conditional< isStatic, Impl, Impl const & >::type StoreAs
Implementation of ExpressionInterface.
Definition aggregatedActiveType.hpp:85
RealTraits::AggregatedTypeTraits< Real > Traits
The traits for the aggregated type.
Definition aggregatedActiveType.hpp:69
static inlinestd::string getMathRep()
Get the math symbol of the operation. E.g. + for operators and pow() for functions.
Definition aggregatedActiveType.hpp:113
inlineImpl const & cast() const
Cast to implementation.
Definition aggregatedActiveType.hpp:131
static int constexpr Elements
Definition aggregatedActiveType.hpp:70
Represents a concrete aggregated lvalue int the CoDiPack expression tree.
Definition aggregatedActiveType.hpp:164
T_Real Real
See AggregatedActiveType.
Definition aggregatedActiveType.hpp:166
inline ~AggregatedActiveType()=default
< Use base constructors.
RealTraits::PassiveReal< Real > PassiveReal
Passive value type of the real.
Definition aggregatedActiveType.hpp:173
inlineImpl & operator=(AggregatedActiveType const &expr)
Assign operation.
Definition aggregatedActiveType.hpp:205
T_InnerActiveType InnerActiveType
See AggregatedActiveType.
Definition aggregatedActiveType.hpp:167
AggregatedActiveTypeBase< T_Real, T_InnerActiveType, T_Impl, false > Base
Abbreviation for base class.
Definition aggregatedActiveType.hpp:170
inlineImpl & operator=(PassiveReal const &expr)
Assign operation.
Definition aggregatedActiveType.hpp:212
RealTraits::AggregatedTypeTraits< Real > Traits
The traits for the aggregated type.
Definition aggregatedActiveType.hpp:172
inlinevoid store(ExpressionInterface< Real, Rhs > const &rhs, EventHints::Statement const &eventType)
Has to be called by an AD variable every time it is assigned.
Definition aggregatedActiveType.hpp:224
T_Impl Impl
See AggregatedActiveType.
Definition aggregatedActiveType.hpp:168
inlineImpl & operator=(ExpressionInterface< Real, Expr > const &expr)
Assign operation.
Definition aggregatedActiveType.hpp:198
static inlinevoid notifyStatementPrimalListeners(Tape &tape, Real const &lhsValue, Identifier const &lhsIdentifier, Real const &newValue, EventHints::Statement statement)
Invoke callbacks for StatementPrimal events.
Definition eventSystem.hpp:264
Base class for all CoDiPack expressions.
Definition expressionInterface.hpp:60
ExpressionInterface()=default
Constructor.
inlineImpl const & cast() const
Cast to the implementation.
Definition expressionInterface.hpp:76
Methods that access inner values of aggregated types that contain CoDiPack active types.
Definition realTraits.hpp:226
int InnerType
Definition realTraits.hpp:229
static int constexpr Elements
Definition realTraits.hpp:232
static inlinestd::string getMathRep()
Definition realTraits.hpp:291