1#ifndef __BIO__UTILS_HPP__
2#define __BIO__UTILS_HPP__
4#include "Kokkos_Macros.hpp"
5#include <Kokkos_Core.hpp>
6#include <Kokkos_MathematicalConstants.hpp>
7#include <Kokkos_Random.hpp>
8#include <common/traits.hpp>
10#include <mc/prng/prng.hpp>
17 template <FloatingPo
intType T>
28 template <FloatingPo
intType T>
constexpr T
glucose =
static_cast<T
>(180);
29 template <FloatingPo
intType T>
constexpr T
dioxygen =
static_cast<T
>(32);
30 template <FloatingPo
intType T>
constexpr T
acetate =
static_cast<T
>(59);
32 constexpr double co2 = 44;
43 [[deprecated]]
constexpr double X = 113.1e-3;
46 template <FloatingPo
intType F>
49 return rho * F(Kokkos::numbers::pi) * d * d / F(4.);
61 auto generator = random_pool.get_state();
62 const double x = generator.drand(0., 1.);
63 random_pool.free_state(generator);
70 KOKKOS_INLINE_FUNCTION
double
73 return (lenght <= threshold)
75 : (lenght - threshold) / (upper_bound - threshold);
78 KOKKOS_INLINE_FUNCTION
constexpr float
85 const auto z = x < xmax ? std::pow(x / (xmax - x), alpha) : 1.;
91 KOKKOS_INLINE_FUNCTION
bool
94 return Kokkos::abs(val - val2) < tolerance;
97 template <
typename... Args>
98 KOKKOS_INLINE_FUNCTION
double min_var(Args... args)
100 return (Kokkos::min)({args...});
102 template <> KOKKOS_INLINE_FUNCTION
double min_var()
Kokkos::Random_XorShift1024_Pool< Kokkos::DefaultExecutionSpace > pool_type
Definition prng.hpp:33
Status
Definition alias.hpp:37
@ Division
Definition alias.hpp:39
@ Idle
Definition alias.hpp:38
KOKKOS_INLINE_FUNCTION double threshold_linear(double lenght, double threshold, double upper_bound)
Definition utils.hpp:71
KOKKOS_INLINE_FUNCTION constexpr float logistic(float x, float xmax, float alpha)
Definition utils.hpp:79
constexpr T acetate
Definition utils.hpp:30
constexpr T glucose
Definition utils.hpp:28
constexpr T dioxygen
Definition utils.hpp:29
constexpr double co2
Definition utils.hpp:32
constexpr double acetate
Definition utils.hpp:39
constexpr double co2
Definition utils.hpp:41
constexpr double X
Definition utils.hpp:43
constexpr double glucose
Definition utils.hpp:36
constexpr double dioxygen
Definition utils.hpp:37
Models definition.
Definition config_loader.hpp:9
KOKKOS_INLINE_FUNCTION bool check_probability_division(double d_t, double gamma, MC::KPRNG::pool_type random_pool)
Definition utils.hpp:54
KOKKOS_INLINE_FUNCTION double min_var()
Definition utils.hpp:102
KOKKOS_INLINE_FUNCTION MC::Status check_div(const T l, const T lc)
Definition utils.hpp:18
KOKKOS_INLINE_FUNCTION bool almost_equal(double val, double val2, double tolerance=1e-8)
Definition utils.hpp:92
KOKKOS_INLINE_FUNCTION consteval F c_linear_density(F rho, F d)
Definition utils.hpp:47
static constexpr double tau_division_proba
Definition utils.hpp:52