40#include "../../traits/adjointVectorTraits.hpp"
41#include "internalAdjointsInterface.hpp"
53 template<
typename T_Gradient,
typename T_Identifier,
typename T_Tape>
64 std::vector<Gradient> adjoints;
74 return adjoints[(size_t)identifier];
79 return adjoints[(size_t)identifier];
84 return adjoints.data();
89 return adjoints.size();
94 adjoints.resize((
size_t)newSize);
107 std::swap(adjoints, other.adjoints);
117#ifndef DOXYGEN_DISABLE
120 namespace AdjointVectorTraits {
121 template<
typename T_Gradient,
typename T_Identifier,
typename T_Tape>
122 struct GradientImplementation<LocalAdjoints<T_Gradient, T_Identifier, T_Tape>> {
124 using Gradient = T_Gradient;
#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:91
Full tape interface that supports all features of CoDiPack.
Definition fullTapeInterface.hpp:84
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:54
LocalAdjoints(size_t initialSize)
Constructor.
Definition localAdjoints.hpp:69
void endUse()
Declare that the adjoints are no longer occupied.
Definition localAdjoints.hpp:114
void zeroAll(Identifier const &maxIdentifier)
Set all adjoint variables up to and including maxIdentifier to Gradient().
Definition localAdjoints.hpp:98
size_t size() const
Returns the number of adjoint variables. Internally, declares usage of the adjoints.
Definition localAdjoints.hpp:88
Gradient & operator[](Identifier const &identifier)
Reference access to the adjoint variable identified by identifier.
Definition localAdjoints.hpp:73
T_Gradient Gradient
See LocalAdjoints.
Definition localAdjoints.hpp:59
Gradient const & operator[](Identifier const &identifier) const
Constant reference access to the adjoint variable identified by identifier.
Definition localAdjoints.hpp:78
Gradient * data()
Return an array-like object for data access, for example a pointer to an underlying array or a refere...
Definition localAdjoints.hpp:83
void beginUse()
Declare that the adjoints are in use, e.g., during a tape evaluation, and cannot be resized right now...
Definition localAdjoints.hpp:111
T_Identifier Identifier
See LocalAdjoints.
Definition localAdjoints.hpp:60
T_Tape Tape
See LocalAdjoints.
Definition localAdjoints.hpp:57
void resize(Identifier const &newSize)
Ensure that identifiers up to newSize can be passed to operator[] without error.
Definition localAdjoints.hpp:93
void swap(LocalAdjoints &other)
Swap two sets of adjoint variables. Internally, declares usage of the adjoints.
Definition localAdjoints.hpp:106