CoDiPack  2.2.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::LhsExpressionInterface< T_Real, T_Gradient, T_Tape, T_Impl > Struct Template Reference

Base class for all CoDiPack lvalue expression. More...

#include <lhsExpressionInterface.hpp>

Inheritance diagram for codi::LhsExpressionInterface< T_Real, T_Gradient, T_Tape, T_Impl >:

Public Types

using Base = ExpressionInterface<T_Real, T_Impl>
 Base class abbreviation.
 
using Gradient = T_Gradient
 See LhsExpressionInterface.
 
using Identifier = typename Tape::Identifier
 See GradientAccessTapeInterface.
 
using Impl = T_Impl
 See LhsExpressionInterface.
 
using PassiveReal = RealTraits::PassiveReal<Real>
 Basic computation type.
 
using Real = T_Real
 See LhsExpressionInterface.
 
using Tape = T_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 Member Functions

 LhsExpressionInterface ()=default
 Constructor.
 
 LhsExpressionInterface (LhsExpressionInterface const &other)=default
 Constructor.
 
General implementation
Implcast ()
 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.
 
template<typename U = Real, typename = RealTraits::EnableIfNotPassiveReal<U>>
Imploperator= (PassiveReal const &rhs)
 Assignment operator for passive values. Calls store on the InternalStatementRecordingTapeInterface.
 
template<typename Rhs >
Imploperator= (ExpressionInterface< Real, Rhs > const &rhs)
 Assignment operator for expressions. Calls store on the InternalStatementRecordingTapeInterface.
 
template<typename Rhs , typename U = Real, typename = RealTraits::EnableIfNotPassiveReal<U>>
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.
 
template<typename Rhs >
Imploperator= (LhsExpressionInterface< Real, Gradient, Tape, Rhs > const &rhs)
 Assignment operator for lhs expressions. Calls store on the InternalStatementRecordingTapeInterface.
 
Impl const & cast () const
 Cast to the implementation.
 
- 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
 

Implementation of NodeInterface

static bool constexpr EndPoint = true
 If this expression is handled as a leaf in the tree.
 
template<typename Logic , typename... Args>
void forEachLink (TraversalLogic< Logic > &logic, Args &&... args) const
 
template<typename Logic , typename... Args>
static Logic::ResultType constexpr forEachLinkConstExpr (Args &&...)
 
void init (Real const &newValue, EventHints::Statement statementType)
 
void destroy ()
 

Interface definition

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 ()
 
static TapegetTape ()
 Get a reference to the tape which manages this expression.
 

Additional Inherited Members

- 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::NodeInterface< T_Impl >
static bool constexpr EndPoint = false
 If this expression is handled as a leaf in the tree.
 

Detailed Description

template<typename T_Real, typename T_Gradient, typename T_Tape, typename T_Impl>
struct codi::LhsExpressionInterface< T_Real, T_Gradient, T_Tape, T_Impl >

Base class for all CoDiPack lvalue expression.

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

This interface resembles an lvalue in C++.

Template Parameters
T_RealOriginal primal value of the statement/expression.
T_GradientGradient values computed by the tape implementation.
T_TapeThe tape that manages the lvalues of the expression. Minimal interface: InternalStatementRecordingTapeInterface, GradientAccessTapeInterface
T_ImplClass implementing this interface.

Member Function Documentation

◆ destroy()

template<typename T_Real , typename T_Gradient , typename T_Tape , typename T_Impl >
void codi::LhsExpressionInterface< T_Real, T_Gradient, T_Tape, T_Impl >::destroy ( )
inlineprotected

Helper function to deconstruct the primal value and the identifier by the tape.

To be called in the destructor of the implementing class.

◆ forEachLink()

template<typename T_Real , typename T_Gradient , typename T_Tape , typename T_Impl >
template<typename Logic , typename... Args>
void codi::LhsExpressionInterface< T_Real, T_Gradient, T_Tape, T_Impl >::forEachLink ( TraversalLogic< Logic > & logic,
Args &&... args ) const
inline

Call the link method of the given logic for all arguments (links) of this node (not to be confused with args). Pass args to each call.

◆ forEachLinkConstExpr()

template<typename T_Real , typename T_Gradient , typename T_Tape , typename T_Impl >
template<typename Logic , typename... Args>
static Logic::ResultType constexpr codi::LhsExpressionInterface< T_Real, T_Gradient, T_Tape, T_Impl >::forEachLinkConstExpr ( Args && ...)
inlinestaticconstexpr

Call the link method of the given logic for all arguments (links) of this node (not to be confused with args). Pass args to each call.

◆ getIdentifier() [1/2]

template<typename T_Real , typename T_Gradient , typename T_Tape , typename T_Impl >
Identifier & codi::LhsExpressionInterface< T_Real, T_Gradient, T_Tape, T_Impl >::getIdentifier ( )

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_Real , typename T_Gradient , typename T_Tape , typename T_Impl >
Identifier const & codi::LhsExpressionInterface< T_Real, T_Gradient, T_Tape, T_Impl >::getIdentifier ( ) const

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

◆ init()

template<typename T_Real , typename T_Gradient , typename T_Tape , typename T_Impl >
void codi::LhsExpressionInterface< T_Real, T_Gradient, T_Tape, T_Impl >::init ( Real const & newValue,
EventHints::Statement statementType )
inlineprotected

Helper function to initialize the primal value and the identifier by the tape.

To be called in constructors of the implementing class.

Member Data Documentation

◆ EndPoint

template<typename T_Real , typename T_Gradient , typename T_Tape , typename T_Impl >
bool constexpr codi::LhsExpressionInterface< T_Real, T_Gradient, T_Tape, T_Impl >::EndPoint = true
staticconstexpr

If this expression is handled as a leaf in the tree.


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