Dakota  Version
Explore and Predict with Confidence
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ProgramOptions Class Reference

ProgramOptions stores options whether from the CLH or from library user; initially valid only on worldRank = 0, but then broadcast in ParallelLibrary::push_output_tag() More...

Public Member Functions

 ProgramOptions ()
 default constructor (needed for default environment ctors and could be used by library clients to late update data)
 
 ProgramOptions (int world_rank)
 constructor that accepts world rank to help with I/O control; allows default constructed ProgramOptions to get rank in library mode
 
 ProgramOptions (int argc, char *argv[], int world_rank)
 standard constructor that uses a CommandLineHandler to parse user options
 
const String & input_file () const
 Dakota input file base name (no tag)
 
const String & input_string () const
 alternate Dakota input string literal; also set when input is read from stdin
 
bool echo_input () const
 is input echo specified?
 
bool preproc_input () const
 pre-process input file
 
const String & preproc_cmd () const
 pre-processing command, possibly specifying another tool
 
const String & preprocessed_file () const
 pre-processed input filename
 
const String & parser_options () const
 (deprecated) NIDR parser options
 
String output_file () const
 output (user-provided or default) file base name (no tag)
 
const String & error_file () const
 error file base name (no tag)
 
const String & exit_mode () const
 behavior of abort_handler (throw or exit)
 
const String & read_restart_file () const
 restart file base name (no tag)
 
size_t stop_restart_evals () const
 eval ID at which to stop reading restart
 
String write_restart_file () const
 write retart (user-provided or default) file base name (no tag)
 
bool help () const
 is help mode active?
 
bool version () const
 is version mode active?
 
bool check () const
 is check mode active?
 
bool pre_run () const
 is pre-run mode active?
 
bool run () const
 is run mode active?
 
bool post_run () const
 is post-run mode active?
 
bool user_modes () const
 are any non-default, user-specified run modes active?
 
const String & pre_run_input () const
 filename for pre-run input
 
const String & pre_run_output () const
 filename for pre-run output
 
const String & run_input () const
 filename for run input
 
const String & run_output () const
 filename for run output
 
const String & post_run_input () const
 filename for post-run input
 
const String & post_run_output () const
 filename for post-run output
 
unsigned int pre_run_output_format () const
 tabular format for pre-run output
 
unsigned int post_run_input_format () const
 tabular format for post-run input
 
bool proceed_to_instantiate () const
 whether steps beyond help/version are requested (instantiation required)
 
bool proceed_to_run () const
 Whether steps beyond check are requested.
 
bool user_stdout_redirect () const
 whether the user/client code requested a redirect of stdout
 
bool user_stderr_redirect () const
 whether the user/client code requested a redirect of stderr
 
void world_rank (int world_rank)
 set the world rank to govern early conditional output
 
void input_file (const String &in_file)
 set Dakota input file base name (no tag)
 
void input_string (const String &in_string)
 set alternate Dakota input string literal
 
void echo_input (bool echo_flag)
 set whether to echo input to output
 
void preproc_input (bool pp_flag)
 set whether to pre-process input file
 
void preprocessed_file (const String &prepro_file)
 set name of preprocessed input file
 
void preproc_cmd (const String &pp_cmd)
 set alternate pre-processing command
 
void exit_mode (const String &mode)
 set behavior for abort_handler
 
void output_file (const String &out_file)
 set base file name for Dakota output
 
void error_file (const String &err_file)
 set base file name for Dakota errors
 
void read_restart_file (const String &read_rst)
 set base file name for restart file from which to read
 
void stop_restart_evals (size_t stop_rst)
 set eval ID at which to stop reading restart
 
void write_restart_file (const String &write_rst)
 set base file name for restart file to write
 
void help (bool help_flag)
 set true to print help information and exit
 
void version (bool version_flag)
 set true to print version information and exit
 
void check (bool check_flag)
 set true to check input and instantiate objects, then exit
 
