SEVN
Loading...
Searching...
No Matches
SEVNpar Class Reference

#include <params.h>

Public Member Functions

 SEVNpar ()
 Constructor. More...
 
 SEVNpar (int argc, char **argv)
 
 ~SEVNpar ()
 
int load (int n, char **val, bool initialise=false)
 load More...
 
const map_numget_num_map ()
 GET and GET like stuff. More...
 
const map_strget_str_map ()
 
const map_boolget_bool_map ()
 
double get_num (std::string name)
 
std::string get_str (std::string name)
 
bool get_bool (std::string name)
 
int get (std::string name, double &val)
 
int get (std::string name, std::string &val)
 
int get (std::string name, bool &val)
 
std::vector< std::string > keys ()
 
int set (std::string name, double val)
 SET and SET like stuff. More...
 
int set (std::string name, std::string val)
 
int set_zlimit (const std::vector< double > &Zlist)
 SPECIAL SET. More...
 
int set_zlimit_HE (const std::vector< double > &Zlist_HE)
 
int set_zams_limit (const std::vector< std::vector< double > > &Zams_list)
 
int set_zams_limit_he (const std::vector< std::vector< double > > &Zams_list_HE)
 
int set_myself ()
 
int set_tables (std::string tables)
 
int set_tablesHE (std::string tablesHE)
 
std::string print (bool use_default=false)
 
double ts_maximum_variation ()
 Parameter function. More...
 

Protected Attributes

SevnLogging svlog
 

Static Protected Attributes

static std::size_t instance_counter =0
 

Private Member Functions

int prv_set (std::string name, double val)
 SET. More...
 
int prv_set (std::string name, std::string val)
 
int prv_set (std::string name, bool val)
 
int set_from_string (std::string name, std::string val)
 
bool is_public_settable (std::string name)
 
bool is_private_settable (std::string name)
 
bool is_settable (std::string name)
 
bool is_num_par (std::string name)
 
bool is_str_par (std::string name)
 
bool is_bool_par (std::string name)
 
bool is_par (std::string name)
 
int default_value_num ()
 Initialisation methods. More...
 
int default_value_str ()
 
int default_value_bool ()
 
int init ()
 
bool check ()
 CHECK. More...
 
bool check_star ()
 
bool check_ns ()
 
bool check_sn ()
 
bool check_timestep ()
 
bool check_mzams ()
 
bool check_mzams_he ()
 
bool check_z ()
 
bool check_z_he ()
 
bool check_jtrack ()
 
bool check_rlobe ()
 
bool check_GW ()
 
bool check_winds ()
 
bool check_accretion ()
 
bool check_ce ()
 
bool check_hard ()
 
bool check_parameters ()
 
bool check_option_mode ()
 
bool check_ev ()
 
bool check_log ()
 
bool check_systems ()
 
std::string n2s (std::string name)
 
std::string n2s (double val)
 

Private Attributes

map_num params_num
 
map_str params_str
 
map_bool params_bool
 

Static Private Attributes

static std::set< std::string > public_settable {}
 
static std::set< std::string > private_settable
 

Friends

std::ostream & operator<< (std::ostream &os, SEVNpar &svpar)
 

Constructor & Destructor Documentation

◆ SEVNpar() [1/2]

SEVNpar::SEVNpar ( )
inline

Constructor.

Default constructor: just the parameters to the default value.

◆ SEVNpar() [2/2]

SEVNpar::SEVNpar ( int  argc,
char **  argv 
)
inline

Constructor to load parameters from line command

Parameters
argcNumber of arguments
argvarguments

◆ ~SEVNpar()

SEVNpar::~SEVNpar ( )
inline

Member Function Documentation

◆ check()

bool SEVNpar::check ( )
inlineprivate

CHECK.

Method to check the values of the parameters

Returns
true if all the checks are true, false if at least one check is false or throw an error.
Exceptions
sevnstd::params_errorThrown if one of the checks raise an error when it is not satisfied

◆ check_accretion()

