CoDiPack  2.2.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::ActiveTypeWrapper< T_ActiveType > Struct Template Reference

Creates a pseudo active type from data references. Can be used to overlay existing data with active types. More...

#include <activeTypeWrapper.hpp>

Inheritance diagram for codi::ActiveTypeWrapper< T_ActiveType >:

Public Types

using ActiveType = T_ActiveType
 See WritableActiveTypeWrapper.
 
using Base = LhsExpressionInterface< Real, Gradient, Tape, ActiveTypeWrapper >
 Base class abbreviation.
 
using Gradient = typename Tape::Gradient
 See LhsExpressionInterface.
 
using Identifier = typename Tape::Identifier
 See LhsExpressionInterface.
 
using PassiveReal = RealTraits::PassiveReal< Real >
 Basic computation type.
 
using Real = typename Tape::Real
 See LhsExpressionInterface.
 
using Tape = typename ActiveType::Tape
 See ActiveType.
 
Implementation of ExpressionInterface
using StoreAs = ActiveTypeWrapper const &
 " Defines how this expression is stored in an expression tree. "
 
using ActiveResult = typename ActiveType::ActiveResult
 Type into which the expression can be converted. Usually also the type from which it is constructed.
 
- Public Types inherited from codi::LhsExpressionInterface< T_ActiveType::Real, T_ActiveType::Gradient, T_ActiveType::Tape, ActiveTypeWrapper< T_ActiveType > >
using Base = ExpressionInterface< T_ActiveType::Real, ActiveTypeWrapper< T_ActiveType > >
 Base class abbreviation.
 
using Gradient = T_ActiveType::Gradient
 See LhsExpressionInterface.
 
using Identifier = typename Tape::Identifier
 See GradientAccessTapeInterface.
 
using Impl = ActiveTypeWrapper< T_ActiveType >
 See LhsExpressionInterface.
 
using PassiveReal = RealTraits::PassiveReal< Real >
 Basic computation type.
 
using Real = T_ActiveType::Real
 See LhsExpressionInterface.
 
using Tape = T_ActiveType::Tape
 See LhsExpressionInterface.
 
- Public Types inherited from codi::ExpressionInterface< T_Real, T_Impl >
using ActiveResult = void
 Type into which the expression can be converted. Usually also the type from which it is constructed.
 
using Impl = T_Impl
 See ExpressionInterface.
 
using Real = T_Real
 See ExpressionInterface.
 
using StoreAs = ExpressionInterface
 Defines how this expression is stored in an expression tree.
 
- Public Types inherited from codi::NodeInterface< T_Impl >
using Impl = T_Impl
 See NodeInterface.
 
- Public Types inherited from codi::AssignmentOperators< T_ActiveType::Tape, ActiveTypeWrapper< T_ActiveType > >
using Impl = ActiveTypeWrapper< T_ActiveType >
 See AssignmentOperators.
 
using PassiveReal = RealTraits::PassiveReal< Real >
 Basic computation type.
 
using Real = typename Tape::Real
 See InternalStatementRecordingTapeInterface.
 
using Tape = T_ActiveType::Tape
 See AssignmentOperators.
 
- Public Types inherited from codi::IncrementOperators< T_ActiveType::Tape, ActiveTypeWrapper< T_ActiveType > >
using Impl = ActiveTypeWrapper< T_ActiveType >
 See IncrementOperators.
 
using PassiveReal = RealTraits::PassiveReal< Real >
 Basic computation type.
 
using Real = typename Tape::Real
 See InternalStatementRecordingTapeInterface.
 
using Tape = T_ActiveType::Tape
 See IncrementOperators.
 

Public Member Functions

 ActiveTypeWrapper (ActiveType &value)
 
 ActiveTypeWrapper (Real &value, Identifier &identifier)
 
ActiveTypeWrapper< ActiveType > & operator= (ActiveTypeWrapper< ActiveType > const &v)
 See LhsExpressionInterface::operator=(ExpressionInterface const&)
 
 ~ActiveTypeWrapper ()
 
- Public Member Functions inherited from codi::LhsExpressionInterface< T_ActiveType::Real, T_ActiveType::Gradient, T_ActiveType::Tape, ActiveTypeWrapper< T_ActiveType > >
 LhsExpressionInterface ()=default
 Constructor.
 
 LhsExpressionInterface (LhsExpressionInterface const &other)=default
 Constructor.
 
Implcast ()
 Cast to the implementation.
 
