41#include "../../expressions/aggregate/aggregatedActiveType.hpp"
42#include "../../expressions/lhsExpressionInterface.hpp"
44#include "../../tapes/misc/vectorAccessInterface.hpp"
45#include "../../traits/computationTraits.hpp"
46#include "../../traits/expressionTraits.hpp"
47#include "../../traits/realTraits.hpp"
77 template<
typename T_Type,
typename =
void>
80 "Instantiation of unspecialized AggregatedTypeVectorAccessWrapper.");
88 template<
typename T_Type>
96 static int constexpr Elements = Type::Elements;
151 innerInterface.updateAdjointWithLhs(index[i.value], Traits::template arrayAccess<i.value>(jacobian));
170 innerInterface.updateTangentWithLhs(index[i.value], Traits::template arrayAccess<i.value>(jacobian));
204 Traits::template arrayAccess<i.value>(adjoint) =
innerInterface.getAdjoint(index[i.value], dim);
212 for (
size_t curDim = 0; curDim <
innerInterface.getVectorSize(); curDim += 1) {
213 vec[curDim] = this->
getAdjoint(index, curDim);
226 innerInterface.updateAdjoint(index[i.value], dim, Traits::template arrayAccess<i.value>(adjoint));
232 for (
size_t curDim = 0; curDim <
innerInterface.getVectorSize(); curDim += 1) {
248 innerInterface.setPrimal(index[i.value], Traits::template arrayAccess<i.value>(primal));
257 Traits::template arrayAccess<i.value>(primal) =
innerInterface.getPrimal(index[i.value]);
275 template<
typename T_Type,
typename =
void>
285 template<
typename Real,
typename Identifier>
287 return new RType(access);
296#ifndef DOXYGEN_DISABLE
300 template<
typename T_Type>
301 struct AggregatedTypeVectorAccessWrapperFactory<T_Type, ExpressionTraits::EnableIfLhsExpression<T_Type>> {
303 using Type =
CODI_DD(T_Type, CODI_DEFAULT_LHS_EXPRESSION);
305 using RType = VectorAccessInterface<typename Type::Real, typename Type::Identifier>;
#define CODI_LAMBDA_INLINE
See codi::Config::ForcedInlines.
Definition config.h:473
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition config.h:469
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:96
#define CODI_ANY
Used in default declarations of expression templates.
Definition macros.hpp:100
#define CODI_STATIC_ASSERT(cond, message)
Static assert definition for CoDiPack. Not evaluated in IDE mode.
Definition macros.hpp:129
#define CODI_T(...)
Abbreviation for CODI_TEMPLATE.
Definition macros.hpp:116
Traits for values that can be used as real values, e.g. double, float, codi::RealReverse etc....
Definition stdComplex.hpp:204
CoDiPack - Code Differentiation Package.
Definition codi.hpp:94
inlinevoid static_for(F func, Args &&... args)
Static for with i = 0 .. (N - 1). See CompileTimeLoop for details.
Definition compileTimeLoop.hpp:110
inlinevoid CODI_UNUSED(Args const &...)
Disable unused warnings for an arbitrary number of arguments.
Definition macros.hpp:54
Represents a concrete aggregated lvalue int the CoDiPack expression tree.
Definition aggregatedActiveType.hpp:164
Factory for the creation of AggregatedTypeVectorAccessWrapper instances.
Definition aggregatedTypeVectorAccessWrapper.hpp:276
AggregatedTypeVectorAccessWrapper< Type > RType
Which instances this factory creates.
Definition aggregatedTypeVectorAccessWrapper.hpp:280
static void destroy(RType *access)
Delete the AggregatedTypeVectorAccessWrapper instance created by the crate method.
Definition aggregatedTypeVectorAccessWrapper.hpp:291
T_Type Type
See AggregatedTypeVectorAccessWrapperBase.
Definition aggregatedTypeVectorAccessWrapper.hpp:278
static RType * create(VectorAccessInterface< Real, Identifier > *access)
Definition aggregatedTypeVectorAccessWrapper.hpp:286
inlinebool isLhsZero() const
True if the adjoint set with setLhsAdjoint is zero.
Definition aggregatedTypeVectorAccessWrapper.hpp:125
int lhsOffset
Offset of indirect access if this aggregated type is part of an outer aggregated type.
Definition aggregatedTypeVectorAccessWrapper.hpp:108
inlinevoid updateTangentWithLhs(Identifier const &index, Real const &jacobian)
Definition aggregatedTypeVectorAccessWrapper.hpp:167
inlinevoid updateAdjointVec(Identifier const &index, Real const *const vec)
Update the adjoint entry.
Definition aggregatedTypeVectorAccessWrapper.hpp:231
inlinevoid setLhsAdjoint(Identifier const &index)
Definition aggregatedTypeVectorAccessWrapper.hpp:140
inlinevoid setActiveVariableForIndirectAccess(size_t pos)
Definition aggregatedTypeVectorAccessWrapper.hpp:178
typename Type::InnerActiveType InnerType
Active inner type of the aggregate.
Definition aggregatedTypeVectorAccessWrapper.hpp:95
typename RealTraits::DataExtraction< T_Type >::Identifier Identifier
Identifier value of the aggregate.
Definition aggregatedTypeVectorAccessWrapper.hpp:102
std::vector< Real > buffer
Temporary storage for getAdjointVec.
Definition aggregatedTypeVectorAccessWrapper.hpp:110
inlinevoid resetAdjointVec(Identifier const &index)
Set the adjoint entry to zero.
Definition aggregatedTypeVectorAccessWrapper.hpp:193
inlineReal getAdjoint(Identifier const &index, size_t dim)
Get the adjoint component.
Definition aggregatedTypeVectorAccessWrapper.hpp:200
InnerInterface & innerInterface
Reference to inner interface.
Definition aggregatedTypeVectorAccessWrapper.hpp:107
inlinesize_t getVectorSize() const
Vector size in the current tape evaluation.
Definition aggregatedTypeVectorAccessWrapper.hpp:120
typename RealTraits::DataExtraction< T_Type >::Real Real
Real value of the aggregate.
Definition aggregatedTypeVectorAccessWrapper.hpp:101
Real const * getAdjointVec(Identifier const &index)
Get the adjoint entry.
Definition aggregatedTypeVectorAccessWrapper.hpp:218
VectorAccessInterface< typename InnerType::Real, typename InnerType::Identifier > InnerInterface
Inner interface expected by this wrapper.
Definition aggregatedTypeVectorAccessWrapper.hpp:99
inlinebool hasPrimals()
True if the tape/vector interface has primal values.
Definition aggregatedTypeVectorAccessWrapper.hpp:241
inlinevoid updateAdjointWithLhs(Identifier const &index, Real const &jacobian)
Definition aggregatedTypeVectorAccessWrapper.hpp:148
inlinevoid getAdjointVec(Identifier const &index, Real *const vec)
Get the adjoint entry.
Definition aggregatedTypeVectorAccessWrapper.hpp:211
static int constexpr Elements
Number of elements in the aggregate.
Definition aggregatedTypeVectorAccessWrapper.hpp:96
T_Type Type
See AggregatedTypeVectorAccessWrapper.
Definition aggregatedTypeVectorAccessWrapper.hpp:92
inlinevoid setLhsTangent(Identifier const &index)
Definition aggregatedTypeVectorAccessWrapper.hpp:159
inlinevoid setPrimal(Identifier const &index, Real const &primal)
Set the primal value.
Definition aggregatedTypeVectorAccessWrapper.hpp:246
inlineReal getPrimal(Identifier const &index)
Get the primal value.
Definition aggregatedTypeVectorAccessWrapper.hpp:253
RealTraits::AggregatedTypeTraits< Real > Traits
Aggregated type traits.
Definition aggregatedTypeVectorAccessWrapper.hpp:105
inlinevoid resetAdjoint(Identifier const &index, size_t dim)
Set the adjoint component to zero.
Definition aggregatedTypeVectorAccessWrapper.hpp:186
inlinevoid updateAdjoint(Identifier const &index, size_t dim, Real const &adjoint)
Update the adjoint component.
Definition aggregatedTypeVectorAccessWrapper.hpp:224
Generalized wrapper of the VectorAccessInterface for aggregated data types, e.g. std::complex<codi::R...
Definition aggregatedTypeVectorAccessWrapper.hpp:78
T_Type Type
See AggregatedTypeVectorAccessWrapperBase.
Definition aggregatedTypeVectorAccessWrapper.hpp:82
Methods that access inner values of aggregated types that contain CoDiPack active types.
Definition realTraits.hpp:226
Unified access to the adjoint vector and primal vector in a tape evaluation.
Definition vectorAccessInterface.hpp:94
virtual void getAdjointVec(Identifier const &index, Real *const vec)=0
virtual void updateAdjoint(Identifier const &index, size_t dim, Real const &adjoint)=0
virtual Real getAdjoint(Identifier const &index, size_t dim)=0