bool SEVNpar::check_accretion ( )
inlineprivate

◆ check_ce()

bool SEVNpar::check_ce ( )
inlineprivate

check the parameter(s) related to the common envelope process.

Returns
true or throw an error.
Exceptions
sevnstd::params_errorThrown if one of the checks fail.

◆ check_ev()

bool SEVNpar::check_ev ( )
inlineprivate

Check the parameter(s) related to the general evolution process

Returns
true or throw an error.
Exceptions
sevnstd::params_errorThrown if one of the checks fail.

◆ check_GW()

bool SEVNpar::check_GW ( )
inlineprivate

check the parameter(s) related to the GW rad process.

Returns
true or throw an error.
Exceptions
sevnstd::params_errorThrown if one of the checks fail.

◆ check_hard()

bool SEVNpar::check_hard ( )
inlineprivate

check the paramters related to the hardening process.

Returns
true or throw an error.
Exceptions
sevnstd::params_errorThrown if one of the checks fail.

◆ check_jtrack()

bool SEVNpar::check_jtrack ( )
inlineprivate

check the parameter(s) related the tracks jump

Returns
true or throw an error.
Exceptions
sevnstd::params_errorThrown if one of the checks fail.

◆ check_log()

bool SEVNpar::check_log ( )
inlineprivate

◆ check_mzams()

bool SEVNpar::check_mzams ( )
inlineprivate

check the parameter(s) containing the limit of the ZAMS mass from the tables.

Returns
true or throw an error.
Exceptions
sevnstd::params_errorThrown if one of the checks fail.

◆ check_mzams_he()

bool SEVNpar::check_mzams_he ( )
inlineprivate

check the parameter(s) containing the limit of the ZAMS mass from the pureHE tables.

Returns
true or throw an error.
Exceptions
sevnstd::params_errorThrown if one of the checks fail.

◆ check_ns()

bool SEVNpar::check_ns ( )
inlineprivate

◆ check_option_mode()

bool SEVNpar::check_option_mode ( )
inlineprivate

◆ check_parameters()

bool SEVNpar::check_parameters ( )
inlineprivate

◆ check_rlobe()

bool SEVNpar::check_rlobe ( )
inlineprivate

Check the parameter(s) related to the Roche Lobe Overflow

Returns
true or throw an error.
Exceptions
sevnstd::params_errorThrown if one of the checks fail.

◆ check_sn()

bool SEVNpar::check_sn ( )
inlineprivate

◆ check_star()

bool SEVNpar::check_star ( )
inlineprivate

check the parameter(s) related to the star properties.

Returns
true or throw an error.
Exceptions
sevnstd::params_errorThrown if one of the checks fail.

◆ check_systems()

bool SEVNpar::check_systems ( )
inlineprivate

◆ check_timestep()

bool SEVNpar::check_timestep ( )
inlineprivate

check the parameter(s) related to the adaptive time step.

Returns
true or throw an error.
Exceptions
sevnstd::params_errorThrown if one of the checks fail.

◆ check_winds()

bool SEVNpar::check_winds ( )
inlineprivate

check the parameter(s) related to the winds process.

Returns
true or throw an error.
Exceptions
sevnstd::params_errorThrown if one of the checks fail.

◆ check_z()

bool SEVNpar::check_z ( )
inlineprivate

check the parameter(s) containing the limit of Z from the tables.

Returns
true or throw an error.
Exceptions
sevnstd::params_errorThrown if one of the checks fail.

◆ check_z_he()

bool SEVNpar::check_z_he ( )
inlineprivate

check the parameter(s) containing the limit of Z from the tables.

Returns
true or throw an error.
Exceptions
sevnstd::params_errorThrown if one of the checks fail.

◆ default_value_bool()

int SEVNpar::default_value_bool ( )
private

Method to define the boolean parameters and their default value. A parameter can be added as params_bool["name"] = std::make_pair(value,documentation);

Returns
EXIT_SUCCESS

IO options

Evolution

GWcheck parameters

RLO options

Extra tables options

Optimistic scenario

