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>
91 typename RealTraits::DataExtraction<T_Type>::Identifier> {
98 static int constexpr Elements = Type::Elements;
158 innerInterface.updateAdjointWithLhs(index[i.value], Traits::template arrayAccess<i.value>(jacobian));
177 innerInterface.updateTangentWithLhs(index[i.value], Traits::template arrayAccess<i.value>(jacobian));
211 Traits::template arrayAccess<i.value>(adjoint) =
innerInterface.getAdjoint(index[i.value], dim);
219 for (
size_t curDim = 0; curDim <
innerInterface.getVectorSize(); curDim += 1) {
220 vec[curDim] = this->
getAdjoint(index, curDim);
233 innerInterface.updateAdjoint(index[i.value], dim, Traits::template arrayAccess<i.value>(adjoint));
239 for (
size_t curDim = 0; curDim <
innerInterface.getVectorSize(); curDim += 1) {
255 innerInterface.setPrimal(index[i.value], Traits::template arrayAccess<i.value>(primal));
264 Traits::template arrayAccess<i.value>(primal) =
innerInterface.getPrimal(index[i.value]);
282 template<
typename T_Type,
typename =
void>
292 template<
typename Real,
typename Identifier>
294 return new RType(access);
303#ifndef DOXYGEN_DISABLE
307 template<
typename T_Type>
308 struct AggregatedTypeVectorAccessWrapperFactory<T_Type, ExpressionTraits::EnableIfLhsExpression<T_Type>> {
310 using Type =
CODI_DD(T_Type, CODI_DEFAULT_LHS_EXPRESSION);
312 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:97
#define CODI_ANY
Used in default declarations of expression templates.
Definition macros.hpp:101
#define CODI_STATIC_ASSERT(cond, message)
Static assert definition for CoDiPack. Not evaluated in IDE mode.
Definition macros.hpp:130
#define CODI_T(...)
Abbreviation for CODI_TEMPLATE.
Definition macros.hpp:117
Traits for values that can be used as real values, e.g. double, float, codi::RealReverse etc....
Definition stdComplex.hpp:242
CoDiPack - Code Differentiation Package.
Definition codi.hpp:97
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:55
Represents a concrete aggregated lvalue int the CoDiPack expression tree.
Definition aggregatedActiveType.hpp:164
Factory for the creation of AggregatedTypeVectorAccessWrapper instances.
Definition aggregatedTypeVectorAccessWrapper.hpp:283
AggregatedTypeVectorAccessWrapper< Type > RType
Which instances this factory creates.
Definition aggregatedTypeVectorAccessWrapper.hpp:287
static void destroy(RType *access)
Delete the AggregatedTypeVectorAccessWrapper instance created by the crate method.
Definition aggregatedTypeVectorAccessWrapper.hpp:298
T_Type Type
See AggregatedTypeVectorAccessWrapperBase.
Definition aggregatedTypeVectorAccessWrapper.hpp:285
static RType * create(VectorAccessInterface< Real, Identifier > *access)
Definition aggregatedTypeVectorAccessWrapper.hpp:293
inlinebool isLhsZero() const
True if the adjoint set with setLhsAdjoint is zero.
Definition aggregatedTypeVectorAccessWrapper.hpp:127
int lhsOffset
Offset of indirect access if this aggregated type is part of an outer aggregated type.
Definition aggregatedTypeVectorAccessWrapper.hpp:110
VectorAccessInterface< Real, Identifier > * clone() const
Definition aggregatedTypeVectorAccessWrapper.hpp:139
inlinevoid updateTangentWithLhs(Identifier const &index, Real const &jacobian)
Definition aggregatedTypeVectorAccessWrapper.hpp:174
inlinevoid updateAdjointVec(Identifier const &index, Real const *const vec)
Update the adjoint entry.
Definition aggregatedTypeVectorAccessWrapper.hpp:238
inlinevoid setLhsAdjoint(Identifier const &index)
Definition aggregatedTypeVectorAccessWrapper.hpp:147
inlinevoid setActiveVariableForIndirectAccess(size_t pos)
Definition aggregatedTypeVectorAccessWrapper.hpp:185
typename Type::InnerActiveType InnerType
Active inner type of the aggregate.
Definition aggregatedTypeVectorAccessWrapper.hpp:97
typename RealTraits::DataExtraction< T_Type >::Identifier Identifier
Identifier value of the aggregate.
Definition aggregatedTypeVectorAccessWrapper.hpp:104
std::vector< Real > buffer
Temporary storage for getAdjointVec.
Definition aggregatedTypeVectorAccessWrapper.hpp:112
inlinevoid resetAdjointVec(Identifier const &index)
Set the adjoint entry to zero.
Definition aggregatedTypeVectorAccessWrapper.hpp:200
inlineReal getAdjoint(Identifier const &index, size_t dim)
Get the adjoint component.
Definition aggregatedTypeVectorAccessWrapper.hpp:207
InnerInterface & innerInterface
Reference to inner interface.
Definition aggregatedTypeVectorAccessWrapper.hpp:109
inlinesize_t getVectorSize() const
Vector size in the current tape evaluation.
Definition aggregatedTypeVectorAccessWrapper.hpp:122
typename RealTraits::DataExtraction< T_Type >::Real Real
Real value of the aggregate.
Definition aggregatedTypeVectorAccessWrapper.hpp:103
Real const * getAdjointVec(Identifier const &index)
Get the adjoint entry.
Definition aggregatedTypeVectorAccessWrapper.hpp:225
VectorAccessInterface< typename InnerType::Real, typename InnerType::Identifier > InnerInterface
Inner interface expected by this wrapper.
Definition aggregatedTypeVectorAccessWrapper.hpp:101
inlinebool hasPrimals()
True if the tape/vector interface has primal values.
Definition aggregatedTypeVectorAccessWrapper.hpp:248
inlinevoid updateAdjointWithLhs(Identifier const &index, Real const &jacobian)
Definition aggregatedTypeVectorAccessWrapper.hpp:155
inlinevoid getAdjointVec(Identifier const &index, Real *const vec)
Get the adjoint entry.
Definition aggregatedTypeVectorAccessWrapper.hpp:218
static int constexpr Elements
Number of elements in the aggregate.
Definition aggregatedTypeVectorAccessWrapper.hpp:98
T_Type Type
See AggregatedTypeVectorAccessWrapper.
Definition aggregatedTypeVectorAccessWrapper.hpp:94
inlinevoid setLhsTangent(Identifier const &index)
Definition aggregatedTypeVectorAccessWrapper.hpp:166
inlinevoid setPrimal(Identifier const &index, Real const &primal)
Set the primal value.
Definition aggregatedTypeVectorAccessWrapper.hpp:253
inlineReal getPrimal(Identifier const &index)
Get the primal value.
Definition aggregatedTypeVectorAccessWrapper.hpp:260
RealTraits::AggregatedTypeTraits< Real > Traits
Aggregated type traits.
Definition aggregatedTypeVectorAccessWrapper.hpp:107
inlinevoid resetAdjoint(Identifier const &index, size_t dim)
Set the adjoint component to zero.
Definition aggregatedTypeVectorAccessWrapper.hpp:193
inlinevoid updateAdjoint(Identifier const &index, size_t dim, Real const &adjoint)
Update the adjoint component.
Definition aggregatedTypeVectorAccessWrapper.hpp:231
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:233
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