14 #include "StellarEvoltion/MESAIO.h" 16 #include "BinarySystem/OrbitSolver.h" 17 #include "BinarySystem/EvolvingStar.h" 18 #include "BinarySystem/LockedPlanet.h" 19 #include "BinarySystem/DiskPlanetSystem.h" 20 #include "BinarySystem/ConstSolutionIterator.h" 22 #include <argtable2.h> 27 std::vector<std::string>
30 std::string data_directory()
32 std::string datadir=DATADIR;
33 if(datadir[datadir.size()-1]!=
'/') datadir+=
'/';
93 __default_eccentricity_expansion;
116 *__custom_stellar_evolution_format;
191 template<
typename COL_ID_TYPE>
194 const char *columns_str,
197 const std::vector<std::string> column_names,
200 int num_column_names,
204 std::vector<COL_ID_TYPE> &columns,
207 bool allow_noname=
false);
257 {
if(__input_fname->count)
return __input_stream;
else return std::cin;}
268 {
return __serialized_stellar_evolution->filename[0];}
273 {
return __eccentricity_expansion->filename[0];}
281 bool use_YREC()
const {
return __use_YREC->count>0;}
302 {
return __custom_stellar_evolution->filename[0];}
305 const std::vector<CustomStellarEvolution::Columns>&
335 const char *values_str,
338 std::list<double> &values);
347 const BinarySystem &system,
350 const std::string &filename,
375 const std::vector<double> &real_parameters,
388 const std::string &outfname,
391 const std::vector<OutCol::OutputColumns> &output_file_format,
401 std::vector<double> &real_parameters,
408 std::list<double> &required_ages,
411 const std::vector<InCol::InputColumns> &input_format,
414 std::istringstream &line,
417 size_t input_lineno);
std::vector< std::string > __track_column_descr
Description of the columns in the input stellar evolution track.
void output_solution(const OrbitSolver &solver, const BinarySystem &system, const std::string &filename, const std::vector< OutCol::OutputColumns > &output_file_format, double start_age, double end_age, double timestep, const std::list< double > &required_ages=std::list< double >())
Outputs the solution calculated by the given solver.
void parse_column_list(const char *columns_str, const std::vector< std::string > column_names, int num_column_names, std::vector< COL_ID_TYPE > &columns, bool allow_noname=false)
Parses a comma separated list of column names.
arg_file * __eccentricity_expansion
The name of the file to read eccentricity expansion coefficients from.
Defines various astronomical constants.
std::vector< double > __default_track_smoothing
Default smoothing to apply to custom stellar evolution track quantities.
void postprocess()
Updates some command line options after parsing and parses column lists.
const char * serialized_stellar_evolution() const
The name of the file to read/write a serialized stellar evolution from/to.
arg_str * __input_file_columns
The columns in the input file.
std::vector< double > __defaults
The default values for the quantities defining the evolution to calculate.
std::ifstream __input_stream
The stream to the input filename if stdin is not being used.
std::string update_run_parameters(std::vector< double > &real_parameters, bool &start_locked, std::list< double > &required_ages, const std::vector< InCol::InputColumns > &input_format, std::istringstream &line, size_t input_lineno)
Updates the evolution parameters as indicated on the next line of the input stream and returns filena...
void setup()
Fills in all the static members.
arg_str * __required_ages_option
The comma separated list of ages to include in the tabulated evolution.
const std::vector< CustomStellarEvolution::Columns > & custom_track_format() const
A list of the columns in the custom stellar evolution track.
void cleanup()
Free all manually allocated memory and close open streams.
std::vector< arg_dbl * > __direct_value_options
The command line options which directly specify a value.
double custom_track_smoothing(CustomStellarEvolution::Columns column) const
The smoothing to apply to the given column from the custom stellar evolution track.
Defines the class which implements a custom single track stellar evolution.
void run(const CommandLineOptions &options, const StellarEvolution &stellar_evolution)
Actually calculates the orbital evolutions.
std::vector< CustomStellarEvolution::Columns > __track_format
A list of the columns in the custom stellar evolution track.
arg_file * __custom_stellar_evolution
The filename of the custom stellar evolution track.
const std::list< double > & required_ages() const
Ages at which the evolution should definitely step.
arg_file * __input_fname
The name of the file to read the evolution scenarios from.
void set_defaults()
Sets default values to the appropriate options.
std::list< double > __required_ages
The sorted list of ages to make sure are included in the tabulated evolution.
const char * eccentricity_expansion() const
The name of the file to read eccentricity expansion coefficients from.
static const std::string __default_output_columns
The default output columns.
struct LIB_PUBLIC OrbitSolver
Opaque struct to cast to/from Evolve::OrbitSolver.
std::istream & input()
The stream to read the parameters of the planet-star systems for which to calculate evolution...
std::list< char * > __option_help_copies
The copies of the option help strings made when creating the options.
double get_real_value(InCol::InputColumns quantity) const
Returns the value of the quantity, if it is not overwritten by the input list.
The number of different input quantities supported.
std::vector< std::string > __input_column_names
The names to use for the input columns in the –input-columns option.
void verify_custom_stellar_evolution()
Declares enumerations that define the possible input/outut quantities.
std::vector< InCol::InputColumns > __input_file_format
A list of the columns in the input file.
bool input_from_list() const
Are any quantities to be read from a list file?
bool __parsed_ok
Did parsing the command line succeed.
std::string output_filename() const
The name of the file to output the solution to.
static const std::string __default_outfname
The default output filename.
InputColumns
Tags for the quantities required to fully specify the system to evolve.
bool start_locked() const
Whether the planet should start locked to the star.
arg_file * __serialized_stellar_evolution
The name of the file to read pre-serialized stellar evolution from.
int custom_track_nodes(CustomStellarEvolution::Columns column) const
The nodes to use for the given column from the custom stellar evolution track.
const std::vector< InCol::InputColumns > & input_file_format() const
List of the columns expected in the input file.
const std::string custom_stellar_evolution() const
static const std::string __default_track_columns
The default columns in a custom stellar evolution track.
arg_file * __output_fname
The name of the file to output the solution to.
AGE
The derivative w.r.t. age, excluding the dependence through the body's radius and the moments of iner...
arg_str * __output_file_columns
The columns to write to the output file.
std::vector< int > __default_track_nodes
Default numbef or spline nodes for custom stellar evolution track quantities.
void parse_real_list(const char *values_str, std::list< double > &values)
Parses a comma separated list of real values.
std::vector< arg_dbl * > __custom_track_smoothing
The command line options which specify the smoothing for custom stellar evolution tracks...
Declaration of some general purpose utilities.
void init_defaults()
Fills in default values for all possible real valued input quantities and the smoothing parameters fo...
The number of different input quantities supported.
void init_track_column_descriptions_and_units()
Fills is the descriptions of the columns in a custom stellar evolution track in __track_column_descr...
CommandLineOptions(int argc, char **argv)
Parse the command line.
std::string input_filename() const
The name of the file to read in the various evolution scenarios.
static const std::string __default_serialized_evol
The default filename to read the serialized stellar evoliton from.
arg_lit * __use_YREC
Wether we should use the YREC tracks instead of the MESA.
std::vector< std::string > __track_column_units
Descriptions of the units expected of the stellar evolution track quantities.
char * cstr_copy(const std::ostringstream &stream)
Returns a copy of the c-string content of the stream.
void init_output_column_descriptions()
Fills is the descriptions of the output columns in __output_column_descr.
void calculate_evolution(const std::vector< double > &real_parameters, bool start_locked, const std::list< double > &required_ages, const StellarEvolution &stellar_evolution, const std::string &outfname, const std::vector< OutCol::OutputColumns > &output_file_format, bool need_orbit)
Calculates the evolution for a set of parameters.
std::vector< std::string > __output_column_descr
Description of the output columns.
const std::vector< OutCol::OutputColumns > & output_file_format() const
The columns to output.
std::vector< OutCol::OutputColumns > __output_file_format
A list of the columns in the output file.
~CommandLineOptions()
Closes the input filename if it was opened.
void init_input_column_names()
Fills in the names of the input columns in __input_column_names.
void define_options()
Defines the command line options.
All command line options can be accessed through members.
bool use_YREC() const
Whether to used the YREC tracks instead of the MESA ones.
bool __opened_stream
Set to true only if and when the __input_stream is opened.
std::vector< arg_int * > __custom_track_nodes
The command line options which specify the number of nodes to use if a custom track quantity is to be...