◆ default_value_num()

int SEVNpar::default_value_num ( )
private

Initialisation methods.

Double params.

Method to define the numeric parameters and their default value. A parameter can be added as params_num["name"] = std::make_pair(value,documentation);

Returns
EXIT_SUCCESS

STAR

Tracks check

< Max Zams Mass in the loaded tables

< Min Zams Mass in the loaded tables

< Max Z in the loaded tables

< Min Z in the loaded tables

< Max Zams Mass in the loaded tables

SN

Jump track parameters

< relative accumulated mass threshold to change tracks

< relative difference in total mass to consider the convergence reached

< The maximum new zams that will be tested is Mzams + jtrack_DM_factor_max*dM_accumul

< The minimum new zams that will be tested is Mzams + jtrack_DM_factor_min*dM_accumul

< Maximum, number of iteration to found the convergence

< Mass increment when trying to matche the core ans in case the binding energy

GWcheck parameters

< Time in units of Hubble time. If GWtime<GW_TSHOLD*tHubble, enable GW process

Winds parameters

Timestep

Roche Lobe

Kicks parameters

CE

Hardening

Evolution

◆ default_value_str()

int SEVNpar::default_value_str ( )
private

Method to define the literal parameters and their default value. A parameter can be added as params_str["name"] = std::make_pair(value,documentation);

Returns
EXIT_SUCCESS

INPUT OPTIONS

Roche Lobe

Overwrite Z

Evolution

System

Output

Input

Folders

LOG

◆ get() [1/3]

int SEVNpar::get ( std::string  name,
bool &  val 
)
inline

Store directly the value of a boolean parameters in an input variable. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ get() [2/3]

int SEVNpar::get ( std::string  name,
double &  val 
)
inline

Store directly the value of a numerical parameters in an input variable.

Parameters
namename of the parameter
valvariable where to store the parameter's value
Returns
EXIT_SUCCESS or thrown an error
Exceptions
sevnstd::params_errorThrown if the parameter name is not present.

◆ get() [3/3]

int SEVNpar::get ( std::string  name,
std::string &  val 
)
inline

Store directly the value of a literal parameters in an input variable. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ get_bool()

bool SEVNpar::get_bool ( std::string  name)
inline

get a boolean variable

Parameters
nameof the parameter
Returns
parameter value or throw an error
Exceptions
sevnstd::params_errorThrown if the parameter name is not present in the str group.

◆ get_bool_map()

const map_bool & SEVNpar::get_bool_map ( )
inline

◆ get_num()

double SEVNpar::get_num ( std::string  name)
inline

get a numerical variable

Parameters
namename of the parameter
Returns
the parameter value or throw an error
Exceptions
sevnstd::params_errorThrown if the parameter name is not present in the numerical group.

◆ get_num_map()

const map_num & SEVNpar::get_num_map ( )
inline

GET and GET like stuff.

◆ get_str()

std::string SEVNpar::get_str ( std::string  name)
inline

get a literal variable

Parameters
nameof the parameter
Returns
parameter value or throw an error
Exceptions
sevnstd::params_errorThrown if the parameter name is not present in the str group.

◆ get_str_map()

const map_str & SEVNpar::get_str_map ( )
inline

◆ init()

int SEVNpar::init ( )
inlineprivate

Initialise all the parameters to default values

Returns
EXIT_SUCCESS or throw an error
Exceptions
sevnstd::params_errorThrown if the one of the parameters checks fail.

◆ is_bool_par()

bool SEVNpar::is_bool_par ( std::string  name)
inlineprivate

Check if a giben parameter is a boolean parameter.

Parameters
namename of the parameter
Returns
true or false

◆ is_num_par()

bool SEVNpar::is_num_par ( std::string  name)
inlineprivate

Check if a given parameter is a numeric parameter.

Parameters
namename of the parameter
Returns
true or false

◆ is_par()

bool SEVNpar::is_par ( std::string  name)
inlineprivate

Check if a given parameter is a parameter of the class.

