1#ifndef __SIMULATION_PROBA_LEAVING_HPP__
2#define __SIMULATION_PROBA_LEAVING_HPP__
4#include <Kokkos_Core.hpp>
7static constexpr bool _use_kokkos_log =
true;
12 template <
bool use_kokkos_log>
13 KOKKOS_INLINE_FUNCTION
typename std::enable_if<!use_kokkos_log, float>::type
_ln(
float x)
15 unsigned int bx = *
reinterpret_cast<unsigned int*
>(&x);
16 const unsigned int ex = bx >> 23;
17 const signed int t =
static_cast<signed int>(ex) -
static_cast<signed int>(127);
19 bx = 1065353216 | (bx & 8388607);
20 x = *
reinterpret_cast<float*
>(&bx);
21 return -1.49278 + (2.11263 + (-0.729104 + 0.10969 * x) * x) * x + 0.6931471806 * t;
24 template <
bool use_kokkos_log>
25 KOKKOS_INLINE_FUNCTION
typename std::enable_if<use_kokkos_log, float>::type
_ln(
float x)
27 return Kokkos::log(x);
30 KOKKOS_INLINE_FUNCTION
bool
Definition move_kernel.hpp:19
KOKKOS_INLINE_FUNCTION std::enable_if<!use_kokkos_log, float >::type _ln(float x)
Definition probability_leaving.hpp:13
KOKKOS_INLINE_FUNCTION bool probability_leaving(float random_number, double volume, double flow, double dt)
Definition probability_leaving.hpp:31