CoDiPack  2.3.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::ReverseAtomicInterface< T_Type, T_Impl > Struct Template Reference

Provides a data type on which += update operations are performed atomically. More...

#include <reverseAtomicInterface.hpp>

Inheritance diagram for codi::ReverseAtomicInterface< T_Type, T_Impl >:

Public Types

using Impl = T_Impl
 See ReverseAtomicInterface.
 
using Type = T_Type
 See ReverseAtomicInterface.
 

Public Member Functions

 operator Type () const
 Implicit cast to underlying type for rhs access. Not atomic.
 
void operator+= (Impl const &other)
 Atomic incremental update with implementing type as rhs.
 
void operator+= (Type const &other)
 Atomic incremental update with underlying type as rhs.
 
Imploperator= (Impl const &other)
 Assignment operator with implementing type as rhs. Not atomic.
 
Imploperator= (Type const &other)
 Assignment operator with underlying type as rhs. Not atomic.
 
 ReverseAtomicInterface ()
 Constructor.
 
 ReverseAtomicInterface (ReverseAtomicInterface const &)
 Constructor.
 
 ReverseAtomicInterface (Type const &)
 Constructor.
 
 ~ReverseAtomicInterface ()
 Destructor.
 

Detailed Description

template<typename T_Type, typename T_Impl>
struct codi::ReverseAtomicInterface< T_Type, T_Impl >

Provides a data type on which += update operations are performed atomically.

In a multithreaded environment, data races on adjoint variables are fixed by performing updates atomically, whereas other read and write operations do not need to be atomic. This template takes an ordinary adjoint variable type, like a floating point type or a CoDiPack forward type, and ensures that the corresponding += update operation is performed atomically.

Implementations likely require template specializations with respect to the underlying type, especially if it is an active CoDiPack type.

An implementation should preserve the memory footprint of the underlying type, e.g., by inheriting from the under- lying type or by having a variable of the underlying type as the only member variable.

Template Parameters
T_TypeThe underlying data type.
T_ImplImplementing class.

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