![]() |
SEVN
|
#include <IO.h>
Public Member Functions | |
| IO () | |
| IO (int argc, char **argv) | |
| ~IO () | |
| void | load_stars () |
| void | load (int n, char **val) |
| std::string | get_logstring () |
| void | reset_log () |
| template<typename T > | |
| void | fill_matrix_test (std::vector< std::vector< T > > &matrix, std::ifstream &file) |
| bool | rseed_provided () |
| Parameters call. More... | |
| void | print_output (std::vector< std::vector< double > > &printmatrix, const std::string &_name, const unsigned long &_rseed, const size_t &_ID, const bool binaryprint=false) |
| void | print_formatted_output (std::vector< std::vector< double > > &printmatrix, const std::string &_name, const unsigned long &_rseed, const size_t &_ID, const bool binaryprint=false) |
| void | print_evolved_summary (const std::string &_name, const unsigned long &_rseed, const size_t &_ID) |
| void | print_failed_summary (const std::string &_name, const unsigned long &_rseed, const size_t &_ID) |
| void | print_failed_initilisation_summary (const size_t &_ID) |
| void | print_params (std::string filename="used_params.svpar") |
| void | print_log (std::string filename="logfile.dat") |
| void | log_put (std::string &loginfo) |
| void | create_folder (const std::string &name) |
| std::string | get_output_folder_name () |
| std::string | get_SEVNpath () const |
| std::vector< std::vector< double > > | load_auxiliary_table (std::string name) const |
Public Attributes | |
| std::vector< std::vector< std::vector< std::vector< double > > > > | tables |
| std::vector< std::vector< std::vector< std::vector< double > > > > | tables_HE |
| std::vector< double > | Z |
| std::vector< double > | Z_HE |
| std::vector< std::vector< double > > | allzams |
| std::vector< std::vector< double > > | allzams_HE |
| std::vector< std::vector< std::string > > | STARS_MATRIX |
| std::random_device | rd |
| std::vector< std::string > | printcolumns_star |
| std::vector< std::string > | printcolumns_binary |
| std::vector< size_t > | printIDs_star |
| std::vector< size_t > | printIDs_binary |
| size_t | ntables |
| int | nthreads |
| std::string | output_mode |
| std::string | binput_mode |
| std::string | winds_mode |
| std::string | RL_mode |
| std::string | tides_mode |
| std::string | GW_mode |
| std::string | mix_mode |
| std::string | COLL_mode |
| std::string | HARD_mode |
| std::string | CIRC_mode |
| std::string | SNK_mode |
| std::string | CE_mode |
| std::string | SEVNpath |
| SEVNpar | svpar |
| int | tablesloaded |
Protected Member Functions | |
| void | set_init_variables () |
| bool | check_sorted () |
| void | set_STARMATRIX_labels () |
Private Member Functions | |
| void | columns_to_print (std::string &list_cols, std::vector< std::string > &printcolumns) |
| void | read (std::vector< std::vector< std::vector< std::vector< double > > > > &tables, const std::string &tables_dir, const std::vector< std::string > &zstring, std::vector< double > &Z) |
| void | read_tables () |
| void | inspect_tables () |
| void | load_tables () |
| template<typename T > | |
| void | fill_matrix (std::vector< std::vector< T > > &matrix, std::ifstream &file, bool reset=false) const |
| void | print_list_summary (std::ofstream &outstream, std::string basename, const std::string &_name, const unsigned long &_rseed, const size_t &_ID) |
| void | print_formatted_ascii (const std::string &filename, std::vector< std::vector< double > > &printmatrix, const std::string &_name, const unsigned long &_rseed, const size_t &_ID, const bool binaryprint, const std::string &separator, const size_t &_w_id, const size_t &_w_name, const size_t &_w_header, const size_t &_precision, const std::string &comment) |
| void | print_ascii (std::vector< std::vector< double > > &printmatrix, const std::string &_name, const unsigned long &_rseed, const size_t &_ID, const bool binaryprint) |
| void | print_csv (std::vector< std::vector< double > > &printmatrix, const std::string &_name, const unsigned long &_rseed, const size_t &_ID, const bool binaryprint) |
| void | print_bin (std::vector< std::vector< double > > &printmatrix, const std::string &_name, const unsigned long &_rseed, const size_t &_ID, const bool binaryprint) |
| void | inspect_dirs () |
| void | inspect_dir (const std::string &motherdir, std::vector< std::string > &_zstring, std::vector< double > &_Z, std::string inspectdir="") |
| void | inspect_object (dirent *object, const std::string &motherdir, std::vector< std::string > &_zstring, std::vector< double > &_Z) |
Private Attributes | |
| bool | load_called = false |
| std::string | output_folder_name ="output" |
| std::vector< std::vector< double > > | printmatrix |
| SevnLogging | svlog |
| std::string | tables_dir |
| std::string | tables_dir_HE |
| std::string | list_file |
| std::string | list_cols_star |
| std::string | list_cols_binary |
| std::ifstream | in |
| std::vector< std::string > | zstring |
| std::vector< std::string > | zstring_HE |
Static Private Attributes | |
| static std::ofstream | liststars |
| static std::ofstream | failedstars |
| static std::ofstream | failedinits |
| static std::ofstream | outputfile |
| static std::ofstream | logfile |
| static std::string | logstring |
| static std::vector< std::string > | labels_STARMATRIX |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
Check if the tables Z, ZHE, allzams, allzams_HE are sorted
|
private |
Transfer the name from a string containing the name separated by a : to a vector of string. It checks that each name in list cols is one of the name included in Property::PrintMap or in BinaryProperty::PrintMAP
| list_cols | A string containing the property names separated with a : |
| printcolumns | Vector of sting to fill with names from list_cols. |
|
inline |
|
inlineprivate |
Fill a matrix (2D vector) taking elements from a file
| T | matrix type |
| matrix | 2D vector |
| file | open file containg the data |
| reset | if true clear the matrix before to fill it otherwise just append |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
private |
| void IO::load | ( | int | n, |
| char ** | val | ||
| ) |
Load the simulation parameters and the tables
| n | number of elements in val |
| val | list of strings |
|
inline |
Utilities to load auxiliary data tables. The files needs to be all inside the folder SEVN/auxiliary_data
| name | name of the file |
| void IO::load_stars | ( | ) |
Load stars or binary from a list
Fill STARS_MATRIX (2D string matrix) reading the line of the file given in input (name of the file is stored in list_file)
|
private |
| void IO::log_put | ( | std::string & | loginfo | ) |
| loginfo |
|
private |
Print the output in ascii format with header
|
private |
Print the output in binary format with header
|
private |
Print the output in csv format with header
| void IO::print_evolved_summary | ( | const std::string & | _name, |
| const unsigned long & | _rseed, | ||
| const size_t & | _ID | ||
| ) |
Print the evolved summary in ascii format. The info are printed in the file opened as liststars in IO.h. The name of the file is equal to evolved_<NTHREAD>.dat and it will be saved in the ouput folder chosen in input.
| _name | name assigned to the star |
| _ID | ID assigen to the star |
Print the evolved summary in ascii format. The info are printed in the file opened as liststars in IO.h. The name of the file is equal to evolved.dat and it will be saved in the ouput folder chosen in input.
| _name | name assigned to the star |
| _ID | ID assigen to the star |
| void IO::print_failed_initilisation_summary | ( | const size_t & | _ID | ) |
| void IO::print_failed_summary | ( | const std::string & | _name, |
| const unsigned long & | _rseed, | ||
| const size_t & | _ID | ||
| ) |
Print the summary of the failed system in ascii format. The info are printed in the file opened as failedstars in IO.h. The name of the file is equal to failed_<NTHREAD>.dat and it will be saved in the ouput folder chosen in input.
| _name | |
| _ID |
|
private |
Formatted ascii print of values contained in the a 2D vector of doubles. In addition to the value in printmatrix two columns are added with the name and the ID of the star.
| filename | name of the file where to write the data |
| printmatrix | 2D vector of doubles to print |
| _name | name of the star (it will be the second column in addition to the data in printmatrix) |
| _ID | ID of the star (it will the first column in addition to the data in printmatrix) |
| binaryprint | if true the system calling print is a binary, so the printmatrix contains the info of the two stars and of their orbit |
| separator | field delimiter for the output file |
| _w_id | field width of the id column |
| _w_name | field width of the name column |
| _w_header | field with of all the other columns |
| _precision | decimal precision |
Print the output in hdf5 format with header
|
inline |
|
private |
Print the evolved summary in ascii format. The info are printed in the file opened as liststars in IO.h. The name of the file is equal to evolved.dat and it will be saved in the ouput folder chosen in input.
| _name | name assigned to the star |
| _ID | ID assigen to the star |
PRINT FORMAT PARAMETERS
PRINT HEADER
PRINT DATA
| void IO::print_log | ( | std::string | filename = "logfile.dat" | ) |
Flush the string logstring to the logfile output and clear logstring
| filename | Name of the file where to save the log |
| void IO::print_output | ( | std::vector< std::vector< double > > & | printmatrix, |
| const std::string & | _name, | ||
| const unsigned long & | _rseed, | ||
| const size_t & | _ID, | ||
| const bool | binaryprint = false |
||
| ) |
|
inline |
|
private |
|
inlineprivate |
|
inline |
|
inline |
Parameters call.
|
inlineprotected |
|
inlineprotected |
Set the labels referred to the columns of the STARMATRIX table depending on input type NOTICE: so far we assume that a list of input system contains all binaries or all stars not a mix
| std::vector<std::vector<double> > IO::allzams |
| std::vector<std::vector<double> > IO::allzams_HE |
| std::string IO::binput_mode |
Handle the formalism for the input for binaries
| std::string IO::CE_mode |
Formalism for Common envelope processes options
| std::string IO::CIRC_mode |
Formalism for hardening processes options
| std::string IO::COLL_mode |
Formalism for mixing processes options
|
staticprivate |
|
staticprivate |
| std::string IO::GW_mode |
Formalism for DA and DE in GW rad processes
| std::string IO::HARD_mode |
Formalism for hardening processes options
|
private |
|
staticprivate |
Vector that stores the label of the STARMATRIX column, it is set with set_STARMATRIX_labels, called by load_txt
|
private |
Default list of binary properties to print in output, defined in IO::load
|
private |
Default list of stellar properties to print in output, defined in IO::load
|
private |
|
staticprivate |
|
private |
Flag to check if load has been already called for this instance. The idea is that if we want to change parameters we have to instanciate another object
|
staticprivate |
|
staticprivate |
| std::string IO::mix_mode |
Formalism for mixing processes options
| size_t IO::ntables |
| int IO::nthreads |
|
private |
| std::string IO::output_mode |
Handle the file output type
|
staticprivate |
| std::vector<std::string> IO::printcolumns_binary |
| std::vector<std::string> IO::printcolumns_star |
List of string containing the name of the stellar properties to print in output. It is composed by a default lit of columns (IO::list_cols_star, defined in IO::load) plus some extra columns selected at runtime by the user with the -scol flag see IO::load
| std::vector<size_t> IO::printIDs_binary |
| std::vector<size_t> IO::printIDs_star |
|
private |
| std::random_device IO::rd |
| std::string IO::RL_mode |
Formalism for DA and DE in RL process
| std::string IO::SEVNpath |
| std::string IO::SNK_mode |
Formalism for SN kick processes options
| std::vector< std::vector<std::string> > IO::STARS_MATRIX |
|
private |
| SEVNpar IO::svpar |
| std::vector<std::vector<std::vector<std::vector<double> > > > IO::tables |
|
private |
|
private |
| std::vector<std::vector<std::vector<std::vector<double> > > > IO::tables_HE |
| int IO::tablesloaded |
| std::string IO::tides_mode |
Formalism for DA and DE in tidal processes
| std::string IO::winds_mode |
Formalism for DA and DE in Winds accretion processes
| std::vector<double> IO::Z |
| std::vector<double> IO::Z_HE |
|
private |
|
private |