void pre_run (bool pre_run_flag)
 set to enable/disable pre-run phase
 
void run (bool run_flag)
 set to enable/disable run phase
 
void post_run (bool post_run_flag)
 set to enable/disable post-run phase
 
void pre_run_input (const String &pre_run_in)
 Specify the pre-run phase input filename.
 
void pre_run_output (const String &pre_run_out)
 Specify the pre-run phase output filename.
 
void run_input (const String &run_in)
 Specify the run phase input filename.
 
void run_output (const String &run_out)
 Specify the run phase output filename.
 
void post_run_input (const String &post_run_in)
 Specify the post-run phase input filename.
 
void post_run_output (const String &post_run_out)
 Specify the post-run phase output filename.
 
void parse (const ProblemDescDB &problem_db)
 Extract environment options from ProblemDescDB.
 
void read (MPIUnpackBuffer &s)
 helper function for reading some class data from MPI buffer
 
void write (MPIPackBuffer &s) const
 helper function for writing some class data to MPI buffer
 

Private Member Functions

void parse_environment_options ()
 any environment variables affecting global behavior get read here
 
void manage_run_modes (const CommandLineHandler &clh)
 retrieve run mode options from the CLH
 
void split_filenames (const char *filenames, std::string &input_filename, std::string &output_filename)
 manage pre/run/post filenames More...
 
void validate ()
 verify consistency of user settings (helpful for library mode especially)
 
void validate_run_modes ()
 validate user run modes and set userModesFlag
 
void set_option (const ProblemDescDB &problem_db, const String &db_name, String &data_member)
 retrieve environment.db_name from the problem db and update data_member, warning if needed
 

Private Attributes

int worldRank
 cache the world rank to help with conditional output
 
String inputFile
 Dakota input file name, e.g., "dakota.in".
 
String inputString
 alternate input means for library clients: input string (mutually exclusive with input file)
 
bool echoInput
 whether to echo client's input file at parse
 
bool preprocInput
 whether to pre-process input with pyprepro/etc.
 
String preprocCmd
 pre-processing command (default pyprepro.py)
 
String preprocFilename
 pre-processed input file
 
String parserOptions
 Deprecated option for NIDR parser options.
 
String exitMode
 Abort or throw on error.
 
String outputFile
 Dakota output base file name, e.g., "dakota.out".
 
String errorFile
 Dakota error base file name, e.g., "dakota.err".
 
String readRestartFile
 e.g., "dakota.old.rst"
 
size_t stopRestartEvals
 eval number at which to stop restart read
 
String writeRestartFile
 e.g., "dakota.new.rst"
 
bool helpFlag
 whether to print help message and exit
 
bool versionFlag
 whether to print version message and exit
 
bool checkFlag
 flags invocation with command line option -check
 
bool preRunFlag
 flags invocation with command line option -pre_run
 
bool runFlag
 flags invocation with command line option -run
 
bool postRunFlag
 flags invocation with command line option -post_run
 
bool userModesFlag
 whether any user run modes are active
 
String preRunInput
 filename for pre_run input
 
String preRunOutput
 filename for pre_run output
 
String runInput
 filename for run input
 
String runOutput
 filename for run output
 
String postRunInput
 filename for post_run input
 
String postRunOutput
 filename for post_run output
 
unsigned short preRunOutputFormat
 tabular format for pre_run output
 
unsigned short postRunInputFormat
 tabular format for post_run input
 

Detailed Description

ProgramOptions stores options whether from the CLH or from library user; initially valid only on worldRank = 0, but then broadcast in ParallelLibrary::push_output_tag()

Member Function Documentation

◆ split_filenames()

void split_filenames ( const char *  filenames,
std::string &  input_filename,
std::string &  output_filename 
)
private

manage pre/run/post filenames

Tokenize colon-delimited input and output filenames, returns unchanged strings if tokens not found.

Referenced by ProgramOptions::manage_run_modes().


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