Impl const & cast () const
 Cast to the implementation.
 
Gradientgradient ()
 Get the gradient of this lvalue from the tape.
 
Gradient const & gradient () const
 Get the gradient of this lvalue from the tape.
 
Gradient getGradient () const
 Get the gradient of this lvalue from the tape.
 
void setGradient (Gradient const &g)
 Set the gradient of this lvalue in the tape.
 
Real const & getValue () const
 Get the primal value of this lvalue.
 
void setValue (Real const &v)
 Set the primal value of this lvalue.
 
Imploperator= (Real const &rhs)
 Assignment operator for passive values. Calls store on the InternalStatementRecordingTapeInterface.
 
Imploperator= (PassiveReal const &rhs)
 Assignment operator for passive values. Calls store on the InternalStatementRecordingTapeInterface.
 
Imploperator= (ExpressionInterface< Real, Rhs > const &rhs)
 Assignment operator for expressions. Calls store on the InternalStatementRecordingTapeInterface.
 
Imploperator= (ExpressionInterface< typename U::Real, Rhs > const &rhs)
 Assignment operator for expressions. Calls store on the InternalStatementRecordingTapeInterface.
 
Imploperator= (LhsExpressionInterface const &rhs)
 Assignment operator for lhs expressions. Calls store on the InternalStatementRecordingTapeInterface.
 
Imploperator= (LhsExpressionInterface< Real, Gradient, Tape, Rhs > const &rhs)
 Assignment operator for lhs expressions. Calls store on the InternalStatementRecordingTapeInterface.
 
void forEachLink (TraversalLogic< Logic > &logic, Args &&... args) const
 
Real const & value () const
 Get a constant reference to the lvalue represented by the expression.
 
Realvalue ()
 Get a reference to the lvalue represented by the expression.
 
Identifier const & getIdentifier () const
 
IdentifiergetIdentifier ()
 
- Public Member Functions inherited from codi::ExpressionInterface< T_Real, T_Impl >
Impl const & cast () const
 Cast to the implementation.
 
 ExpressionInterface ()=default
 Constructor.
 
 ExpressionInterface (ExpressionInterface const &)=default
 Constructor.
 
Real const getValue () const
 Compute the primal value that is usually evaluated by the statement/expression.
 
template<size_t argNumber>
Real getJacobian () const
 
- Public Member Functions inherited from codi::NodeInterface< T_Impl >
Impl const & cast () const
 Cast to the implementation.
 
template<typename Logic , typename... Args>
void forEachLink (TraversalLogic< Logic > &logic, Args &&... args) const
 
- Public Member Functions inherited from codi::AssignmentOperators< T_ActiveType::Tape, ActiveTypeWrapper< T_ActiveType > >
Implcast ()
 Cast to the implementation.
 
Imploperator*= (ExpressionInterface< Real, Rhs > const &rhs)
 Operator *= for expressions.
 
Imploperator*= (PassiveReal const &rhs)
 Operator *= for passive values.
 
Imploperator+= (ExpressionInterface< Real, Rhs > const &rhs)
 Operator += for expressions.
 
Imploperator+= (PassiveReal const &rhs)
 Operator += for passive values.
 
Imploperator-= (ExpressionInterface< Real, Rhs > const &rhs)
 Operator -= for expressions.
 
Imploperator-= (PassiveReal const &rhs)
 Operator -= for passive values.
 
Imploperator/= (ExpressionInterface< Real, Rhs > const &rhs)
 Operator /= for expressions.
 
Imploperator/= (PassiveReal const &rhs)
 Operator /= for passive values.
 
- Public Member Functions inherited from codi::IncrementOperators< T_ActiveType::Tape, ActiveTypeWrapper< T_ActiveType > >
Implcast ()
 Cast to the implementation.
 
Imploperator++ ()
 Prefix operator++.
 
Impl operator++ (int u)
 Postfix operator++.
 
Imploperator-- ()
 Prefix operator--.
 
Impl operator-- (int u)
 Postfix operator--.
 

Implementation of LhsExpressionInterface

IdentifiergetIdentifier ()
 
Identifier const & getIdentifier () const
 
Realvalue ()
 Get a reference to the lvalue represented by the expression.
 
Real const & value () const
 Get a constant reference to the lvalue represented by the expression.
 
static TapegetTape ()
 Get a reference to the tape which manages this expression.
 

Additional Inherited Members