Parameters
namename of the parameter
Returns
true or false

◆ is_private_settable()

bool SEVNpar::is_private_settable ( std::string  name)
inlineprivate

Check if it is settable

Parameters
namename of the parameter
Returns
true or false

◆ is_public_settable()

bool SEVNpar::is_public_settable ( std::string  name)
inlineprivate

Check if it is directly settable

Parameters
namename of the parameter
Returns
true or false

◆ is_settable()

bool SEVNpar::is_settable ( std::string  name)
inlineprivate

Check if a given parameter is settable

Parameters
namename of the parameter
Returns
true or false

◆ is_str_par()

bool SEVNpar::is_str_par ( std::string  name)
inlineprivate

Check if a given parameter is a literal parameter.

Parameters
namename of the parameter
Returns
true or false

◆ keys()

std::vector< std::string > SEVNpar::keys ( )
inline

Store all the names of the parameters in a vector

Returns
vector of string containing of all the parameters names.

◆ load()

int SEVNpar::load ( int  n,
char **  val,
bool  initialise = false 
)

load

load parameters from a list of arguments

Parameters
nnumber of arguments
valarguments
initialiseif true initialise all the parameters to default before to set them
Returns
EXIT_SUCCESS or throw an error
Exceptions
sevnstd::params_errorThrown if one of the parameters is not settable.
Note
: the function checks only whether a parameter is not settable, it skips all the parameters that are not present in the class.

◆ n2s() [1/2]

std::string SEVNpar::n2s ( double  val)
inlineprivate

Transform a double to a string.

Parameters
valueto transform to a string
Returns
a string containing the value.

◆ n2s() [2/2]

std::string SEVNpar::n2s ( std::string  name)
inlineprivate

Transform the numeric parameter of a given name to a string.

Parameters
namename of the parameter
Returns
a string containing the value of the parameter.

◆ print()

std::string SEVNpar::print ( bool  use_default = false)
inline

Create a formatted string storing the name, values and comment of each parameter.

Parameters
use_defaultif true the string will contain the default values independently of the current values. (the current values are not overwritten).
Returns
A string containing the name, values and comment of each parameter.
Note
In the comment there are two automatic additions inside square brackets:
  • The first contains info about the parameter type [N] numeric, [L] literal;
  • the second contains info about the set property [S] directle settable, [PS] private settable, [NS] non settable at runtime.

◆ prv_set() [1/3]

int SEVNpar::prv_set ( std::string  name,
bool  val 
)
inlineprivate

Set the value of a given boolean parameter

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ prv_set() [2/3]

int SEVNpar::prv_set ( std::string  name,
double  val 
)
inlineprivate

SET.

Set the value of a given numeric parameter

Parameters
namename of the parameter.
valvalue to save in the parameter.
Returns
EXIT_SUCCESS of throw an error
Exceptions
sevnstd::params_errorThrown if:
  • the parameter is not present,

◆ prv_set() [3/3]

int SEVNpar::prv_set ( std::string  name,
std::string  val 
)
inlineprivate

Set the value of a given literal parameter

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ set() [1/2]

int SEVNpar::set ( std::string  name,
double  val 
)
inline

SET and SET like stuff.

Set the value of a given numeric parameter

Parameters
namename of the parameter.
valvalue to save in the parameter.
Returns
EXIT_SUCCESS of thrown an error
Exceptions
sevnstd::params_errorThrown if:
  • the parameter is not directly settable,
  • the parameter is not present,
  • the parameter's value fails the check(s).

◆ set() [2/2]

int SEVNpar::set ( std::string  name,
std::string  val 
)
inline

Set the value of a given literal parameter This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ set_from_string()

int SEVNpar::set_from_string ( std::string  name,
std::string  val 
)
inlineprivate

Basic method to set value from a string.

Parameters
namename of the parameter.
valvalue to save in the parameter.
Returns
EXIT_SUCCESS, EXIT_FAILURE or thrown an error. EXIT_FAILURE means that the paremeter is not in the list
Exceptions
sevnstd::params_errorThrown if:
  • the parameter is not settable,
Note
: if the parameter is not in the list, the function return EXIT_FAILURE but it does not throw an error.

◆ set_myself()

int SEVNpar::set_myself ( )
inline

Set the paramter myself containing the PATH of the SEVN folder.

Returns
Exist Success if the FILE contains the /include/ in the string, if /include/ is not found a critical error is raised @Notice this is based on the fact that the folder structure contains the folder include that contains (considering all the possibile subfolders) the file param.h

◆ set_tables()

int SEVNpar::set_tables ( std::string  tables)
inline

Set the tables path

Parameters
tablespath to the tables
Returns
EXIT_SUCCESS

◆ set_tablesHE()

int SEVNpar::set_tablesHE ( std::string  tablesHE)
inline

Set the pureHE tables path

Parameters
tablesHEpath to the pureHE tables
Returns
EXIT_SUCCESS

◆ set_zams_limit()

int SEVNpar::set_zams_limit ( const std::vector< std::vector< double > > &  Zams_list)
inline

Set the min and max ZAMS Mass. Notice: the max Zams is the minimum between the zams upper limits considering all the metallicites. The min zams is the maximum between the zams lower limits.

Parameters
Zams_listVector of vector of doubles containing the list of zams Mass at each metallicity (loaded in IO).
Returns
EXIT_SUCCESS or throw error.
Exceptions
sevnstd::params_errorThrown if:
  • check_mzams is false or return an error.

◆ set_zams_limit_he()

int SEVNpar::set_zams_limit_he ( const std::vector< std::vector< double > > &  Zams_list_HE)
inline

Set the min and max ZAMS pureHE Mass. Notice: the max Zams is the minimum between the zams upper limits considering all the metallicites. The min zams is the maximum between the zams lower limits.

Parameters
Zams_list_HEVector of vector of doubles containing the list of zams Mass at each metallicity (loaded in IO).
Returns
EXIT_SUCCESS or throw error.
Exceptions
sevnstd::params_errorThrown if:
  • check_mzams is false or return an error.

◆ set_zlimit()

int SEVNpar::set_zlimit ( const std::vector< double > &  Zlist)
inline

SPECIAL SET.

Set the min and max Z

Parameters
ZlistVector of doubles containing the list of loaded metallicites (loaded in IO).
Returns
EXIT_SUCCESS or throw error.
Exceptions
sevnstd::params_errorThrown if:
  • check_z is false or return an error.

◆ set_zlimit_HE()

int SEVNpar::set_zlimit_HE ( const std::vector< double > &  Zlist_HE)
inline

Set the min and max Z of the pureHE tables

Parameters
Zlist_HEVector of doubles containing the list of loaded metallicites (loaded in IO).
Returns
EXIT_SUCCESS or throw error.
Exceptions
sevnstd::params_errorThrown if:
  • check_z is false or return an error.

◆ ts_maximum_variation()

double SEVNpar::ts_maximum_variation ( )
inline

Parameter function.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
SEVNpar svpar 
)
friend

Overload of the << operator, it just calls the print method

@overloaded

Note
since it is a friend function it not a method of the class

Member Data Documentation

◆ instance_counter

std::size_t SEVNpar::instance_counter =0
staticprotected

Stores the number of active instance of this class

◆ params_bool

map_bool SEVNpar::params_bool
private

map containing the boolean parameters {name: {boolean value, comment}}

◆ params_num

map_num SEVNpar::params_num
private

map containing the numer parameters {name: {double value, comment}}

◆ params_str

map_str SEVNpar::params_str
private

map containing the literal parameters {name: {string value, comment}}

◆ private_settable

std::set< std::string > SEVNpar::private_settable
staticprivate

set containing the name of all the properties that can be set directly

◆ public_settable

std::set< std::string > SEVNpar::public_settable {}
staticprivate

set containing the name of all the properties that can be set directly

◆ svlog

SevnLogging SEVNpar::svlog
protected

logging instance


The documentation for this class was generated from the following files: