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

Tape for tagging variables and find errors in the AD workflow. More...

#include <tagTapeForward.hpp>

Inheritance diagram for codi::TagTapeForward< T_Real, T_Tag >:

Classes

struct  TapeTypes
 Required definition for event system. More...
 

Public Types

using Base = TagTapeBase<T_Real, T_Tag, TagData<T_Tag>, TagTapeForward>
 Base class abbreviation.
 
using Gradient = TagData<Tag>
 See TapeTypesInterface.
 
using Identifier = Gradient
 Same as the gradient type. Tangent data is stored in the active types.
 
using PassiveReal = RealTraits::PassiveReal<Real>
 Basic computation type.
 
using Position = EmptyPosition
 See TapeTypesInterface.
 
using Real = T_Real
 See TagTapeForward.
 
using Tag = T_Tag
 See TagTapeForward.
 
- Public Types inherited from codi::InternalStatementRecordingTapeInterface< T_Tag >
using Identifier
 See InternalStatementRecordingTapeInterface.
 
- Public Types inherited from codi::GradientAccessTapeInterface< T_Tag, T_Tag >
using Gradient
 See GradientAccessTapeInterface.
 
using Identifier
 See GradientAccessTapeInterface.
 
- Public Types inherited from codi::TagTapeBase< T_Real, T_Tag, TagData< T_Tag >, TagTapeForward< T_Real, T_Tag > >
using Gradient
 See TagTapeBase.
 
using Identifier
 See TapeTypesInterface.
 
using Impl
 See TagTapeBase.
 
using Real
 See TagTapeBase.
 
using Tag
 See TagTapeBase.
 
using TagErrorCallback
 Callback for a tag error.
 
using TagPropertyErrorCallback
 Callback for a change in a lhs value.
 

Public Member Functions

 TagTapeForward ()
 Constructor.
 
Implementation of GradientAccessTapeInterface
void setGradient (Identifier &identifier, Gradient const &gradient)
 Verify tag.
 
Gradient const & getGradient (Identifier const &identifier) const
 Verify tag.
 
Gradientgradient (Identifier &identifier)
 Verify tag.
 
Gradient const & gradient (Identifier const &identifier) const
 Verify tag.
 
void setGradient (Identifier const &identifier, Gradient const &gradient)=delete
 Do not allow.
 
Gradientgradient (Identifier const &identifier)=delete
 Do not allow.
 
- Public Member Functions inherited from codi::InternalStatementRecordingTapeInterface< T_Tag >
void initIdentifier (Real &value, Identifier &identifier)
 
void destroyIdentifier (Real &value, Identifier &identifier)
 Has to be called for each identifier, before it is deallocated.
 
void store (Lhs &lhs, Rhs const &rhs)
 Has to be called by an AD variable every time it is assigned.
 
- Public Member Functions inherited from codi::GradientAccessTapeInterface< T_Tag, T_Tag >
void setGradient (Identifier const &identifier, Gradient const &gradient, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Set the gradient.
 
Gradient const & getGradient (Identifier const &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic) const
 Set the gradient.
 
Gradientgradient (Identifier const &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic)
 Reference access to gradient.
 
Gradient const & gradient (Identifier const &identifier, AdjointsManagement adjointsManagement=AdjointsManagement::Automatic) const
 Constant reference access to gradient.
 
- Public Member Functions inherited from codi::TagTapeBase< T_Real, T_Tag, TagData< T_Tag >, TagTapeForward< T_Real, T_Tag > >
void swap (Impl &other)
 Swap members.
 
 TagTapeBase ()
 Constructor.
 
void setCurTag (const Tag &tag)
 Set the current tag of the tape.
 
Tag getCurTag ()
 Get the current tag of the tape.
 
Tag getTagFromVariable (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value)
 Get tag of a CoDiPack active type.
 
void setTagOnVariable (LhsExpressionInterface< Real, Gradient, Impl, Lhs > const &value)
 Set tag on a CoDiPack active type.
 
void clearTagOnVariable (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value)
 Clear tag on a CoDiPack active type.
 
void clearTagPropertiesOnVariable (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value)
 Clear properties on a CoDiPack active type.
 
void setTagPropertyOnVariable (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value, TagFlags flag)
 Set properties on a CoDiPack active type.
 
bool hasTagPropertyOnVariable (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value, TagFlags flag)
 Check properties on a CoDiPack active type.
 
void setTagPropertyErrorCallback (TagPropertyErrorCallback const &callback, void *userData)
 Set the callback and user data for a property error error.
 
void setTagErrorCallback (TagErrorCallback const &callback, void *userData)
 Set the callback and user data for a tag error.
 
void setPreaccumulationHandlingEnabled (bool enabled)
 Enable or disable specialized handling for preaccumulation. Default: true Uses a special tag to sanitize preaccumulation regions.
 
void setPreaccumulationHandlingTag (Tag tag)
 Set the special tag for preaccumulation regions. See setPreaccumulationHandlingEnabled().
 
bool isPreaccumulationHandlingEnabled ()
 If handling for preaccumulation is enabled.
 
Tag getPreaccumulationHandlingTag ()
 The special tag for preaccumulation.
 

Implementation of InternalStatementRecordingTapeInterface

static bool constexpr AllowJacobianOptimization = false
 Do not allow Jacobian optimization.
 
template<typename Real >
void initIdentifier (Real &value, Identifier &identifier)
 Do nothing.
 
template<typename Real >
void destroyIdentifier (Real &value, Identifier &identifier)
 Do nothing.
 
template<typename Lhs , typename Rhs >
void store (LhsExpressionInterface< Real, Gradient, TagTapeForward, Lhs > &lhs, ExpressionInterface< Real, Rhs > const &rhs)
 Verify all tags of the rhs and the lhs properties.
 
template<typename Lhs , typename Rhs >
void store (LhsExpressionInterface< Real, Gradient, TagTapeForward, Lhs > &lhs, LhsExpressionInterface< Real, Gradient, TagTapeForward, Rhs > const &rhs)
 Verify all tags of the rhs and the lhs properties.
 
template<typename Lhs >
void store (LhsExpressionInterface< Real, Gradient, TagTapeForward, Lhs > &lhs, Real const &rhs)
 Verify the lhs properties.
 

Additional Inherited Members

- Static Public Attributes inherited from codi::InternalStatementRecordingTapeInterface< T_Tag >
static bool constexpr AllowJacobianOptimization
 If certain operations can be hidden from the tape.
 
- Static Public Attributes inherited from codi::TagTapeBase< T_Real, T_Tag, TagData< T_Tag >, TagTapeForward< T_Real, T_Tag > >
static Tag constexpr InvalidTag
 Tag indicating an invalid value.
 
static Tag constexpr PassiveTag
 Tag indicating an inactive value.
 
- Protected Member Functions inherited from codi::TagTapeBase< T_Real, T_Tag, TagData< T_Tag >, TagTapeForward< T_Real, T_Tag > >
void verifyTag (ValidationIndicator< Real, Tag > &vi, Tag const &tag) const
 Checks if the tag is correct. Errors are set on the ValidationIndicator object.
 
void verifyTag (Tag const &tag) const
 Checks if the tag is correct and creates an error.
 
void verifyProperties (ValidationIndicator< Real, Tag > &vi, Real const &value, const EnumBitset< TagFlags > &properties) const
 Checks if the tag properties are correct.
 
void verifyTagAndProperties (Tag const &tag, Real const &value, const EnumBitset< TagFlags > &properties) const
 Checks if the tag and the properties are correct.
 
void checkLhsError (Real &lhsValue, Identifier &lhsIdentifier, const Real &rhs) const
 Check if a property for the lhs value is triggered.
 
void checkLhsError (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &lhs, const Real &rhs) const
 Check if the lhs value is changed.
 
void handleError (ValidationIndicator< Real, Tag > &vi) const
 Call tag error callback.
 
void verifyRegisterValue (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value, const Identifier &tag)
 Verify tag, properties and lhs error.
 
void setTag (Tag &tag) const
 Set tag on value.
 
void resetTag (Tag &tag) const
 Reset tag on value.
 
- Static Protected Member Functions inherited from codi::TagTapeBase< T_Real, T_Tag, TagData< T_Tag >, TagTapeForward< T_Real, T_Tag > >
static void defaultPropertyErrorCallback (Real const &currentValue, Real const &newValue, TagFlags flag, void *userData)
 Default callback for TagPropertyErrorCallback.
 
static void defaultTagErrorCallback (Tag const &correctTag, Tag const &wrongTag, void *userData)
 Default callback for TagErrorCallback.
 
- Protected Attributes inherited from codi::TagTapeBase< T_Real, T_Tag, TagData< T_Tag >, TagTapeForward< T_Real, T_Tag > >
Tag curTag
 Current tag for new values.
 
bool preaccumulationHandling
 Parameter to enable/disable preaccumulation handling.
 
Tag preaccumulationTag
 Tag used for preaccumulation specialized handling.
 
TagErrorCallback tagErrorCallback
 User defined callback for tag errors.
 
void * tagErrorUserData
 User data in call to callback for tag errors.
 
TagPropertyErrorCallback tagPropertyErrorCallback
 User defined callback for lhs value errors.
 
void * tagPropertyErrorUserData
 User data in call to callback for lhs value errors.
 

Detailed Description

template<typename T_Real, typename T_Tag>
struct codi::TagTapeForward< T_Real, T_Tag >

Tape for tagging variables and find errors in the AD workflow.

Mimics a CoDiPack forward evaluation.

See TagTapeBase for detailed information and functionality.

Template Parameters
T_RealThe computation type of a tape, usually chosen as ActiveType::Real.
T_tagThe type of the tag, usually int.

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