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>> {
84 std::set<TapeParameters> parameters;
102 template<
typename Adjo
int>
108 template<
typename Adjo
int>
161 template<
typename Adjo
int>
174 std::swap(active, other.active);
175 std::swap(parameters, other.parameters);
191 template<
typename Lhs>
275 template<
typename Lhs>
393 template<
typename Lhs>
400 template<
typename Lhs>
431 void reset(
bool resetAdjoints =
true) {
436 template<
typename Stream = std::ostream>
442 template<
typename Stream = std::ostream>
448 template<
typename Stream = std::ostream>
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:97
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:123
CoDiPack - Code Differentiation Package.
Definition codi.hpp:98
TapeParameters
Configuration options for a tape.
Definition tapeParameters.hpp:52
inlinevoid CODI_UNUSED(Args const &...)
Disable unused warnings for an arbitrary number of arguments.
Definition macros.hpp:55
AdjointsManagement
Policies for management of the tape's interal adjoints.
Definition tapeParameters.hpp:100
@ Automatic
Manage internal adjoints automatically, including locking, bounds checking, and resizing.
Definition tapeParameters.hpp:102
Empty Position with no nested data.
Definition position.hpp:47
User-defined evaluation functions for the taping process.
Definition externalFunction.hpp:118
Full tape interface that supports all features of CoDiPack.
Definition fullTapeInterface.hpp:89
static Index constexpr InactiveIndex
Default inactive index for all index managers.
Definition indexManagerInterface.hpp:87
static Index constexpr InvalidIndex
Default invalid index for all index mangers (max value for unsigned types).
Definition indexManagerInterface.hpp:88
Base class for all CoDiPack lvalue expression.
Definition lhsExpressionInterface.hpp:63
TapeData const & getTapeData() const
Get the data of the tape stored in this lhs expression.
inlineImpl & cast()
Cast to the implementation.
Definition lhsExpressionInterface.hpp:103
Data for a tag.
Definition tagData.hpp:56
Tag tag
Current tag of the value.
Definition tagData.hpp:61
inlinevoid setTag(Tag &tag) const
Definition tagTapeBase.hpp:499
static bool constexpr AllowJacobianOptimization
Definition tagTapeBase.hpp:203
ValidationIndicator< Real, Tag > vi
Definition tagTapeBase.hpp:134
void destroyTapeData(Real &value, ActiveTypeTapeData &data)
Definition tagTapeBase.hpp:214
inlinevoid handleError(ValidationIndicator< Real, Tag > &vi) const
Definition tagTapeBase.hpp:479
inlinevoid verifyRegisterValue(LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value)
Definition tagTapeBase.hpp:438
inlineIdentifier const & getIdentifier(ActiveTypeTapeData const &data)
Definition tagTapeBase.hpp:184
TagTapeBase()
Definition tagTapeBase.hpp:140
static Tag constexpr PassiveTag
Definition tagTapeBase.hpp:111
void initTapeData(Real &value, ActiveTypeTapeData &data)
Definition tagTapeBase.hpp:207
inlinevoid store(AggregatedActiveType< Aggregated, Type, Lhs > &lhs, ExpressionInterface< Aggregated, Rhs > const &rhs)
Definition tagTapeBase.hpp:220
inlinevoid verifyLhsWrite(Real const &lhsValue, ActiveTypeTapeData const &lhsData, Real const &rhsValue, ValidationIndicator< Real, Tag > &vi)
Definition tagTapeBase.hpp:426
void swap(Impl &other)
Definition tagTapeBase.hpp:167
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
TagTapeReverse()
Constructor.
Definition tagTapeReverse.hpp:89
void resetHard()
Do nothing.
Definition tagTapeReverse.hpp:178
void deleteAdjointVector()
Do nothing.
Definition tagTapeReverse.hpp:180
void clearAdjoints(Position const &start, Position const &end)
Do nothing.
Definition tagTapeReverse.hpp:310
bool hasParameter(TapeParameters parameter) const
Do nothing.
Definition tagTapeReverse.hpp:144
void evaluate()
Do nothing.
Definition tagTapeReverse.hpp:425
Real const & primal(Identifier const &identifier) const
Do nothing.
Definition tagTapeReverse.hpp:377
void deleteVectorAccess(VectorAccessInterface< Real, Identifier > *access)
Do nothing.
Definition tagTapeReverse.hpp:168
void printTableRow(Stream &out=std::cout) const
Do nothing.
Definition tagTapeReverse.hpp:449
void resizeAdjointVector()
Do nothing.
Definition tagTapeReverse.hpp:181
void deleteData()
Do nothing.
Definition tagTapeReverse.hpp:129
void setPassive()
Set tape to passive.
Definition tagTapeReverse.hpp:411
Identifier getInvalidIndex() const
-1 id.
Definition tagTapeReverse.hpp:265
void evaluateForward(Position const &start, Position const &end, Adjoint *data)
Do nothing.
Definition tagTapeReverse.hpp:109
Real & primal(Identifier const &identifier)
Do nothing.
Definition tagTapeReverse.hpp:371
TapeValues getTapeValues() const
Do nothing.
Definition tagTapeReverse.hpp:454
void setParameter(TapeParameters parameter, size_t value)
Do nothing.
Definition tagTapeReverse.hpp:151
TagData< Tag > ActiveTypeTapeData
See TapeTypesInterface.
Definition tagTapeReverse.hpp:71
int Identifier
See TapeTypesInterface.
Definition tagTapeReverse.hpp:70
Gradient const & getGradient(Identifier const &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic) const
Verify tag.
Definition tagTapeReverse.hpp:228
VectorAccessInterface< Real, Identifier > * createVectorAccessCustomAdjoints(Adjoint *data)
Do nothing.
Definition tagTapeReverse.hpp:162
bool isActive() const
Check if tape is active.
Definition tagTapeReverse.hpp:416
Gradient & gradient(Identifier const &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
Verify tag.
Definition tagTapeReverse.hpp:236
void setActive()
Set tape to active.
Definition tagTapeReverse.hpp:406
void endUseAdjointVector()
Do nothing.
Definition tagTapeReverse.hpp:183
Position getPosition() const
Do nothing.
Definition tagTapeReverse.hpp:315
void clearAdjoints()
Do nothing.
Definition tagTapeReverse.hpp:428
void pushJacobiManual(Real const &jacobian, Real const &value, ActiveTypeTapeData const &index)
Do nothing.
Definition tagTapeReverse.hpp:286
size_t getParameter(TapeParameters parameter) const
Do nothing.
Definition tagTapeReverse.hpp:137
Identifier getPassiveIndex() const
Zero id.
Definition tagTapeReverse.hpp:260
static bool constexpr LinearIndexHandling
Behave as linear index handler.
Definition tagTapeReverse.hpp:257
void revertPrimals(Position const &pos)
Do nothing.
Definition tagTapeReverse.hpp:383
void pushExternalFunction(ExternalFunction< TagTapeReverse > const &extFunc)
Do nothing.
Definition tagTapeReverse.hpp:199
void evaluatePrimal()
Do nothing.
Definition tagTapeReverse.hpp:357
T_Real Real
See TagTapeReverse.
Definition tagTapeReverse.hpp:57
void registerOutput(LhsExpressionInterface< Real, Gradient, TagTapeReverse, Lhs > &value)
Verify tag.
Definition tagTapeReverse.hpp:401
void setPrimal(Identifier const &identifier, Real const &gradient)
Do nothing.
Definition tagTapeReverse.hpp:360
static bool constexpr HasPrimalValues
No primal values.
Definition tagTapeReverse.hpp:348
Real registerExternalFunctionOutput(LhsExpressionInterface< Real, Gradient, TagTapeReverse, Lhs > &value)
Verifies tag properties.
Definition tagTapeReverse.hpp:192
void evaluateForward()
Do nothing.
Definition tagTapeReverse.hpp:214
void reset(bool resetAdjoints=true)
Do nothing.
Definition tagTapeReverse.hpp:431
Real const & getPrimal(Identifier const &identifier) const
Do nothing.
Definition tagTapeReverse.hpp:365
Position getZeroPosition() const
Do nothing.
Definition tagTapeReverse.hpp:320
void beginUseAdjointVector()
Do nothing.
Definition tagTapeReverse.hpp:182
void storeManual(Real const &lhsValue, ActiveTypeTapeData &lhsIndex, Config::ArgumentSize const &size)
Set tag on lhs.
Definition tagTapeReverse.hpp:291
void swap(TagTapeReverse &other)
Swap members.
Definition tagTapeReverse.hpp:173
std::set< TapeParameters > const & getAvailableParameters() const
Empty set.
Definition tagTapeReverse.hpp:132
void evaluateKeepState(Position const &start, Position const &end)
Do nothing.
Definition tagTapeReverse.hpp:335
Gradient const & gradient(Identifier const &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic) const
Verify tag.
Definition tagTapeReverse.hpp:244
void evaluate(Position const &start, Position const &end, Adjoint *data)
Do nothing.
Definition tagTapeReverse.hpp:103
void writeToFile(std::string const &filename) const
Do nothing.
Definition tagTapeReverse.hpp:119
void evaluate(Position const &start, Position const &end)
Do nothing.
Definition tagTapeReverse.hpp:305
T_Tag Tag
See TagTapeReverse.
Definition tagTapeReverse.hpp:58
RealTraits::PassiveReal< Real > PassiveReal
Basic computation type.
Definition tagTapeReverse.hpp:74
void setGradient(Identifier const &identifier, Gradient const &gradient, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
Verify tag.
Definition tagTapeReverse.hpp:222
void deactivateValue(LhsExpressionInterface< Real, Gradient, TagTapeReverse, Lhs > &value)
Set tag to passive.
Definition tagTapeReverse.hpp:276
void evaluateForward(Position const &start, Position const &end)
Do nothing.
Definition tagTapeReverse.hpp:209
VectorAccessInterface< Real, Identifier > * createVectorAccess()
Do nothing.
Definition tagTapeReverse.hpp:156
void resetTo(Position const &pos, bool resetAdjoints=true)
Do nothing.
Definition tagTapeReverse.hpp:325
void evaluateForwardKeepState(Position const &start, Position const &end)
Do nothing.
Definition tagTapeReverse.hpp:339
void evaluatePrimal(Position const &start, Position const &end)
Do nothing.
Definition tagTapeReverse.hpp:352
void registerInput(LhsExpressionInterface< Real, Gradient, TagTapeReverse, Lhs > &value)
Verify value properties.
Definition tagTapeReverse.hpp:394
void printStatistics(Stream &out=std::cout) const
Do nothing.
Definition tagTapeReverse.hpp:437
bool isActive(Identifier const &identifier) const
Default check.
Definition tagTapeReverse.hpp:421
bool isIdentifierActive(Identifier const &index) const
Verify tag.
Definition tagTapeReverse.hpp:270
TagTapeBase< T_Real, T_Tag, T_Real, TagTapeReverse > Base
Base class abbreviation.
Definition tagTapeReverse.hpp:76
Real Gradient
See TapeTypesInterface.
Definition tagTapeReverse.hpp:69
static bool constexpr RequiresPrimalRestore
No primal values.
Definition tagTapeReverse.hpp:349
EmptyPosition Position
See TapeTypesInterface.
Definition tagTapeReverse.hpp:72
void readFromFile(std::string const &filename)
Do nothing.
Definition tagTapeReverse.hpp:124
void printTableHeader(Stream &out=std::cout) const
Do nothing.
Definition tagTapeReverse.hpp:443
Tape information that can be printed in a pretty print format or a table format.
Definition tapeValues.hpp:75
Unified access to the adjoint vector and primal vector in a tape evaluation.
Definition vectorAccessInterface.hpp:94