38#include "../../expressions/lhsExpressionInterface.hpp"
40#include "../../tapes/interfaces/fullTapeInterface.hpp"
41#include "../../tapes/misc/adjointVectorAccess.hpp"
42#include "../../tapes/misc/vectorAccessInterface.hpp"
43#include "../../traits/tapeTraits.hpp"
60 template<
typename T_Type>
67 using Real =
typename Type::Real;
71 using Tape =
typename Type::Tape;
114 evaluate(tape->getPosition(), tape->getZeroPosition());
119 evaluate(tape->getPosition(), tape->getZeroPosition());
156 template<
typename T_Type,
typename T_Gradient>
166 using Real =
typename Type::Real;
214 checkAdjointVectorSize();
222 checkAdjointVectorSize();
234 checkAdjointVectorSize();
261 checkAdjointVectorSize();
282 gradient(identifier) = gradientValue;
289 void checkAdjointVectorSize() {
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:96
CoDiPack - Code Differentiation Package.
Definition codi.hpp:94
@ LargestIdentifier
[A: R] Largest identifier distributed by the index manger.
Definition tapeParameters.hpp:60
Implementation of VectorAccessInterface for adjoint vectors.
Definition adjointVectorAccess.hpp:61
void clearAdjoints()
Set all adjoints to zero.
Definition customAdjointVectorHelper.hpp:200
Gradient const & gradient(Identifier const &identifier) const
Get a constant reference to the gradient. Checked access.
Definition customAdjointVectorHelper.hpp:272
Gradient & gradientUnchecked(Identifier const &identifier)
Get a reference to the gradient. Unchecked access.
Definition customAdjointVectorHelper.hpp:250
VectorAccessInterface< Real, Identifier > * getVectorInterface()
Get a new general interface to the adjoint vector.
Definition customAdjointVectorHelper.hpp:229
CustomAdjointVectorInterface< Type > Base
Abbreviation for the base class.
Definition customAdjointVectorHelper.hpp:164
Gradient & gradient(Identifier const &identifier)
Get a reference to the gradient. Checked access.
Definition customAdjointVectorHelper.hpp:260
~CustomAdjointVectorHelper()
Destructor.
Definition customAdjointVectorHelper.hpp:189
typename Tape::Position Position
See PositionalEvaluationTapeInterface.
Definition customAdjointVectorHelper.hpp:171
T_Type Type
< See CustomAdjointVectorHelper.
Definition customAdjointVectorHelper.hpp:161
Gradient const & gradientUnchecked(Identifier const &identifier) const
Get a constant reference to the gradient. Unchecked access.
Definition customAdjointVectorHelper.hpp:255
void evaluateForward(Position const &start, Position const &end)
Perform a forward evaluation of a part of the tape. It has to hold start <= end.
Definition customAdjointVectorHelper.hpp:221
Gradient const & getGradient(Identifier const &identifier) const
Get a constant reference to the gradient.
Definition customAdjointVectorHelper.hpp:245
typename Type::Real Real
See LhsExpressionInterface.
Definition customAdjointVectorHelper.hpp:166
T_Gradient Gradient
See CustomAdjointVectorHelper.
Definition customAdjointVectorHelper.hpp:162
AdjointVectorAccess< Real, Identifier, Gradient * > * adjointInterface
Last created adjoint interface.
Definition customAdjointVectorHelper.hpp:180
void deleteAdjointVector()
Delete the adjoint vector.
Definition customAdjointVectorHelper.hpp:207
Gradient zeroValue
Temporary zero value.
Definition customAdjointVectorHelper.hpp:176
std::vector< Gradient > adjointVector
Custom adjoint vector.
Definition customAdjointVectorHelper.hpp:174
typename Type::Tape Tape
See LhsExpressionInterface.
Definition customAdjointVectorHelper.hpp:170
Gradient const constZeroValue
Temporary constant zero value.
Definition customAdjointVectorHelper.hpp:177
CustomAdjointVectorHelper()
Constructor.
Definition customAdjointVectorHelper.hpp:185
typename Type::Identifier Identifier
See LhsExpressionInterface.
Definition customAdjointVectorHelper.hpp:167
void setGradient(Identifier &identifier, Gradient const &gradientValue)
Set the gradient. Checked access.
Definition customAdjointVectorHelper.hpp:281
void evaluate(Position const &start, Position const &end)
Perform a full reverse evaluation of the tape.
Definition customAdjointVectorHelper.hpp:213
void evaluateForward()
Perform a forward evaluation of a part of the tape. It has to hold start <= end.
Definition customAdjointVectorHelper.hpp:118
CustomAdjointVectorInterface()
Constructor.
Definition customAdjointVectorHelper.hpp:81
void evaluate()
Perform a full reverse evaluation of the tape.
Definition customAdjointVectorHelper.hpp:113
typename Type::Identifier Identifier
See LhsExpressionInterface.
Definition customAdjointVectorHelper.hpp:68
virtual VectorAccessInterface< Real, Identifier > * getVectorInterface()=0
Get a new general interface to the adjoint vector.
T_Type Type
See CustomAdjointVectorInterface.
Definition customAdjointVectorHelper.hpp:65
typename Tape::Position Position
See PositionalEvaluationTapeInterface.
Definition customAdjointVectorHelper.hpp:72
void setTape(Tape &tape)
Set the tape for the evaluations.
Definition customAdjointVectorHelper.hpp:123
virtual ~CustomAdjointVectorInterface()
Destructor.
Definition customAdjointVectorHelper.hpp:84
virtual void deleteAdjointVector()=0
Delete the adjoint vector.
virtual void clearAdjoints()=0
Set all adjoints to zero.
typename Type::Real Real
See LhsExpressionInterface.
Definition customAdjointVectorHelper.hpp:67
virtual void evaluateForward(Position const &start, Position const &end)=0
Perform a forward evaluation of a part of the tape. It has to hold start <= end.
virtual void evaluate(Position const &start, Position const &end)=0
Perform a reverse evaluation for a part of the tape. It hast to hold start >= end.
Tape & getTape()
Definition customAdjointVectorHelper.hpp:128
typename Type::Tape Tape
See LhsExpressionInterface.
Definition customAdjointVectorHelper.hpp:71
Unified access to the adjoint vector and primal vector in a tape evaluation.
Definition vectorAccessInterface.hpp:94