CellModules
config.hpp
Go to the documentation of this file.
1#ifndef CONFIG_HPP
2#define CONFIG_HPP
3#include <random>
4
5namespace MecaCell {
6struct Config {
7 // TYPES
8 using random_engine_t = std::mt19937; // used for random vectors
9 // fallback global
11
13 static thread_local random_engine_t* ptr = &globalEngine_;
14 return ptr;
15 }
16
17
18
19 // CONST
20 static constexpr double DEFAULT_CELL_DAMP_RATIO = 1.0;
21 static constexpr double DEFAULT_CELL_RADIUS = 40;
22 static constexpr double DEFAULT_CELL_MASS = 0.04;
23 static constexpr double DEFAULT_CELL_STIFFNESS = 4.0;
24 static constexpr double DEFAULT_CELL_YOUNGMOD = 1.0;
25 static constexpr double DEFAULT_CELL_POISSONCOEF = 0.3;
26
31 static constexpr double DOUBLE_EPSILON = 1e-20;
32
40 //std::random_device rd;
41 return *engine_ptr();
42 }
43
44 static inline void setCurrentEngine(random_engine_t* eng) {
45 engine_ptr() = eng;
46 }
47};
48} // namespace MecaCell
49#endif
this file contains various miscellanious utility functions & helpers *
T * ptr(T &obj)
returns a pointer (transforms reference into pointer)
Definition: utils.hpp:32
static constexpr double DEFAULT_CELL_POISSONCOEF
Definition: config.hpp:25
static random_engine_t globalEngine_
Definition: config.hpp:10
static constexpr double DOUBLE_EPSILON
max distance for two doubles to be considered equals (only used for some geometric operations)
Definition: config.hpp:31
static constexpr double DEFAULT_CELL_MASS
Definition: config.hpp:22
static constexpr double DEFAULT_CELL_DAMP_RATIO
Definition: config.hpp:20
static void setCurrentEngine(random_engine_t *eng)
Definition: config.hpp:44
std::mt19937 random_engine_t
Definition: config.hpp:8
static random_engine_t & globalRand()
access to the static global random engine.This pseudo - random generator is* used in random 3D vector...
Definition: config.hpp:39
static random_engine_t *& engine_ptr()
Definition: config.hpp:12
static constexpr double DEFAULT_CELL_RADIUS
Definition: config.hpp:21
static constexpr double DEFAULT_CELL_YOUNGMOD
Definition: config.hpp:24
static constexpr double DEFAULT_CELL_STIFFNESS
Definition: config.hpp:23