37#include "../interfaces/fullTapeInterface.hpp"
38#include "../misc/adjointVectorAccess.hpp"
39#include "tagTapeBase.hpp"
54 template<
typename T_Real,
typename T_Tag>
56 public TagTapeBase<T_Real, T_Tag, T_Real, TagTapeReverse<T_Real, T_Tag>> {
83 std::set<TapeParameters> parameters;
95 template<
typename Adjo
int>
101 template<
typename Adjo
int>
150 template<
typename Adjo
int>
163 std::swap(active, other.active);
164 std::swap(parameters, other.parameters);
176 template<
typename Lhs>
260 template<
typename Lhs>
274 template<
typename Real>
281 template<
typename Real>
287 template<
typename Lhs,
typename Rhs>
293 validate.
eval(rhs, vi, *
this);
304 lhs.
cast().value() = rhs.
cast().getValue();
308 template<
typename Lhs,
typename Rhs>
315 template<
typename Lhs>
321 lhs.
cast().value() = rhs;
436 template<
typename Lhs>
443 template<
typename Lhs>
474 void reset(
bool resetAdjoints =
true) {
479 template<
typename Stream = std::ostream>
485 template<
typename Stream = std::ostream>
491 template<
typename Stream = std::ostream>
#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
uint8_t ArgumentSize
Type for the number of arguments in statements.
Definition: config.h:117
typename TraitsImplementation< Type >::PassiveReal PassiveReal
The original computation type, that was used in the application.
Definition: realTraits.hpp:117
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
TapeParameters
Configuration options for a tape.
Definition: tapeParameters.hpp:52
Empty Position with no nested data.
Definition: position.hpp:47
Base class for all CoDiPack expressions.
Definition: expressionInterface.hpp:59
Impl const & cast() const
Cast to the implementation.
Definition: expressionInterface.hpp:75
User-defined evaluation functions for the taping process.
Definition: externalFunction.hpp:102
Full tape interface that supports all features of CoDiPack.
Definition: fullTapeInterface.hpp:82
Base class for all CoDiPack lvalue expression.
Definition: lhsExpressionInterface.hpp:63
Identifier const & getIdentifier() const
Impl & cast()
Cast to the implementation.
Definition: lhsExpressionInterface.hpp:99
EnumBitset< TagFlags > properties
Current properties of the value.
Definition: tagData.hpp:62
Tag tag
Current tag of the value.
Definition: tagData.hpp:61
Base implementation for tagging tapes.
Definition: tagTapeBase.hpp:73
void verifyRegisterValue(LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value, const Identifier &tag)
Verify tag, properties and lhs error.
Definition: tagTapeBase.hpp:318
void resetTag(Tag &tag) const
Reset tag on value.
Definition: tagTapeBase.hpp:335
void handleError(ValidationIndicator< Real, Tag > &vi) const
Call tag error callback.
Definition: tagTapeBase.hpp:305
void setTag(Tag &tag) const
Set tag on value.
Definition: tagTapeBase.hpp:330
static Tag constexpr PassiveTag
Tag indicating an inactive value.
Definition: tagTapeBase.hpp:88
void verifyTag(ValidationIndicator< Real, Tag > &vi, Tag const &tag) const
Checks if the tag is correct. Errors are set on the ValidationIndicator object.
Definition: tagTapeBase.hpp:225
void verifyTagAndProperties(Tag const &tag, Real const &value, const EnumBitset< TagFlags > &properties) const
Checks if the tag and the properties are correct.
Definition: tagTapeBase.hpp:255
void checkLhsError(Real &lhsValue, Identifier &lhsIdentifier, const Real &rhs) const
Check if a property for the lhs value is triggered.
Definition: tagTapeBase.hpp:288
void swap(Impl &other)
Swap members.
Definition: tagTapeBase.hpp:129
Required definition for event system.
Definition: tagTapeReverse.hpp:63
int Index
Required definition for event system.
Definition: tagTapeReverse.hpp:65
Required definition for event system.
Definition: tagTapeReverse.hpp:61
Tape for tagging variables and find errors in the AD workflow.
Definition: tagTapeReverse.hpp:56
TagTapeReverse()
Constructor.
Definition: tagTapeReverse.hpp:88
void resetHard()
Do nothing.
Definition: tagTapeReverse.hpp:167
void deleteAdjointVector()
Do nothing.
Definition: tagTapeReverse.hpp:168
void destroyIdentifier(Real &value, Identifier &identifier)
Do nothing.
Definition: tagTapeReverse.hpp:282
void clearAdjoints(Position const &start, Position const &end)
Do nothing.
Definition: tagTapeReverse.hpp:353
bool hasParameter(TapeParameters parameter) const
Do nothing.
Definition: tagTapeReverse.hpp:135
void evaluate()
Do nothing.
Definition: tagTapeReverse.hpp:468
Gradient & gradient(Identifier const &identifier)
Verify tag.
Definition: tagTapeReverse.hpp:221
Real const & primal(Identifier const &identifier) const
Do nothing.
Definition: tagTapeReverse.hpp:420
void deleteVectorAccess(VectorAccessInterface< Real, Identifier > *access)
Do nothing.
Definition: tagTapeReverse.hpp:157
void printTableRow(Stream &out=std::cout) const
Do nothing.
Definition: tagTapeReverse.hpp:492
void deleteData()
Do nothing.
Definition: tagTapeReverse.hpp:122
Gradient const & getGradient(Identifier const &identifier) const
Verify tag.
Definition: tagTapeReverse.hpp:214
void setPassive()
Set tape to passive.
Definition: tagTapeReverse.hpp:454
Identifier getInvalidIndex() const
-1 tag.
Definition: tagTapeReverse.hpp:248
void evaluateForward(Position const &start, Position const &end, Adjoint *data)
Do nothing.
Definition: tagTapeReverse.hpp:102
Real & primal(Identifier const &identifier)
Do nothing.
Definition: tagTapeReverse.hpp:414
TapeValues getTapeValues() const
Do nothing.
Definition: tagTapeReverse.hpp:497
void setParameter(TapeParameters parameter, size_t value)
Do nothing.
Definition: tagTapeReverse.hpp:140
void initIdentifier(Real &value, Identifier &identifier)
Do nothing.
Definition: tagTapeReverse.hpp:275
VectorAccessInterface< Real, Identifier > * createVectorAccessCustomAdjoints(Adjoint *data)
Do nothing.
Definition: tagTapeReverse.hpp:151
bool isActive() const
Check if tape is active.
Definition: tagTapeReverse.hpp:459
TagData< Tag > Identifier
See TapeTypesInterface.
Definition: tagTapeReverse.hpp:70
void setActive()
Set tape to active.
Definition: tagTapeReverse.hpp:449
void setGradient(Identifier const &identifier, Gradient const &gradient)
Verify tag.
Definition: tagTapeReverse.hpp:207
Position getPosition() const
Do nothing.
Definition: tagTapeReverse.hpp:358
void clearAdjoints()
Do nothing.
Definition: tagTapeReverse.hpp:471
Gradient const & gradient(Identifier const &identifier) const
Verify tag.
Definition: tagTapeReverse.hpp:228
size_t getParameter(TapeParameters parameter) const
Do nothing.
Definition: tagTapeReverse.hpp:130
Identifier getPassiveIndex() const
Zero tag.
Definition: tagTapeReverse.hpp:243
static bool constexpr LinearIndexHandling
Behave as linear index handler.
Definition: tagTapeReverse.hpp:240
void revertPrimals(Position const &pos)
Do nothing.
Definition: tagTapeReverse.hpp:426
void pushExternalFunction(ExternalFunction< TagTapeReverse > const &extFunc)
Do nothing.
Definition: tagTapeReverse.hpp:184
void evaluatePrimal()
Do nothing.
Definition: tagTapeReverse.hpp:400
void store(LhsExpressionInterface< Real, Gradient, TagTapeReverse, Lhs > &lhs, ExpressionInterface< Real, Rhs > const &rhs)
Verify all tags of the rhs and the lhs properties.
Definition: tagTapeReverse.hpp:288
void registerOutput(LhsExpressionInterface< Real, Gradient, TagTapeReverse, Lhs > &value)
Verify tag.
Definition: tagTapeReverse.hpp:444
void setPrimal(Identifier const &identifier, Real const &gradient)
Do nothing.
Definition: tagTapeReverse.hpp:403
static bool constexpr HasPrimalValues
No primal values.
Definition: tagTapeReverse.hpp:391
Real registerExternalFunctionOutput(LhsExpressionInterface< Real, Gradient, TagTapeReverse, Lhs > &value)
Verifies tag properties.
Definition: tagTapeReverse.hpp:177
void evaluateForward()
Do nothing.
Definition: tagTapeReverse.hpp:199
static bool constexpr AllowJacobianOptimization
Do not allow Jacobian optimization.
Definition: tagTapeReverse.hpp:271
void storeManual(Real const &lhsValue, Identifier &lhsIndex, Config::ArgumentSize const &size)
Set tag on lhs.
Definition: tagTapeReverse.hpp:335
void reset(bool resetAdjoints=true)
Do nothing.
Definition: tagTapeReverse.hpp:474
Real const & getPrimal(Identifier const &identifier) const
Do nothing.
Definition: tagTapeReverse.hpp:408
Position getZeroPosition() const
Do nothing.
Definition: tagTapeReverse.hpp:363
T_Real Real
See TagTapeReverse.
Definition: tagTapeReverse.hpp:57
void swap(TagTapeReverse &other)
Swap members.
Definition: tagTapeReverse.hpp:162
std::set< TapeParameters > const & getAvailableParameters() const
Empty set.
Definition: tagTapeReverse.hpp:125
void evaluateKeepState(Position const &start, Position const &end)
Do nothing.
Definition: tagTapeReverse.hpp:378
void evaluate(Position const &start, Position const &end, Adjoint *data)
Do nothing.
Definition: tagTapeReverse.hpp:96
void writeToFile(std::string const &filename) const
Do nothing.
Definition: tagTapeReverse.hpp:112
void evaluate(Position const &start, Position const &end)
Do nothing.
Definition: tagTapeReverse.hpp:348
void store(LhsExpressionInterface< Real, Gradient, TagTapeReverse, Lhs > &lhs, PassiveReal const &rhs)
Verify the lhs properties.
Definition: tagTapeReverse.hpp:316
RealTraits::PassiveReal< Real > PassiveReal
Basic computation type.
Definition: tagTapeReverse.hpp:73
void deactivateValue(LhsExpressionInterface< Real, Gradient, TagTapeReverse, Lhs > &value)
Set tag to passive.
Definition: tagTapeReverse.hpp:261
void evaluateForward(Position const &start, Position const &end)
Do nothing.
Definition: tagTapeReverse.hpp:194
VectorAccessInterface< Real, Identifier > * createVectorAccess()
Do nothing.
Definition: tagTapeReverse.hpp:145
void resetTo(Position const &pos, bool resetAdjoints=true)
Do nothing.
Definition: tagTapeReverse.hpp:368
void evaluateForwardKeepState(Position const &start, Position const &end)
Do nothing.
Definition: tagTapeReverse.hpp:382
void store(LhsExpressionInterface< Real, Gradient, TagTapeReverse, Lhs > &lhs, LhsExpressionInterface< Real, Gradient, TagTapeReverse, Rhs > const &rhs)
Verify all tags of the rhs and the lhs properties.
Definition: tagTapeReverse.hpp:309
void evaluatePrimal(Position const &start, Position const &end)
Do nothing.
Definition: tagTapeReverse.hpp:395
void registerInput(LhsExpressionInterface< Real, Gradient, TagTapeReverse, Lhs > &value)
Verify value properties.
Definition: tagTapeReverse.hpp:437
T_Tag Tag
See TagTapeReverse.
Definition: tagTapeReverse.hpp:58
void printStatistics(Stream &out=std::cout) const
Do nothing.
Definition: tagTapeReverse.hpp:480
bool isActive(Identifier const &identifier) const
Default check.
Definition: tagTapeReverse.hpp:464
bool isIdentifierActive(Identifier const &index) const
Verify tag.
Definition: tagTapeReverse.hpp:253
void pushJacobiManual(Real const &jacobian, Real const &value, Identifier const &index)
Do nothing.
Definition: tagTapeReverse.hpp:330
Real Gradient
See TapeTypesInterface.
Definition: tagTapeReverse.hpp:69
static bool constexpr RequiresPrimalRestore
No primal values.
Definition: tagTapeReverse.hpp:392
EmptyPosition Position
See TapeTypesInterface.
Definition: tagTapeReverse.hpp:71
void readFromFile(std::string const &filename)
Do nothing.
Definition: tagTapeReverse.hpp:117
void printTableHeader(Stream &out=std::cout) const
Do nothing.
Definition: tagTapeReverse.hpp:486
Tape information that can be printed in a pretty print format or a table format.
Definition: tapeValues.hpp:73
void eval(NodeInterface< Node > const &node, Args &&... args)
Start the evaluation of the logic on the given expression.
Definition: traversalLogic.hpp:70
Helper class for statement validation.
Definition: tagTapeBase.hpp:49
bool isActive
true if an active rhs is detected. tag != 0
Definition: tagTapeBase.hpp:50
Unified access to the adjoint vector and primal vector in a tape evaluation.
Definition: vectorAccessInterface.hpp:91