40#include "../../traits/adjointVectorTraits.hpp"
41#include "internalAdjointsInterface.hpp"
53 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);
106 std::swap(adjoints, other.adjoints);
116#ifndef DOXYGEN_DISABLE
119 namespace AdjointVectorTraits {
120 template<
typename T_Gradient,
typename T_Identifier,
typename T_Tape>
121 struct GradientImplementation<LocalAdjoints<T_Gradient, T_Identifier, T_Tape>> {
123 using Gradient = T_Gradient;
#define CODI_NO_INLINE
See codi::Config::AvoidedInlines.
Definition config.h:426
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition config.h:469
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:97
CoDiPack - Code Differentiation Package.
Definition codi.hpp:97
InternalAdjointsInterface(size_t initialSize)
Definition internalAdjointsInterface.hpp:90
LocalAdjoints(size_t initialSize)
Constructor.
Definition localAdjoints.hpp:68
inlineGradient * data()
Return an array-like object for data access, for example a pointer to an underlying array or a refere...
Definition localAdjoints.hpp:82
inlinevoid beginUse()
Declare that the adjoints are in use, e.g., during a tape evaluation, and cannot be resized right now...
Definition localAdjoints.hpp:110
inlinevoid endUse()
Declare that the adjoints are no longer occupied.
Definition localAdjoints.hpp:113
inlinesize_t size() const
Returns the number of adjoint variables. Internally, declares usage of the adjoints.
Definition localAdjoints.hpp:87
inlineGradient const & operator[](Identifier const &identifier) const
Constant reference access to the adjoint variable identified by identifier.
Definition localAdjoints.hpp:77
T_Tape Tape
See LocalAdjoints.
Definition localAdjoints.hpp:57
inlineGradient & operator[](Identifier const &identifier)
Reference access to the adjoint variable identified by identifier.
Definition localAdjoints.hpp:72
inlinevoid zeroAll(Identifier const &maxIdentifier)
Set all adjoint variables up to and including maxIdentifier to Gradient().
Definition localAdjoints.hpp:97
T_Gradient Gradient
See LocalAdjoints.
Definition localAdjoints.hpp:58
inlinevoid swap(LocalAdjoints &other)
Swap two sets of adjoint variables. Internally, declares usage of the adjoints.
Definition localAdjoints.hpp:105
T_Identifier Identifier
See LocalAdjoints.
Definition localAdjoints.hpp:59
void resize(Identifier const &newSize)
Ensure that identifiers up to newSize can be passed to operator[] without error.
Definition localAdjoints.hpp:92