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

General information about the identifiers and checks if variables are active. More...

#include <identifierInformationTapeInterface.hpp>

Inheritance diagram for codi::IdentifierInformationTapeInterface< T_Real, T_Gradient, T_Identifier >:

Public Types

using Gradient = T_Gradient
 See IdentifierInformationTapeInterface.
 
using Identifier = T_Identifier
 See IdentifierInformationTapeInterface.
 
using Real = T_Real
 See IdentifierInformationTapeInterface.
 

Interface definition

static bool constexpr LinearIndexHandling = false
 
Identifier getPassiveIndex () const
 Identifier for passive values. Usually 0.
 
Identifier getInvalidIndex () const
 Invalid identifier.
 
bool isIdentifierActive (Identifier const &index) const
 
template<typename Lhs , typename Tape >
void deactivateValue (LhsExpressionInterface< Real, Gradient, Tape, Lhs > &value)
 

Detailed Description

template<typename T_Real, typename T_Gradient, typename T_Identifier>
struct codi::IdentifierInformationTapeInterface< T_Real, T_Gradient, T_Identifier >

General information about the identifiers and checks if variables are active.

See Tape Interface Design for a general overview of the tape interface design in CoDiPack.

With this interface, the user can check if a variable in the program is active or not. For an explanation of what is an active variable for CoDiPack, please see Online activity analysis.

Here is an example for deactivating an identifier (documentation/examples/identifierInformationTapeInterface.cpp):

using Tape = typename Real::Tape;
Tape& tape = Real::getTape();
tape.setActive();
Real x = 200.0;
std::cout << "Passive x: " << x.getIdentifier() << " " << tape.isIdentifierActive(x.getIdentifier()) << std::endl;
tape.registerInput(x);
std::cout << "Active x: " << x.getIdentifier() << " " << tape.isIdentifierActive(x.getIdentifier()) << std::endl;
tape.deactivateValue(x);
std::cout << "Passive x: " << x.getIdentifier() << " " << tape.isIdentifierActive(x.getIdentifier()) << std::endl;
Template Parameters
T_RealThe computation type of a tape, usually chosen as ActiveType::Real.
T_GradientThe gradient type of a tape, usually chosen as ActiveType::Gradient.
T_IdentifierThe adjoint/tangent identification type of a tape, usually chosen as ActiveType::Identifier.

Member Function Documentation

◆ deactivateValue()

template<typename T_Real , typename T_Gradient , typename T_Identifier >
template<typename Lhs , typename Tape >
void codi::IdentifierInformationTapeInterface< T_Real, T_Gradient, T_Identifier >::deactivateValue ( LhsExpressionInterface< Real, Gradient, Tape, Lhs > & value)

Modify the value such that it is no longer active.

Template Parameters
LhsClass that implements the LhsExpressionInterface. See also LhsExpressionInterface.
TapeTape implementation used in the LhsExpressionInterface. See also LhsExpressionInterface.

◆ isIdentifierActive()

template<typename T_Real , typename T_Gradient , typename T_Identifier >
bool codi::IdentifierInformationTapeInterface< T_Real, T_Gradient, T_Identifier >::isIdentifierActive ( Identifier const & index) const

True if the identifier is considered active by the tape.

Member Data Documentation

◆ LinearIndexHandling

template<typename T_Real , typename T_Gradient , typename T_Identifier >
bool constexpr codi::IdentifierInformationTapeInterface< T_Real, T_Gradient, T_Identifier >::LinearIndexHandling = false
staticconstexpr

True if the tape uses an index handler that provides identifiers in a monotonically increasing way (see LinearIndexManager).


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