17#ifdef MOOSE_KOKKOS_SCOPE
18#define KOKKOS_SCALAR_FUNCTION KOKKOS_FUNCTION
20#define KOKKOS_SCALAR_FUNCTION
29template <typename T, typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
71 KOKKOS_SCALAR_FUNCTION
auto operator+() const -> decltype(+
std::declval<const T &>())
79 KOKKOS_SCALAR_FUNCTION
auto operator-() const -> decltype(-
std::declval<const T &>())
90 ->
decltype(std::declval<T &>() +=
value, std::declval<Scalar &>())
100 template <
typename U>
102 ->
decltype(std::declval<T &>() -=
value, std::declval<Scalar &>())
112 template <
typename U>
114 ->
decltype(std::declval<T &>() *=
value, std::declval<Scalar &>())
124 template <
typename U>
126 ->
decltype(std::declval<T &>() /=
value, std::declval<Scalar &>())
136 template <
typename U>
138 ->
decltype(std::declval<T &>() %=
value, std::declval<Scalar &>())
149 template <
typename U = T>
150 auto operator++() ->
decltype(++std::declval<U &>(), std::declval<Scalar &>())
160 template <
typename U = T>
169 template <
typename U = T>
170 auto operator--() ->
decltype(--std::declval<U &>(), std::declval<Scalar &>())
180 template <
typename U = T>
191 template <
typename U>
193 ->
decltype(std::declval<const T &>() +
value)
202 template <
typename U>
204 ->
decltype(std::declval<const T &>() -
value)
213 template <
typename U>
215 ->
decltype(std::declval<const T &>() *
value)
224 template <
typename U>
226 ->
decltype(std::declval<const T &>() /
value)
235 template <
typename U>
237 ->
decltype(std::declval<const T &>() %
value)
243 KOKKOS_SCALAR_FUNCTION
const T &
value()
const {
return static_cast<const T &
>(*this); }
251template <
typename T,
typename Enable>
258 typename =
typename std::enable_if<!is_scalar<typename std::decay<T>::type>::value>::type>
259KOKKOS_SCALAR_FUNCTION
auto
262 return left +
static_cast<const U &
>(right);
267 typename =
typename std::enable_if<!is_scalar<typename std::decay<T>::type>::value>::type>
268KOKKOS_SCALAR_FUNCTION
auto
271 return left -
static_cast<const U &
>(right);
276 typename =
typename std::enable_if<!is_scalar<typename std::decay<T>::type>::value>::type>
277KOKKOS_SCALAR_FUNCTION
auto
280 return left *
static_cast<const U &
>(right);
285 typename =
typename std::enable_if<!is_scalar<typename std::decay<T>::type>::value>::type>
286KOKKOS_SCALAR_FUNCTION
auto
289 return left /
static_cast<const U &
>(right);
294 typename =
typename std::enable_if<!is_scalar<typename std::decay<T>::type>::value>::type>
295KOKKOS_SCALAR_FUNCTION
auto
298 return left %
static_cast<const U &
>(right);
The Kokkos object that can hold the reference of a variable.
T & _reference
Writeable host reference of the variable.
The Kokkos wrapper class that can hold the reference of an arithmetic scalar variable.
auto operator--(int) -> decltype(std::declval< U & >() --)
Postfix decrement the underlying host reference.
KOKKOS_SCALAR_FUNCTION auto operator-() const -> decltype(-std::declval< const T & >())
Get the negated value of the scalar.
auto operator++(int) -> decltype(std::declval< U & >()++)
Postfix increment the underlying host reference.
KOKKOS_SCALAR_FUNCTION auto operator+(const U &value) const -> decltype(std::declval< const T & >()+value)
Add another value to this scalar.
auto operator++() -> decltype(++std::declval< U & >(), std::declval< Scalar & >())
Prefix increment the underlying host reference.
KOKKOS_SCALAR_FUNCTION auto operator%(const U &value) const -> decltype(std::declval< const T & >() % value)
Get the remainder after division by another value.
KOKKOS_SCALAR_FUNCTION auto operator-(const U &value) const -> decltype(std::declval< const T & >() - value)
Subtract another value from this scalar.
auto & operator=(const Scalar &value)
Assign a scalar value to the underlying host reference.
auto operator=(const U &value) -> decltype(std::declval< T & >()=value, std::declval< Scalar & >())
Assign an arithmetic value to the underlying host reference.
KOKKOS_SCALAR_FUNCTION auto operator+() const -> decltype(+std::declval< const T & >())
Get the positive value of the scalar.
auto operator--() -> decltype(--std::declval< U & >(), std::declval< Scalar & >())
Prefix decrement the underlying host reference.
auto operator*=(const U &value) -> decltype(std::declval< T & >() *=value, std::declval< Scalar & >())
Multiply the underlying host reference by another value.
KOKKOS_SCALAR_FUNCTION auto operator*(const U &value) const -> decltype(std::declval< const T & >() *value)
Multiply this scalar by another value.
KOKKOS_SCALAR_FUNCTION const T & value() const
auto operator/=(const U &value) -> decltype(std::declval< T & >()/=value, std::declval< Scalar & >())
Divide the underlying host reference by another value.
auto operator+=(const U &value) -> decltype(std::declval< T & >()+=value, std::declval< Scalar & >())
Add another value to the underlying host reference.
Scalar(T &value)
Constructor.
KOKKOS_SCALAR_FUNCTION auto operator/(const U &value) const -> decltype(std::declval< const T & >()/value)
Divide this scalar by another value.
auto operator-=(const U &value) -> decltype(std::declval< T & >() -=value, std::declval< Scalar & >())
Subtract another value from the underlying host reference.
Scalar(const Scalar &object)
Copy constructor.
auto operator%=(const U &value) -> decltype(std::declval< T & >() %=value, std::declval< Scalar & >())
Assign the remainder after division by another value to the underlying host reference.
KOKKOS_SCALAR_FUNCTION auto operator%(const T &left, const Scalar< U > &right) -> decltype(left % static_cast< const U & >(right))
KOKKOS_SCALAR_FUNCTION auto operator/(const T &left, const Scalar< U > &right) -> decltype(left/static_cast< const U & >(right))
KOKKOS_SCALAR_FUNCTION auto operator-(const T &left, const Scalar< U > &right) -> decltype(left - static_cast< const U & >(right))
KOKKOS_SCALAR_FUNCTION auto operator+(const T &left, const Scalar< U > &right) -> decltype(left+static_cast< const U & >(right))
KOKKOS_SCALAR_FUNCTION auto operator*(const T &left, const Scalar< U > &right) -> decltype(left *static_cast< const U & >(right))
The type trait that determines the default behavior of copy constructor and deepCopy() If this type t...
static constexpr bool value