39#include "../../../expressions/activeType.hpp"
40#include "../../../traits/atomicTraits.hpp"
41#include "../../../traits/realTraits.hpp"
42#include "../../../traits/tapeTraits.hpp"
43#include "../reverseAtomicInterface.hpp"
60 template<
typename T_Type,
typename T_Sfinae =
void>
69#ifndef DOXYGEN_DISABLE
72 template<
typename T_Type>
75 T_Type, OpenMPReverseAtomicImpl<T_Type, typename std::enable_if<std::is_arithmetic<T_Type>::value>::type>> {
105 CODI_OMP_ATOMIC(update)
106 this->value += other;
115 template<
typename T_Type>
116 struct OpenMPReverseAtomicImpl<T_Type, TapeTraits::
EnableIfForwardTape<typename T_Type::Tape>>
117 :
public ReverseAtomicInterface<
118 T_Type, OpenMPReverseAtomicImpl<T_Type, TapeTraits::EnableIfForwardTape<typename T_Type::Tape>>>,
121 using Type =
CODI_DD(T_Type, CODI_DEFAULT_LHS_EXPRESSION);
123 T_Type, OpenMPReverseAtomicImpl<T_Type, TapeTraits::EnableIfForwardTape<typename T_Type::Tape>>>;
124 using Tape =
typename Type::Tape;
125 using Real =
typename Type::Real;
126 using Gradient =
typename Type::Gradient;
139 Type::operator=(other);
148 OpenMPReverseAtomicImpl<Real>* atomicValue =
reinterpret_cast<OpenMPReverseAtomicImpl<Real>*
>(&this->value());
149 OpenMPReverseAtomicImpl<Gradient>* atomicGradient =
150 reinterpret_cast<OpenMPReverseAtomicImpl<Gradient>*
>(&this->gradient());
152 *atomicValue += other.value();
153 *atomicGradient += other.gradient();
157 return static_cast<Type>(*this);
165 template<
typename Type>
169 template<
typename T_Type>
172#ifndef DOXYGEN_DISABLE
174 template<
typename T_Type>
184 return typename Type::Type() == v;
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition config.h:457
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:94
#define CODI_T(...)
Abbreviation for CODI_TEMPLATE.
Definition macros.hpp:111
typename std::enable_if< IsForwardTape< Tape >::value >::type EnableIfForwardTape
Enable if wrapper for IsForwardTape.
Definition tapeTraits.hpp:93
CoDiPack - Code Differentiation Package.
Definition codi.hpp:91
Represents a concrete lvalue in the CoDiPack expression tree.
Definition activeType.hpp:52
Indicate whether a type is atomic.
Definition atomicTraits.hpp:51
Reverse atomic implementation for OpenMP.
Definition openMPReverseAtomic.hpp:61
T_Type Type
See OpenMPReverseAtomicImpl.
Definition openMPReverseAtomic.hpp:63
OpenMPReverseAtomicImpl()=delete
Function for checking if the value of the type is completely zero.
Definition realTraits.hpp:100
T_Type Type
See IsTotalZero.
Definition realTraits.hpp:103
static bool isTotalZero(Type const &v)
Checks if the values are completely zero.
Definition realTraits.hpp:106
Provides a data type on which += update operations are performed atomically.
Definition reverseAtomicInterface.hpp:60
Impl & operator=(Impl const &other)
Assignment operator with implementing type as rhs. Not atomic.
void operator+=(Impl const &other)
Atomic incremental update with implementing type as rhs.
ReverseAtomicInterface()
Constructor.
Definition reverseAtomicInterface.hpp:65