CoDiPack  3.1.3
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.
using TapeData = typename Tape::ActiveTypeTapeData
 See IdentifierInformationTapeInterface.
Public Types inherited from codi::ExpressionInterface< T_Real, T_Impl >
using ADLogic = char
 AD logic that governs the expression. Needs to be the same for all inputs of the expression.
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::ExpressionMemberOperations< T_Real, T_Impl, typename >
using Impl = T_Impl
 See ExpressionMemberOperations.
using Real = T_Real
 See ExpressionMemberOperations.

Public Member Functions

 LhsExpressionInterface ()=default
 Constructor.
 LhsExpressionInterface (LhsExpressionInterface const &other)=default
 Constructor.
General implementation
inlineImpl & cast ()
 Cast to the implementation.
inlineGradient & gradient ()
 Get the gradient of this lvalue from the tape.
inlineGradient const & gradient () const
 Get the gradient of this lvalue from the tape.
inlineGradient getGradient () const
 Get the gradient of this lvalue from the tape.
inlinevoid setGradient (Gradient const &g)
 Set the gradient of this lvalue in the tape.
inlineReal const & getValue () const
 Get the primal value of this lvalue.
inlinevoid setValue (Real const &v)
 Set the primal value of this lvalue.
inlineImpl & operator= (Real const &rhs)
 Assignment operator for passive values. Calls store on the InternalStatementRecordingTapeInterface.
template<typename U = Real, typename = RealTraits::EnableIfNotPassiveReal<U>>
inlineImpl & operator= (PassiveReal const &rhs)
 Assignment operator for passive values. Calls store on the InternalStatementRecordingTapeInterface.
template<typename Rhs>
inlineImpl & operator= (ExpressionInterface< Real, Rhs > const &rhs)
 Assignment operator for expressions. Calls store on the InternalStatementRecordingTapeInterface.
template<typename Rhs, typename U = Real, typename = RealTraits::EnableIfNotPassiveReal<U>>
inlineImpl & operator= (ExpressionInterface< typename U::Real, Rhs > const &rhs)
 Assignment operator for expressions. Calls store on the InternalStatementRecordingTapeInterface.
inlineImpl & operator= (LhsExpressionInterface const &rhs)
 Assignment operator for lhs expressions. Calls store on the InternalStatementRecordingTapeInterface.
template<typename Rhs>
inlineImpl & operator= (LhsExpressionInterface< Real, Gradient, Tape, Rhs > const &rhs)
 Assignment operator for lhs expressions. Calls store on the InternalStatementRecordingTapeInterface.
inlineImpl const & cast () const
 Cast to the implementation.
Public Member Functions inherited from codi::ExpressionInterface< T_Real, T_Impl >
inlineImpl const & cast () const
 Cast to the implementation.
 ExpressionInterface ()=default
 Constructor.
 ExpressionInterface (ExpressionInterface const &)=default
 Constructor.
inlineReal const getValue () const
 Compute the primal value that is usually evaluated by the statement/expression.
template<size_t argNumber, typename Tangent>
inlineauto applyTangent (Tangent const &tangent) const
template<size_t argNumber, typename Adjoint>
inlineauto applyAdjoint (Adjoint const &adjoint) const
Public Member Functions inherited from codi::NodeInterface< T_Impl >
inlineImpl const & cast () const
 Cast to the implementation.
template<size_t argNumber>
char const & getLink () const
 an expression.

Implementation of NodeInterface

static size_t constexpr LinkCount = 0
 handle the expression as a leaf node.
inlinevoid init (Real const &newValue, EventHints::Statement statementType)
inlinevoid destroy ()

Interface definition

Real const & value () const
 Get a constant reference to the lvalue represented by the expression.
Real & value ()
 Get a reference to the lvalue represented by the expression.
Identifier const & getIdentifier () const
Identifier & getIdentifier ()
TapeData const & getTapeData () const
 Get the data of the tape stored in this lhs expression.
TapeData & getTapeData ()
 Get the data of the tape stored in this lhs expression.
static Tape & getTape ()
 Get a reference to the tape which manages this expression.

Additional Inherited Members

static size_t constexpr LinkCount = false
 handle the expression as a leaf node.
Protected Member Functions inherited from codi::ExpressionMemberOperations< T_Real, T_Impl, typename >
inlineImpl const & cast () const
 Cast to implementation.

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>
inlinevoid 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.

◆ 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>
inlinevoid 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

◆ LinkCount

template<typename T_Real, typename T_Gradient, typename T_Tape, typename T_Impl>
size_t constexpr codi::LhsExpressionInterface< T_Real, T_Gradient, T_Tape, T_Impl >::LinkCount = 0
staticconstexpr

handle the expression as a leaf node.

Number of links the expression has. Zero will


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