38#include "../../expressions/lhsExpressionInterface.hpp"
40#include "../../tapes/interfaces/fullTapeInterface.hpp"
41#include "../../traits/tapeTraits.hpp"
54 template<
typename T_Type,
typename T_Impl>
64 using Real =
typename Type::Real;
85 template<
typename ArgIter,
typename JacobiIter>
87 JacobiIter
const startJac) {
88 cast().startPushStatement();
90 JacobiIter jacPos = startJac;
91 ArgIter argPos = startArg;
92 while (argPos != endArg) {
93 cast().pushArgument(*argPos, *jacPos);
99 cast().endPushStatement(lhs, primal);
103 template<
typename ArgVector,
typename JacobiVector>
105 JacobiVector
const& jacobians,
size_t const size) {
106 cast().startPushStatement();
108 for (
size_t i = 0; i < size; ++i) {
109 cast().pushArgument(arguments[i], jacobians[i]);
112 cast().endPushStatement(lhs, primal);
120 return static_cast<Impl&
>(*this);
137 template<
typename T_Type,
typename =
void>
144 using Real =
typename Type::Real;
147 using Tape =
typename Type::Tape;
167 Tape& tape = Type::getTape();
188 Tape& tape = Type::getTape();
192 tape.storeManual(primal, lhs.getIdentifier(),
dataPos);
194 for (
size_t i = 0; i <
dataPos; ++i) {
200 lhs.value() = primal;
206#ifndef DOXYGEN_DISABLE
209 template<
typename T_Type>
210 struct StatementPushHelper<T_Type, TapeTraits::EnableIfForwardTape<typename T_Type::Tape>>
211 :
public StatementPushHelperBase<T_Type, StatementPushHelper<T_Type>> {
215 using Type =
CODI_DD(T_Type, CODI_DEFAULT_LHS_EXPRESSION);
217 using Real =
typename Type::Real;
218 using Gradient =
typename Type::Gradient;
232 lhsTangent = Gradient();
244 lhs.gradient() = lhsTangent;
245 lhs.value() = primal;
253 struct StatementPushHelper<double, void> {
278 template<
typename ArgIter,
typename JacobiIter>
280 JacobiIter
const startJac) {
288 template<
typename ArgVector,
typename JacobiVector>
289 void pushStatement(
Type& lhs,
Real const& primal, ArgVector
const& arguments, JacobiVector
const& jacobians,
#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_ENABLE_CHECK(option, condition)
Definition macros.hpp:53
#define CODI_T(...)
Abbreviation for CODI_TEMPLATE.
Definition macros.hpp:111
bool constexpr CheckZeroIndex
Ignore active types that are not dependent on any input value in Jacobian tapes.
Definition config.h:178
bool constexpr IgnoreInvalidJacobians
Ignore invalid Jacobians like NaN or Inf.
Definition config.h:240
bool constexpr CheckTapeActivity
Makes it possible to ignore certain code parts. If turned of everything will be recorded.
Definition config.h:170
bool constexpr CheckJacobianIsZero
Ignore Jacobians that are zero in Jacobian based tapes.
Definition config.h:162
size_t constexpr MaxArgumentSize
Maximum number of arguments in a statement.
Definition config.h:120
bool isTotalFinite(Type const &v)
Function for checking if all values of the type are finite.
Definition realTraits.hpp:133
bool isTotalZero(Type const &v)
Function for checking if the value of the type is completely zero.
Definition realTraits.hpp:139
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
Gradient getGradient() const
Get the gradient of this lvalue from the tape.
Definition lhsExpressionInterface.hpp:115
Base class for manual statement pushes on the tape.
Definition statementPushHelper.hpp:55
T_Type Type
See StatementPushHelperBase.
Definition statementPushHelper.hpp:59
void pushArgument(Type const &arg, Real const &jacobian)
Add the Jacobian of an argument of the statement.
typename Type::Real Real
See LhsExpressionInterface.
Definition statementPushHelper.hpp:64
T_Impl Impl
See StatementPushHelperBase.
Definition statementPushHelper.hpp:62
void startPushStatement()
Initialize all data for the push of a statement.
void pushStatement(Type &lhs, Real const &primal, ArgIter const startArg, ArgIter const endArg, JacobiIter const startJac)
Push a complete statement where the Jacobians and arguments are provided as iterator objects.
Definition statementPushHelper.hpp:86
void endPushStatement(Type &lhs, Real const &primal)
Finish the push of a statement. Performs lhs = primal and cleans up all data.
void pushStatement(Type &lhs, Real const &primal, ArgVector const &arguments, JacobiVector const &jacobians, size_t const size)
Push a complete statement where the Jacobians and arguments are provided as arrays.
Definition statementPushHelper.hpp:104
Add statements to the tape where the Jacobians are computed manually.
Definition statementPushHelper.hpp:138
void endPushStatement(Type &lhs, Real const &primal)
Finish the push of a statement. Performs lhs = primal and cleans up all data.
Definition statementPushHelper.hpp:187
T_Type Type
< See StatementPushHelper.
Definition statementPushHelper.hpp:142
void startPushStatement()
Initialize all data for the push of a statement.
Definition statementPushHelper.hpp:161
size_t dataPos
Current number of arguments.
Definition statementPushHelper.hpp:152
void pushArgument(Type const &arg, Real const &jacobian)
Add the Jacobian of an argument of the statement.
Definition statementPushHelper.hpp:166
typename Type::Identifier Identifier
Definition statementPushHelper.hpp:145
Identifier indexData[Config::MaxArgumentSize]
Storage for the identifiers of the arguments.
Definition statementPushHelper.hpp:150
typename Type::Tape Tape
See LhsExpressionInterface.
Definition statementPushHelper.hpp:147
Real jacobianData[Config::MaxArgumentSize]
Storage for the Jacobians of the arguments.
Definition statementPushHelper.hpp:151
typename Type::Real Real
See LhsExpressionInterface.
Definition statementPushHelper.hpp:144