Generalized wrapper of the VectorAccessInterface for aggregated data types, e.g. std::complex<codi::RealReverse>. More...
#include <aggregatedTypeVectorAccessWrapper.hpp>
Public Types | |
using | Type = T_Type |
See AggregatedTypeVectorAccessWrapperBase. | |
Public Types inherited from codi::VectorAccessInterface< int, int > | |
using | Identifier |
See VectorAccessInterface. | |
using | Real |
See VectorAccessInterface. | |
Additional Inherited Members | |
Public Member Functions inherited from codi::VectorAccessInterface< int, int > | |
virtual | ~VectorAccessInterface () |
Destructor. | |
virtual size_t | getVectorSize () const=0 |
Vector size in the current tape evaluation. | |
virtual bool | isLhsZero ()=0 |
True if the adjoint set with setLhsAdjoint is zero. | |
virtual VectorAccessInterface * | clone () const=0 |
virtual void | setLhsAdjoint (Identifier const &index)=0 |
virtual void | updateAdjointWithLhs (Identifier const &index, Real const &jacobian)=0 |
virtual void | setLhsTangent (Identifier const &index)=0 |
virtual void | updateTangentWithLhs (Identifier const &index, Real const &jacobian)=0 |
virtual void | resetAdjoint (Identifier const &index, size_t dim)=0 |
Set the adjoint component to zero. | |
virtual void | resetAdjointVec (Identifier const &index)=0 |
Set the adjoint entry to zero. | |
virtual Real | getAdjoint (Identifier const &index, size_t dim)=0 |
Get the adjoint component. | |
virtual void | getAdjointVec (Identifier const &index, Real *const vec)=0 |
Get the adjoint entry. | |
virtual Real const * | getAdjointVec (Identifier const &index)=0 |
Get the adjoint entry. | |
virtual void | updateAdjoint (Identifier const &index, size_t dim, Real const &adjoint)=0 |
Update the adjoint component. | |
virtual void | updateAdjointVec (Identifier const &index, Real const *const vec)=0 |
Update the adjoint entry. | |
virtual void | setPrimal (Identifier const &index, Real const &primal)=0 |
Set the primal value. | |
virtual Real | getPrimal (Identifier const &index)=0 |
Get the primal value. | |
virtual bool | hasPrimals ()=0 |
True if the tape/vector interface has primal values. | |
Generalized wrapper of the VectorAccessInterface for aggregated data types, e.g. std::complex<codi::RealReverse>.
This wrapper is instantiated by AggregatedTypeVectorAccessWrapperFactory. It can be specialized for arbitrary types that consist of CoDiPack types.
This class helps to write generalized external function, that handles aggregated data types. E.g. for std::complex<codi::RealReverse> the primal value as well as the adjoint value are defined as std::complex<double> and the identifier type is defined as std::complex<int>. Since this can be different for other types like vectors or matrices, this wrapper can be used to write generalized code, that works for arbitrary aggregated types. See RealTraits::DataExtraction for a generalized access to the primal and identifier data of aggregated types.
Here is an example for a generalized external function routine (documentation/examples/Example_20_Aggregated_active_type_handling.cpp):
In general all implementations of the wrapper will forward all functions calls to the VectorAccessInterface of the underlying tape. For each active type in the structure the corresponding operation should be performed.
Implementations can use AggregatedTypeVectorAccessWrapperBase which implements most of the functions from VectorAccessInterface.
T_Type | An arbitrary type which consists of multiple CoDiPack types. |