1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-26 12:08:52 -05:00

Config refactoring

This commit is contained in:
hrocho 2019-05-10 21:08:08 +02:00
parent 2068c037b2
commit ee5cc18d77

View File

@ -8,7 +8,7 @@ namespace catima{
* \enum z_eff_type * \enum z_eff_type
* enum to select formulat to calculate effective charge of the Projectile * enum to select formulat to calculate effective charge of the Projectile
*/ */
enum z_eff_type:char { enum z_eff_type:unsigned char {
none = 0, none = 0,
pierce_blann = 1, pierce_blann = 1,
anthony_landorf = 2, anthony_landorf = 2,
@ -43,11 +43,19 @@ namespace catima{
/** /**
* enum to select which dEdx straggling options * enum to select which dEdx straggling options
*/ */
enum omega:unsigned char{ enum omega_types:unsigned char{
atima = 0, atima = 0,
bohr = 1, bohr = 1,
}; };
/**
* enum to select which how low energy part is calculated
*/
enum low_energy_types:unsigned char{
srim_85 = 0,
srim_95 = 1,
};
/** /**
* structure to store calculation configuration * structure to store calculation configuration
* each group of options are grouped and enum are suppose to use * each group of options are grouped and enum are suppose to use
@ -57,16 +65,38 @@ namespace catima{
* *
*/ */
struct Config{ struct Config{
#ifndef GLOBAL
unsigned char z_effective=z_eff_type::pierce_blann; unsigned char z_effective=z_eff_type::pierce_blann;
//char z_effective=z_eff_type::atima14; #else
unsigned char dedx = 0; unsigned char z_effective=z_eff_type::atima14;
unsigned char dedx_straggling = omega::bohr; #endif
#ifdef REACTIONS #ifdef REACTIONS
unsigned char skip=skip_none; unsigned char skip=skip_none;
#else #else
unsigned char skip=skip_calculation::skip_reactions; unsigned char skip=skip_calculation::skip_reactions;
#endif #endif
unsigned char corrections = 0;
unsigned char calculation = 1;
}; };
inline void set_config_lowenergy(Config c, low_energy_types lt){
c.corrections = c.corrections & (lt<<2);
}
inline unsigned char config_lowenergy(const Config c){
return (c.corrections>>2) & 0x7;
}
inline void set_config_omega(Config c, omega_types ot){
c.corrections = c.corrections & ot;
}
inline unsigned char config_omega(const Config c){
return c.corrections & 0x3;
}
extern Config default_config; extern Config default_config;
} }