52typedef std::pair<std::string, std::string>
str_entry;
54typedef std::map<std::string, num_entry>
map_num;
55typedef std::map<std::string, str_entry>
map_str;
56typedef std::map<std::string, bool_entry>
map_bool;
100 int load(
int n,
char **val,
bool initialise=
false);
177 inline int get(std::string name,
double& val){
185 inline int get(std::string name, std::string& val){
193 inline int get(std::string name,
bool& val){
202 std::vector<std::string>
keys(){
204 std::vector<std::string> keys_list;
206 keys_list.push_back(key.first);
208 keys_list.push_back(key.first);
227 inline int set(std::string name,
double val){
245 inline int set(std::string name, std::string val){
274 params_num[
"min_z"].first=*std::min_element(Zlist.begin(), Zlist.end());
275 params_num[
"max_z"].first=*std::max_element(Zlist.begin(), Zlist.end());
297 params_num[
"min_z_he"].first=*std::min_element(Zlist_HE.begin(), Zlist_HE.end());
298 params_num[
"max_z_he"].first=*std::max_element(Zlist_HE.begin(), Zlist_HE.end());
323 double minzams=-1e30, maxzams=1e30;
324 for (
auto& zams_at_Z : Zams_list){
325 size_t last_track = zams_at_Z.size();
326 minzams = zams_at_Z[0]>minzams ? zams_at_Z[0] : minzams;
327 maxzams = zams_at_Z[last_track-1]<maxzams ? zams_at_Z[last_track-1] : maxzams;
356 double minzams=-1e30, maxzams=1e30;
357 for (
auto& zams_at_Z : Zams_list_HE){
358 size_t last_track = zams_at_Z.size();
359 minzams = zams_at_Z[0]>minzams ? zams_at_Z[0] : minzams;
360 maxzams = zams_at_Z[last_track-1]<maxzams ? zams_at_Z[last_track-1] : maxzams;
417 std::string
print(
bool use_default=
false){
420 std::ostringstream out;
428 header=
"#DEFAULT PARAMS";
435 header=
"#USED PARAMS";
439 out<<header<<std::endl;
441 std::string info_set;
452 out<<std::setw(col_width)<<std::left<<element.first+
": "<<
453 std::setw(col_width)<<element.second.first<<
"//"+info_set+element.second.second<<std::endl;
464 out<<std::setw(col_width)<<std::left<<element.first+
": "<<
465 std::setw(col_width)<<element.second.first<<
"//"+info_set+element.second.second<<std::endl;
477 std::string val = element.second.first==
true ?
"true" :
"false";
479 out<<std::setw(col_width)<<std::left<<element.first+
": "<<
480 std::setw(col_width)<<val<<
"//"+info_set+element.second.second<<std::endl;
540 inline int prv_set(std::string name,
double val){
548 svlog.
warning(
"Trying to set the num key "+name+
". The key is non settable ",__FILE__,__LINE__);
559 inline int prv_set(std::string name, std::string val){
567 svlog.
warning(
"Trying to set the str key "+name+
". The key is non settable ",__FILE__,__LINE__);
578 inline int prv_set(std::string name,
bool val){
586 svlog.
warning(
"Trying to set the boolean key "+name+
". The key is non settable ",__FILE__,__LINE__);
610 std::string svalue=val;
616 value = utilities::s2n<double>(svalue, __FILE__, __LINE__);
618 if (ret==EXIT_FAILURE)
619 svlog.
critical(
"The num key "+name+
" is not settable at runtime");
622 if (ret==EXIT_FAILURE)
623 svlog.
critical(
"The str key "+name+
" is not settable at runtime");
626 if (val==
"true" || val==
"t" || val==
"yes" || val==
"y") value=
true;
627 else if (val==
"false" || val==
"f" || val==
"no" || val==
"yn") value=
false;
628 else svlog.
critical(
"A boolean parameter can be set only with a string: (t)rue, (y)es,"
631 if (ret==EXIT_FAILURE)
632 svlog.
critical(
"The bool key "+name+
" is not settable at runtime");
782 svlog.
critical(
"star_lambda>0 or star_lambda=(-1,-11,-12,-13,-2,-21,-3,-31,-4,-41,,-5,-51), current value is "+
n2s(
"star_lambda"),__FILE__,__LINE__,
sevnstd::params_error());
783 if (
get_num(
"star_lambda_pureHe")<=0)
785 if (
get_num(
"star_lambda_fth")<0. or
get_num(
"star_lambda_fth")>1.)
788 svlog.
warning(
"The parameter star_lambda_fth is larger than 0, but the parameter star_lambda is not -1. The star_lambda_fth will not be used!",
790 if (
get_num(
"star_tshold_WR_envelope")<0 or
get_num(
"star_tshold_WR_envelope")>1)
800 if (
get_num(
"ns_magnetic_tscale")<=0.)
802 if (
get_num(
"ns_magnetic_mscale")<=0.)
810 if (
get_num(
"sn_co_lower_sn")<=0)
812 if (
get_num(
"sn_co_lower_ecsn")<=0)
816 if (
get_num(
"sn_max_ns_mass")<=0)
818 if (
get_num(
"sn_Mchandra")<=0.)
820 if (
get_num(
"sn_compact_csi25_tshold")<0. and
get_num(
"sn_compact_csi25_tshold")!=-1)
822 if (
get_num(
"sn_Mremnant_average_NS")<=0.)
825 svlog.
critical(
"M_mean for NS mass distribution is larger than the maximum ns mass, this means that more than 50% of the sample will be rejected. Please use a different the input distribution.",__FILE__,__LINE__,
sevnstd::params_error());
826 if (
get_num(
"sn_Mremnant_std_NS")<=0.)
828 if (
get_num(
"sn_compact_fallback")<0. or
get_num(
"sn_compact_fallback")>1.)
830 if (
get_num(
"sn_Mremnant_average")<=0. and
get_num(
"sn_Mremnant_average")!=-1.)
832 if (
get_num(
"sn_Mejected_average")<=0. and
get_num(
"sn_Mremnant_average")!=-1.)
851 svlog.
critical(
"ts_max_dt>ts_min_dt, current values are ts_max_dt= "+
n2s(
"ts_max_dt")+
865 const double MIN_ZAMS=
get_num(
"min_zams");
866 const double MAX_ZAMS=
get_num(
"max_zams");
872 if (MAX_ZAMS<MIN_ZAMS)
873 svlog.
critical(
"MAX_ZAMS>MIN_ZAMS, current values are: MAX_ZAMS= "+
n2s(MAX_ZAMS)
887 const double MIN_ZAMS=
get_num(
"min_zams_he");
888 const double MAX_ZAMS=
get_num(
"max_zams_he");
894 if (MAX_ZAMS<MIN_ZAMS)
895 svlog.
critical(
"MAX_ZAMS_HE>MIN_ZAMS_HE, current values are: MAX_ZAMS_HE= "+
n2s(MAX_ZAMS)
909 const double MINZ=
get_num(
"min_z");
910 const double MAXZ=
get_num(
"max_z");
932 const double MINZ=
get_num(
"min_z_he");
933 const double MAXZ=
get_num(
"max_z_he");
940 svlog.
critical(
"MAX_Z_HE>MIN_Z_HE, current values are: MAX_Z_HE= "+
n2s(MAXZ)
956 if (
get_num(
"jtrack_tshold_dm_rel")<=0)
958 if (
get_num(
"jtrack_h_err_rel_max")<=0)
960 if (
get_num(
"jtrack_max_dm_factor")<0)
962 if (
get_num(
"jtrack_min_dm_factor")<0)
964 if (
get_num(
"jtrack_max_iteration")<=0)
966 if (
get_num(
"jtrack_max_dm_factor")<=
get_num(
"jtrack_min_dm_factor"))
967 svlog.
critical(
"jtrack_max_dm_factor>jtrack_min_dm_factor, current values are: jtrack_max_dm_factor="+
969 if (
get_num(
"jtrack_dm_step")<=0)
983 if (
get_num(
"rlo_f_mass_accreted")<0 ||
get_num(
"rlo_f_mass_accreted")>1)
988 bool negative_gamma_ok = (
get_num(
"rlo_gamma_angmom")==-1.0) || (
get_num(
"rlo_gamma_angmom")==-2.0);
989 if ( (
get_num(
"rlo_gamma_angmom")<0) && (negative_gamma_ok==
false) )
991 if (
get_num(
"rlo_gamma_angmom")>1)
994 if (
get_num(
"rlo_max_nuclearmt")<0)
1032 if (
get_num(
"eddington_factor")<0)
1080 if (
get_num(
"hard_mass_average")<0.)
1088 if(
get_str(
"spin")!=
"list" and !utilities::string_is_number<double>(
get_str(
"spin"))){
1091 else if(
get_str(
"spin")!=
"list"){
1092 std::string s=
get_str(
"spin");
1093 double spin = utilities::s2n<double>(s,__FILE__,__LINE__);
1094 if(spin<0 or spin>1){
1122 svlog.
critical(
"Output mode set to \"" +
get_str(
"omode") +
"\" but hdf5 is not available (you can make it available with the option -Dh5=ON in cmake)", __FILE__, __LINE__);
1139 if (
get_num(
"ev_max_repetitions")<=0)
1143 if (
get_num(
"ev_naked_tshold")>1e-4)
1146 if(
get_str(
"ev_setwM")!=
"linear" and
get_str(
"ev_setwM")!=
"rational" and
get_str(
"ev_setwM")!=
"log"){
1149 if(
get_str(
"ev_setwM_log")!=
"linear" and
get_str(
"ev_setwM_log")!=
"rational" and
get_str(
"ev_setwM_log")!=
"log"){
1152 if(
get_str(
"ev_setwM_tphase")!=
"linear" and
get_str(
"ev_setwM_tphase")!=
"rational" and
get_str(
"ev_setwM_tphase")!=
"log"){
1162 std::string allowed_log[5]={
"debug",
"info",
"warning",
"error",
"critical"};
1173 if (
get_num(
"check_stalling_time")<=0)
1184 inline std::string
n2s(std::string name){
1192 inline std::string
n2s(
double val){
bool check()
CHECK.
Definition: params.h:746
int set(std::string name, double val)
SET and SET like stuff.
Definition: params.h:227
int init()
Definition: params.h:728
bool check_mzams()
Definition: params.h:863
int prv_set(std::string name, double val)
SET.
Definition: params.h:540
SevnLogging svlog
Definition: params.h:514
bool check_ns()
Definition: params.h:799
int set_zlimit(const std::vector< double > &Zlist)
SPECIAL SET.
Definition: params.h:272
const map_num & get_num_map()
GET and GET like stuff.
Definition: params.h:104
std::string print(bool use_default=false)
Definition: params.h:417
bool check_z_he()
Definition: params.h:930
bool check_parameters()
Definition: params.h:1086
double get_num(std::string name)
Definition: params.h:124
static std::size_t instance_counter
Definition: params.h:515
bool get_bool(std::string name)
Definition: params.h:158
double ts_maximum_variation()
Parameter function.
Definition: params.h:509
bool check_GW()
Definition: params.h:1007
bool check_winds()
Definition: params.h:1020
bool is_str_par(std::string name)
Definition: params.h:679
int get(std::string name, bool &val)
Definition: params.h:193
int set_tables(std::string tables)
Definition: params.h:390
bool check_mzams_he()
Definition: params.h:885
bool check_ce()
Definition: params.h:1044
int default_value_num()
Initialisation methods.
Definition: params.cpp:53
bool check_accretion()
Definition: params.h:1031
const map_bool & get_bool_map()
Definition: params.h:112
bool check_sn()
Definition: params.h:809
int load(int n, char **val, bool initialise=false)
load
Definition: params.cpp:307
std::string n2s(double val)
Definition: params.h:1192
int get(std::string name, double &val)
Definition: params.h:177
std::string n2s(std::string name)
Definition: params.h:1184
~SEVNpar()
Definition: params.h:84
static std::set< std::string > public_settable
Definition: params.h:525
bool check_timestep()
Definition: params.h:844
bool is_settable(std::string name)
Definition: params.h:663
int get(std::string name, std::string &val)
Definition: params.h:185
int set(std::string name, std::string val)
Definition: params.h:245
static std::set< std::string > private_settable
Definition: params.h:526
int prv_set(std::string name, bool val)
Definition: params.h:578
bool check_systems()
Definition: params.h:1170
SEVNpar(int argc, char **argv)
Definition: params.h:77
std::vector< std::string > keys()
Definition: params.h:202
bool check_rlobe()
Definition: params.h:982
map_str params_str
Definition: params.h:521
SEVNpar()
Constructor.
Definition: params.h:66
bool check_star()
Definition: params.h:777
int set_zlimit_HE(const std::vector< double > &Zlist_HE)
Definition: params.h:295
map_num params_num
Definition: params.h:520
int prv_set(std::string name, std::string val)
Definition: params.h:559
bool check_log()
Definition: params.h:1160
const map_str & get_str_map()
Definition: params.h:108
bool check_option_mode()
Definition: params.h:1102
bool is_private_settable(std::string name)
Definition: params.h:655
bool check_jtrack()
Definition: params.h:953
bool is_par(std::string name)
Definition: params.h:695
bool is_public_settable(std::string name)
Definition: params.h:647
bool is_num_par(std::string name)
Definition: params.h:671
int set_tablesHE(std::string tablesHE)
Definition: params.h:400
bool check_z()
Definition: params.h:907
int default_value_bool()
Definition: params.cpp:240
int default_value_str()
Definition: params.cpp:169
int set_from_string(std::string name, std::string val)
Definition: params.h:607
int set_zams_limit(const std::vector< std::vector< double > > &Zams_list)
Definition: params.h:318
int set_myself()
Definition: params.h:381
std::string get_str(std::string name)
Definition: params.h:142
map_bool params_bool
Definition: params.h:522
int set_zams_limit_he(const std::vector< std::vector< double > > &Zams_list_HE)
Definition: params.h:351
bool is_bool_par(std::string name)
Definition: params.h:687
friend std::ostream & operator<<(std::ostream &os, SEVNpar &svpar)
Definition: params.h:501
bool check_ev()
Definition: params.h:1137
bool check_hard()
Definition: params.h:1070
void critical(std::string errstate, const char *file_input=nullptr, int line_input=-1) const
Definition: sevnlog.cpp:85
void warning(std::string errstate, const char *file_input=nullptr, int line_input=-1) const
Definition: sevnlog.cpp:137
Definition: errhand.h:144
Definition: lookup_and_phases.h:17
const GWMAP gwmap
Definition: lookup_and_phases.cpp:172
const SNKMAP snkmap
Definition: lookup_and_phases.cpp:188
const OUTPUTMAP outputmap
Definition: lookup_and_phases.cpp:92
const WINDSMAP windsmap
Definition: lookup_and_phases.cpp:121
const std::vector< std::string > xspinmodes
Definition: lookup_and_phases.h:141
const RLMAP rlmap
Definition: lookup_and_phases.h:243
const TIDESMAP tidesmap
Definition: lookup_and_phases.cpp:157
const CEMAP cemap
Definition: lookup_and_phases.cpp:197
const MIXMAP mixmap
Definition: lookup_and_phases.cpp:181
std::string get_absolute_SEVN_path()
Definition: utilities.h:573
bool isinlist(T element, Iter it, Iter end)
Definition: utilities.h:642
const std::string n2s(T val, const char *file_input, const int line_input, const unsigned int precision=6)
Definition: utilities.h:144
std::pair< bool, std::string > bool_entry
Definition: params.h:53
std::map< std::string, bool_entry > map_bool
Definition: params.h:56
std::pair< double, std::string > num_entry
Definition: params.h:51
std::map< std::string, str_entry > map_str
Definition: params.h:55
std::map< std::string, num_entry > map_num
Definition: params.h:54
std::pair< std::string, std::string > str_entry
Definition: params.h:52