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

Base implementation for tagging tapes. More...

#include <tagTapeBase.hpp>

Inheritance diagram for codi::TagTapeBase< T_Real, T_Tag, T_Gradient, T_Impl >:

Classes

struct  ValidateTags
 Looks at the tags for the expression. More...
 

Public Types

using Gradient = T_Gradient
 See TagTapeBase.
 
using Identifier = TagData< Tag >
 See TapeTypesInterface.
 
using Impl = T_Impl
 See TagTapeBase.
 
using Real = T_Real
 See TagTapeBase.
 
using Tag = T_Tag
 See TagTapeBase.
 
using TagErrorCallback = void(*)(Tag const &correctTag, Tag const &wrongTag, void *userData)
 Callback for a tag error.
 
using TagPropertyErrorCallback = void(*)(Real const &currentValue, Real const &newValue, TagFlags flag, void *userData)
 Callback for a change in a lhs value.
 

Public Member Functions

void swap (Impl &other)
 Swap members.
 
 TagTapeBase ()
 Constructor.
 

Static Public Attributes

static Tag constexpr PassiveTag = Tag(0)
 Tag indicating an inactive value.
 

Protected Attributes

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.
 

Tagging specific functions.

void setCurTag (const Tag &tag)
 Set the current tag of the tape.
 
Tag getCurTag ()
 Get the current tag of the tape.
 
template<typename Lhs >
Tag getTagFromVariable (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value)
 Get tag of a CoDiPack active type.
 
template<typename Lhs >
void setTagOnVariable (LhsExpressionInterface< Real, Gradient, Impl, Lhs > const &value)
 Set tag on a CoDiPack active type.
 
template<typename Lhs >
void clearTagOnVariable (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value)
 Clear tag on a CoDiPack active type.
 
template<typename Lhs >
void clearTagPropertiesOnVariable (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value)
 Clear properties on a CoDiPack active type.
 
template<typename Lhs >
void setTagPropertyOnVariable (LhsExpressionInterface< Real, Gradient, Impl, Lhs > &value, TagFlags flag)
 Set properties on a CoDiPack active type.
 
template<typename Lhs >
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.
 
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.
 
template<typename Lhs >
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.
 
template<typename Lhs >
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 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.
 

Detailed Description

template<typename T_Real, typename T_Tag, typename T_Gradient, typename T_Impl>
struct codi::TagTapeBase< T_Real, T_Tag, T_Gradient, T_Impl >

Base implementation for tagging tapes.

Provides all basic management routines for the tag.

See tests/functional/src/testTagging.cpp for an example.

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: