Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
CommandLineOptions Class Reference

All command line options can be accessed through members. More...

#include <poet.h>

+ Collaboration diagram for CommandLineOptions:

Public Member Functions

 CommandLineOptions (int argc, char **argv)
 Parse the command line. More...
 
double get_real_value (InCol::InputColumns quantity) const
 Returns the value of the quantity, if it is not overwritten by the input list. More...
 
std::istream & input ()
 The stream to read the parameters of the planet-star systems for which to calculate evolution. More...
 
std::string input_filename () const
 The name of the file to read in the various evolution scenarios. More...
 
std::string output_filename () const
 The name of the file to output the solution to. More...
 
const char * serialized_stellar_evolution () const
 The name of the file to read/write a serialized stellar evolution from/to. More...
 
const char * eccentricity_expansion () const
 The name of the file to read eccentricity expansion coefficients from. More...
 
bool start_locked () const
 Whether the planet should start locked to the star. More...
 
bool use_YREC () const
 Whether to used the YREC tracks instead of the MESA ones. More...
 
bool input_from_list () const
 Are any quantities to be read from a list file? More...
 
const std::vector< InCol::InputColumns > & input_file_format () const
 List of the columns expected in the input file. More...
 
const std::vector< OutCol::OutputColumns > & output_file_format () const
 The columns to output. More...
 
const std::list< double > & required_ages () const
 Ages at which the evolution should definitely step. More...
 
const std::string custom_stellar_evolution () const
 
const std::vector< CustomStellarEvolution::Columns > & custom_track_format () const
 A list of the columns in the custom stellar evolution track. More...
 
double custom_track_smoothing (CustomStellarEvolution::Columns column) const
 The smoothing to apply to the given column from the custom stellar evolution track. More...
 
int custom_track_nodes (CustomStellarEvolution::Columns column) const
 The nodes to use for the given column from the custom stellar evolution track. More...
 
bool need_orbit () const
 
 operator bool ()
 Did parsing the command line succeed. More...
 
 ~CommandLineOptions ()
 Closes the input filename if it was opened. More...
 

Private Member Functions

char * cstr_copy (const std::ostringstream &stream)
 Returns a copy of the c-string content of the stream. More...
 
char * cstr_copy (const std::string &str)
 Returns a copy of the c-string content of the stream. More...
 
void define_options ()
 Defines the command line options. More...
 
void set_defaults ()
 Sets default values to the appropriate options. More...
 
template<typename COL_ID_TYPE >
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. More...
 
void postprocess ()
 Updates some command line options after parsing and parses column lists. More...
 
void cleanup ()
 Free all manually allocated memory and close open streams. More...
 
void init_input_column_names ()
 Fills in the names of the input columns in __input_column_names. More...
 
void init_output_column_descriptions ()
 Fills is the descriptions of the output columns in __output_column_descr. More...
 
void init_track_column_descriptions_and_units ()
 Fills is the descriptions of the columns in a custom stellar evolution track in __track_column_descr. More...
 
void init_defaults ()
 Fills in default values for all possible real valued input quantities and the smoothing parameters for custom stellar evolution. More...
 
void setup ()
 Fills in all the static members. More...
 
void verify_custom_stellar_evolution ()
 

Private Attributes

std::vector< std::string > __input_column_names
 The names to use for the input columns in the –input-columns option. More...
 
std::vector< std::string > __output_column_descr
 Description of the output columns. More...
 
std::vector< std::string > __track_column_descr
 Description of the columns in the input stellar evolution track. More...
 
std::vector< std::string > __track_column_units
 Descriptions of the units expected of the stellar evolution track quantities. More...
 
std::vector< double > __defaults
 The default values for the quantities defining the evolution to calculate. More...
 
std::vector< double > __default_track_smoothing
 Default smoothing to apply to custom stellar evolution track quantities. More...
 
std::vector< int > __default_track_nodes
 Default numbef or spline nodes for custom stellar evolution track quantities. More...
 
std::vector< arg_dbl * > __direct_value_options
 The command line options which directly specify a value. More...
 
std::vector< arg_dbl * > __custom_track_smoothing
 The command line options which specify the smoothing for custom stellar evolution tracks. More...
 
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 smoothed. More...
 
arg_str * __input_file_columns
 The columns in the input file. More...
 
arg_str * __output_file_columns
 The columns to write to the output file. More...
 
arg_str * __required_ages_option
 The comma separated list of ages to include in the tabulated evolution. More...
 
arg_str * __custom_stellar_evolution_format
 
arg_lit * __start_locked
 
arg_lit * __use_YREC
 Wether we should use the YREC tracks instead of the MESA. More...
 
arg_file * __input_fname
 The name of the file to read the evolution scenarios from. More...
 
arg_file * __output_fname
 The name of the file to output the solution to. More...
 
arg_file * __serialized_stellar_evolution
 The name of the file to read pre-serialized stellar evolution from. More...
 
arg_file * __custom_stellar_evolution
 The filename of the custom stellar evolution track. More...
 
arg_file * __eccentricity_expansion
 The name of the file to read eccentricity expansion coefficients from. More...
 
void * __argtable [InCol::NUM_INPUT_QUANTITIES+2 *CustomStellarEvolution::AGE+10]
 
std::vector< InCol::InputColumns__input_file_format
 A list of the columns in the input file. More...
 
std::vector< OutCol::OutputColumns__output_file_format
 A list of the columns in the output file. More...
 
std::vector< CustomStellarEvolution::Columns > __track_format
 A list of the columns in the custom stellar evolution track. More...
 
std::ifstream __input_stream
 The stream to the input filename if stdin is not being used. More...
 
std::list< char * > __option_help_copies
 The copies of the option help strings made when creating the options. More...
 
std::list< double > __required_ages
 The sorted list of ages to make sure are included in the tabulated evolution. More...
 
bool __parsed_ok
 Did parsing the command line succeed. More...
 
bool __opened_stream
 Set to true only if and when the __input_stream is opened. More...
 
bool __need_orbit
 

Static Private Attributes

static const std::string __default_outfname
 The default output filename. More...
 
static const std::string __default_serialized_evol
 The default filename to read the serialized stellar evoliton from. More...
 
static const std::string __default_output_columns
 The default output columns. More...
 
static const std::string __default_track_columns
 The default columns in a custom stellar evolution track. More...
 
static const std::string __default_eccentricity_expansion
 

Detailed Description

All command line options can be accessed through members.

Definition at line 38 of file poet.h.

Constructor & Destructor Documentation

◆ CommandLineOptions()

CommandLineOptions::CommandLineOptions ( int  argc,
char **  argv 
)

Parse the command line.

◆ ~CommandLineOptions()

CommandLineOptions::~CommandLineOptions ( )
inline

Closes the input filename if it was opened.

Definition at line 326 of file poet.h.

Member Function Documentation

◆ cleanup()

void CommandLineOptions::cleanup ( )
private

Free all manually allocated memory and close open streams.

◆ cstr_copy() [1/2]

char* CommandLineOptions::cstr_copy ( const std::ostringstream &  stream)
inlineprivate

Returns a copy of the c-string content of the stream.

Definition at line 178 of file poet.h.

◆ cstr_copy() [2/2]

char* CommandLineOptions::cstr_copy ( const std::string &  str)
private

Returns a copy of the c-string content of the stream.

◆ custom_stellar_evolution()

const std::string CommandLineOptions::custom_stellar_evolution ( ) const
inline

The filename from which to read a custom stellar evolution track.

Empty string designates that a default evolution should be used.

Definition at line 301 of file poet.h.

◆ custom_track_format()

const std::vector<CustomStellarEvolution::Columns>& CommandLineOptions::custom_track_format ( ) const
inline

A list of the columns in the custom stellar evolution track.

Definition at line 306 of file poet.h.

◆ custom_track_nodes()

int CommandLineOptions::custom_track_nodes ( CustomStellarEvolution::Columns  column) const

The nodes to use for the given column from the custom stellar evolution track.

◆ custom_track_smoothing()

double CommandLineOptions::custom_track_smoothing ( CustomStellarEvolution::Columns  column) const

The smoothing to apply to the given column from the custom stellar evolution track.

◆ define_options()

void CommandLineOptions::define_options ( )
private

Defines the command line options.

◆ eccentricity_expansion()

const char* CommandLineOptions::eccentricity_expansion ( ) const
inline

The name of the file to read eccentricity expansion coefficients from.

Definition at line 272 of file poet.h.

◆ get_real_value()

double CommandLineOptions::get_real_value ( InCol::InputColumns  quantity) const

Returns the value of the quantity, if it is not overwritten by the input list.

◆ init_defaults()

void CommandLineOptions::init_defaults ( )
private

Fills in default values for all possible real valued input quantities and the smoothing parameters for custom stellar evolution.

◆ init_input_column_names()

void CommandLineOptions::init_input_column_names ( )
private

Fills in the names of the input columns in __input_column_names.

◆ init_output_column_descriptions()

void CommandLineOptions::init_output_column_descriptions ( )
private

Fills is the descriptions of the output columns in __output_column_descr.

◆ init_track_column_descriptions_and_units()

void CommandLineOptions::init_track_column_descriptions_and_units ( )
private

Fills is the descriptions of the columns in a custom stellar evolution track in __track_column_descr.

◆ input()

std::istream& CommandLineOptions::input ( )
inline

The stream to read the parameters of the planet-star systems for which to calculate evolution.

Definition at line 256 of file poet.h.

◆ input_file_format()

const std::vector<InCol::InputColumns>& CommandLineOptions::input_file_format ( ) const
inline

List of the columns expected in the input file.

Definition at line 287 of file poet.h.

◆ input_filename()

std::string CommandLineOptions::input_filename ( ) const
inline

The name of the file to read in the various evolution scenarios.

Definition at line 260 of file poet.h.

◆ input_from_list()

bool CommandLineOptions::input_from_list ( ) const
inline

Are any quantities to be read from a list file?

Definition at line 284 of file poet.h.

◆ need_orbit()

bool CommandLineOptions::need_orbit ( ) const
inline

Do we need to calculate the evolution in order to have all required output quantities.

Definition at line 320 of file poet.h.

◆ operator bool()

CommandLineOptions::operator bool ( )
inline

Did parsing the command line succeed.

Definition at line 323 of file poet.h.

◆ output_file_format()

const std::vector<OutCol::OutputColumns>& CommandLineOptions::output_file_format ( ) const
inline

The columns to output.

Definition at line 291 of file poet.h.

◆ output_filename()

std::string CommandLineOptions::output_filename ( ) const
inline

The name of the file to output the solution to.

Definition at line 263 of file poet.h.

◆ parse_column_list()

template<typename COL_ID_TYPE >
void CommandLineOptions::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 
)
private

Parses a comma separated list of column names.

Parameters
columns_strThe comma separated list of column names.
column_namesThe allowed column names
num_column_namesThe number of allowed column names
columnsThis is updated to contain the columns in the correct order.
allow_nonameWhether to allow zero length column names.

◆ postprocess()

void CommandLineOptions::postprocess ( )
private

Updates some command line options after parsing and parses column lists.

Opens the input file if it is being used.

Converts the precision required from number of significant figures to an actual value.

Calculates values of options which were specified using an alternative.

◆ required_ages()

const std::list<double>& CommandLineOptions::required_ages ( ) const
inline

Ages at which the evolution should definitely step.

Definition at line 295 of file poet.h.

◆ serialized_stellar_evolution()

const char* CommandLineOptions::serialized_stellar_evolution ( ) const
inline

The name of the file to read/write a serialized stellar evolution from/to.

Definition at line 267 of file poet.h.

◆ set_defaults()

void CommandLineOptions::set_defaults ( )
private

Sets default values to the appropriate options.

◆ setup()

void CommandLineOptions::setup ( )
private

Fills in all the static members.

◆ start_locked()

bool CommandLineOptions::start_locked ( ) const
inline

Whether the planet should start locked to the star.

If true, causes the value of __start_wsurf to be ignored.

Definition at line 278 of file poet.h.

◆ use_YREC()

bool CommandLineOptions::use_YREC ( ) const
inline

Whether to used the YREC tracks instead of the MESA ones.

Definition at line 281 of file poet.h.

◆ verify_custom_stellar_evolution()

void CommandLineOptions::verify_custom_stellar_evolution ( )
private

Applies common sense checks that all custom stellar evolution options.

Throws an exception if something is wrong.

Member Data Documentation

◆ __custom_stellar_evolution

arg_file * CommandLineOptions::__custom_stellar_evolution
private

The filename of the custom stellar evolution track.

Definition at line 126 of file poet.h.

◆ __custom_track_nodes

std::vector<arg_int*> CommandLineOptions::__custom_track_nodes
private

The command line options which specify the number of nodes to use if a custom track quantity is to be smoothed.

Definition at line 104 of file poet.h.

◆ __custom_track_smoothing

std::vector<arg_dbl*> CommandLineOptions::__custom_track_smoothing
private

The command line options which specify the smoothing for custom stellar evolution tracks.

Definition at line 100 of file poet.h.

◆ __default_outfname

const std::string CommandLineOptions::__default_outfname
staticprivate

The default output filename.

Definition at line 81 of file poet.h.

◆ __default_output_columns

const std::string CommandLineOptions::__default_output_columns
staticprivate

The default output columns.

Definition at line 81 of file poet.h.

◆ __default_serialized_evol

const std::string CommandLineOptions::__default_serialized_evol
staticprivate

The default filename to read the serialized stellar evoliton from.

Definition at line 81 of file poet.h.

◆ __default_track_columns

const std::string CommandLineOptions::__default_track_columns
staticprivate

The default columns in a custom stellar evolution track.

Definition at line 81 of file poet.h.

◆ __default_track_nodes

std::vector<int> CommandLineOptions::__default_track_nodes
private

Default numbef or spline nodes for custom stellar evolution track quantities.

For non-smoothed quantities (NaN entries in __default_track_smoothing) this value is ignored.

Definition at line 78 of file poet.h.

◆ __default_track_smoothing

std::vector<double> CommandLineOptions::__default_track_smoothing
private

Default smoothing to apply to custom stellar evolution track quantities.

Smoothing value of NaN signifies no smoothing.

Definition at line 71 of file poet.h.

◆ __defaults

std::vector<double> CommandLineOptions::__defaults
private

The default values for the quantities defining the evolution to calculate.

Definition at line 65 of file poet.h.

◆ __direct_value_options

std::vector<arg_dbl*> CommandLineOptions::__direct_value_options
private

The command line options which directly specify a value.

Definition at line 96 of file poet.h.

◆ __eccentricity_expansion

arg_file * CommandLineOptions::__eccentricity_expansion
private

The name of the file to read eccentricity expansion coefficients from.

Definition at line 126 of file poet.h.

◆ __input_column_names

std::vector<std::string> CommandLineOptions::__input_column_names
private

The names to use for the input columns in the –input-columns option.

Indexed by the corresponding InputColumns tag.

Definition at line 45 of file poet.h.

◆ __input_file_columns

arg_str* CommandLineOptions::__input_file_columns
private

The columns in the input file.

Definition at line 107 of file poet.h.

◆ __input_file_format

std::vector<InCol::InputColumns> CommandLineOptions::__input_file_format
private

A list of the columns in the input file.

Definition at line 149 of file poet.h.

◆ __input_fname

arg_file* CommandLineOptions::__input_fname
private

The name of the file to read the evolution scenarios from.

Definition at line 126 of file poet.h.

◆ __input_stream

std::ifstream CommandLineOptions::__input_stream
private

The stream to the input filename if stdin is not being used.

Definition at line 158 of file poet.h.

◆ __need_orbit

bool CommandLineOptions::__need_orbit
private

Do we need to calculate the evolution in order to have all required output quantities.

Definition at line 168 of file poet.h.

◆ __opened_stream

bool CommandLineOptions::__opened_stream
private

Set to true only if and when the __input_stream is opened.

Definition at line 168 of file poet.h.

◆ __option_help_copies

std::list<char*> CommandLineOptions::__option_help_copies
private

The copies of the option help strings made when creating the options.

Definition at line 161 of file poet.h.

◆ __output_column_descr

std::vector<std::string> CommandLineOptions::__output_column_descr
private

Description of the output columns.

Indexed by the corresponding OutputColumns tag.

Definition at line 45 of file poet.h.

◆ __output_file_columns

arg_str * CommandLineOptions::__output_file_columns
private

The columns to write to the output file.

Definition at line 107 of file poet.h.

◆ __output_file_format

std::vector<OutCol::OutputColumns> CommandLineOptions::__output_file_format
private

A list of the columns in the output file.

Definition at line 152 of file poet.h.

◆ __output_fname

arg_file * CommandLineOptions::__output_fname
private

The name of the file to output the solution to.

Definition at line 126 of file poet.h.

◆ __parsed_ok

bool CommandLineOptions::__parsed_ok
private

Did parsing the command line succeed.

Definition at line 168 of file poet.h.

◆ __required_ages

std::list<double> CommandLineOptions::__required_ages
private

The sorted list of ages to make sure are included in the tabulated evolution.

Definition at line 165 of file poet.h.

◆ __required_ages_option

arg_str * CommandLineOptions::__required_ages_option
private

The comma separated list of ages to include in the tabulated evolution.

Definition at line 107 of file poet.h.

◆ __serialized_stellar_evolution

arg_file * CommandLineOptions::__serialized_stellar_evolution
private

The name of the file to read pre-serialized stellar evolution from.

Definition at line 126 of file poet.h.

◆ __start_locked

arg_lit* CommandLineOptions::__start_locked
private

Whether the initial surfarce spin of the star should be synchronous to the orbit.

Definition at line 120 of file poet.h.

◆ __track_column_descr

std::vector<std::string> CommandLineOptions::__track_column_descr
private

Description of the columns in the input stellar evolution track.

Indexed by the corresponding CustomStellarEvolution::Columns tag.

Definition at line 45 of file poet.h.

◆ __track_column_units

std::vector<std::string> CommandLineOptions::__track_column_units
private

Descriptions of the units expected of the stellar evolution track quantities.

Definition at line 45 of file poet.h.

◆ __track_format

std::vector<CustomStellarEvolution::Columns> CommandLineOptions::__track_format
private

A list of the columns in the custom stellar evolution track.

Definition at line 155 of file poet.h.

◆ __use_YREC

arg_lit* CommandLineOptions::__use_YREC
private

Wether we should use the YREC tracks instead of the MESA.

Definition at line 123 of file poet.h.


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