40#include "internalAdjointsInterface.hpp"
52 template<
typename T_Gradient,
typename T_Identifier,
typename T_Tape>
63 std::vector<Gradient> adjoints;
73 return adjoints[(size_t)identifier];
78 return adjoints[(size_t)identifier];
83 return adjoints.data();
88 return adjoints.size();
93 adjoints.resize((
size_t)newSize);
98 for (
Gradient& gradient : adjoints) {
105 std::swap(adjoints, other.adjoints);
#define CODI_NO_INLINE
See codi::Config::AvoidedInlines.
Definition config.h:417
#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_T(...)
Abbreviation for CODI_TEMPLATE.
Definition macros.hpp:111
CoDiPack - Code Differentiation Package.
Definition codi.hpp:90
Full tape interface that supports all features of CoDiPack.
Definition fullTapeInterface.hpp:82
Abstracts the internal set of adjoint variables provided as part of the tape.
Definition internalAdjointsInterface.hpp:80
Adjoint variables owned by a tape instance.
Definition localAdjoints.hpp:53
LocalAdjoints(size_t initialSize)
Constructor.
Definition localAdjoints.hpp:68
void endUse()
Declare that the adjoints are no longer occupied.
Definition localAdjoints.hpp:112
size_t size() const
Returns the number of adjoint variables. Internally, declares usage of the adjoints.
Definition localAdjoints.hpp:87
Gradient & operator[](Identifier const &identifier)
Reference access to the adjoint variable identified by identifier.
Definition localAdjoints.hpp:72
T_Gradient Gradient
See LocalAdjoints.
Definition localAdjoints.hpp:58
Gradient const & operator[](Identifier const &identifier) const
Constant reference access to the adjoint variable identified by identifier.
Definition localAdjoints.hpp:77
Gradient * data()
Pointer to an underlying array implementation.
Definition localAdjoints.hpp:82
void beginUse()
Declare that the adjoints are in use, e.g., during a tape evaluation, and cannot be resized right now...
Definition localAdjoints.hpp:109
T_Identifier Identifier
See LocalAdjoints.
Definition localAdjoints.hpp:59
void zeroAll()
Set all adjoint variables to Gradient().
Definition localAdjoints.hpp:97
T_Tape Tape
See LocalAdjoints.
Definition localAdjoints.hpp:56
void resize(Identifier const &newSize)
Ensure that identifiers up to newSize can be passed to operator[] without error.
Definition localAdjoints.hpp:92
void swap(LocalAdjoints &other)
Swap two sets of adjoint variables. Internally, declares usage of the adjoints.
Definition localAdjoints.hpp:104