- Static Public Member Functions inherited from codi::LhsExpressionInterface< T_ActiveType::Real, T_ActiveType::Gradient, T_ActiveType::Tape, ActiveTypeWrapper< T_ActiveType > >
static Logic::ResultType constexpr forEachLinkConstExpr (Args &&...)
 
static TapegetTape ()
 Get a reference to the tape which manages this expression.
 
- Static Public Member Functions inherited from codi::NodeInterface< T_Impl >
template<typename Logic , typename... Args>
static Logic::ResultType constexpr forEachLinkConstExpr (Args &&... args)
 
- Static Public Attributes inherited from codi::LhsExpressionInterface< T_ActiveType::Real, T_ActiveType::Gradient, T_ActiveType::Tape, ActiveTypeWrapper< T_ActiveType > >
static bool constexpr EndPoint
 If this expression is handled as a leaf in the tree.
 
- Static Public Attributes inherited from codi::NodeInterface< T_Impl >
static bool constexpr EndPoint = false
 If this expression is handled as a leaf in the tree.
 
- Protected Member Functions inherited from codi::LhsExpressionInterface< T_ActiveType::Real, T_ActiveType::Gradient, T_ActiveType::Tape, ActiveTypeWrapper< T_ActiveType > >
void init (Real const &newValue, EventHints::Statement statementType)
 
void destroy ()
 

Detailed Description

template<typename T_ActiveType>
struct codi::ActiveTypeWrapper< T_ActiveType >

Creates a pseudo active type from data references. Can be used to overlay existing data with active types.

The class stores references to the value and identifier. The identifier is taken as it is and not initialized or destroyed. The class only wraps the data in a CoDiPack expression.

See Expression design documentation for details about the expression system in CoDiPack.

Template Parameters
T_ActiveTypeThe type of the active type which is wrapped.

Member Typedef Documentation

◆ ActiveResult

template<typename T_ActiveType >
using codi::ActiveTypeWrapper< T_ActiveType >::ActiveResult = typename ActiveType::ActiveResult

Type into which the expression can be converted. Usually also the type from which it is constructed.

◆ StoreAs

template<typename T_ActiveType >
using codi::ActiveTypeWrapper< T_ActiveType >::StoreAs = ActiveTypeWrapper const&

" Defines how this expression is stored in an expression tree. "

" "

Constructor & Destructor Documentation

◆ ActiveTypeWrapper() [1/2]

template<typename T_ActiveType >
codi::ActiveTypeWrapper< T_ActiveType >::ActiveTypeWrapper ( Real value,
Identifier identifier 
)
inline

The identifier is not initialized. It is assumed to be a valid identifier (either default or assigned by an expression).

◆ ActiveTypeWrapper() [2/2]

template<typename T_ActiveType >
codi::ActiveTypeWrapper< T_ActiveType >::ActiveTypeWrapper ( ActiveType value)
inline

Create a reference to an active type. It is assumed that the lifespan of the argument is longer than the lifespan of the created value.

◆ ~ActiveTypeWrapper()

template<typename T_ActiveType >
codi::ActiveTypeWrapper< T_ActiveType >::~ActiveTypeWrapper ( )
inline

The identifier is not destroyed. It is assumed to be still valid, since this is only a reference to the actual value.

Member Function Documentation

◆ getIdentifier() [1/2]

template<typename T_ActiveType >
Identifier & codi::ActiveTypeWrapper< T_ActiveType >::getIdentifier ( )
inline

Get a reference to the identifier of the tape for this expression. See also Direct data access (Identifier management)

◆ getIdentifier() [2/2]

template<typename T_ActiveType >
Identifier const & codi::ActiveTypeWrapper< T_ActiveType >::getIdentifier ( ) const
inline

Get a constant reference to the identifier of the tape for this expression. See also Direct data access (Identifier management)

◆ getTape()

template<typename T_ActiveType >
static Tape & codi::ActiveTypeWrapper< T_ActiveType >::getTape ( )
inlinestatic

Get a reference to the tape which manages this expression.

◆ value() [1/2]

template<typename T_ActiveType >
Real & codi::ActiveTypeWrapper< T_ActiveType >::value ( )
inline

Get a reference to the lvalue represented by the expression.

◆ value() [2/2]

template<typename T_ActiveType >
Real const & codi::ActiveTypeWrapper< T_ActiveType >::value ( ) const
inline

Get a constant reference to the lvalue represented by the expression.


The documentation for this struct was generated from the following file: