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 F>
20 F glucose_to_biomass_yield = 0.5)
23 return (dl * density) / glucose_to_biomass_yield;
26 template <FloatingPo
intType T>
38 template <FloatingPo
intType T>
constexpr T
glucose =
static_cast<T
>(180);
39 template <FloatingPo
intType T>
constexpr T
dioxygen =
static_cast<T
>(32);
40 template <FloatingPo
intType T>
constexpr T
acetate =
static_cast<T
>(59);
42 constexpr double co2 = 44;
53 [[deprecated]]
constexpr double X = 113.1e-3;
56 template <FloatingPo
intType F>
57 KOKKOS_INLINE_FUNCTION
consteval F
60 return rho * F(Kokkos::numbers::pi) * d * d / F(4.);
65 KOKKOS_INLINE_FUNCTION
bool
74 auto generator = random_pool.get_state();
75 const double x = generator.drand(0., 1.);
76 random_pool.free_state(generator);
83 KOKKOS_INLINE_FUNCTION
double
86 return (lenght <= threshold)
88 : (lenght - threshold) / (upper_bound - threshold);
91 KOKKOS_INLINE_FUNCTION
constexpr float
98 const auto z = x < xmax ? std::pow(x / (xmax - x), alpha) : 1.;
104 KOKKOS_INLINE_FUNCTION
bool
107 return Kokkos::abs(val - val2) < tolerance;
110 KOKKOS_INLINE_FUNCTION
constexpr bool
113 return (-tol < x) && (x < tol);
116 template <
typename... Args>
117 KOKKOS_INLINE_FUNCTION
double
120 return (Kokkos::min)({ args... });
123 KOKKOS_INLINE_FUNCTION
double
Status
Definition alias.hpp:58
@ Division
Definition alias.hpp:60
@ Idle
Definition alias.hpp:59
gen_pool_type< Kokkos::DefaultExecutionSpace > pool_type
Definition alias.hpp:39
KOKKOS_INLINE_FUNCTION double threshold_linear(double lenght, double threshold, double upper_bound)
Definition utils.hpp:84
KOKKOS_INLINE_FUNCTION constexpr float logistic(float x, float xmax, float alpha)
Definition utils.hpp:92
constexpr T acetate
Definition utils.hpp:40
constexpr T glucose
Definition utils.hpp:38
constexpr T dioxygen
Definition utils.hpp:39
constexpr double co2
Definition utils.hpp:42
constexpr double acetate
Definition utils.hpp:49
constexpr double co2
Definition utils.hpp:51
constexpr double X
Definition utils.hpp:53
constexpr double glucose
Definition utils.hpp:46
constexpr double dioxygen
Definition utils.hpp:47
Models definition.
Definition config_loader.hpp:9
KOKKOS_INLINE_FUNCTION bool check_probability_division(double d_t, double gamma, MC::pool_type random_pool)
Definition utils.hpp:66
KOKKOS_INLINE_FUNCTION double min_var()
Definition utils.hpp:124
KOKKOS_INLINE_FUNCTION constexpr bool almost_zero(double x, double tol=1e-8)
Definition utils.hpp:111
KOKKOS_INLINE_FUNCTION MC::Status check_div(const T l, const T lc)
Definition utils.hpp:28
KOKKOS_INLINE_FUNCTION bool almost_equal(double val, double val2, double tolerance=1e-8)
Definition utils.hpp:105
static F consteval _get_phi_s_max(F density, F dl, F glucose_to_biomass_yield=0.5)
Definition utils.hpp:18
KOKKOS_INLINE_FUNCTION consteval F c_linear_density(F rho, F d)
Definition utils.hpp:58
static constexpr double tau_division_proba
Definition utils.hpp:63