Dakota  Version 6.24
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 stdin_input () const
 is input from stdin?
 
bool echo_input () const
 is input echo specified?
 
const String & json_input_file () const
 Dakota JSON input file name.
 
const nlohmann::json & json_input () const
 Dakota JSON input object for library mode.
 
bool has_json_input () const
 true when an in-memory JSON input object is present
 
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
 
bool use_legacy_nidr_parser () const
 true when the legacy NIDR parser is selected
 
bool use_standard_parser () const
 true when the standard parser is selected
 
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?
 
String version_query () const
 is version mode active?
 
bool check () const
 is check mode active?
 
const String & dump_ir_file () const
 path for dumping the parsed IR / ProblemDescDB as JSON
 
const UserModesuser_modes () const
 UserModes object.
 
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 json_input_file (const String &in_file)
 set Dakota JSON input file name
 
void json_input (const nlohmann::json &in_json)
 set Dakota JSON input object
 
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 parser_options (const String &parser_opts)
 set parser selection for freeform input
 
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 dump_ir_file (const String &dump_ir_path)
 set the path for dumping the parsed IR / ProblemDescDB as JSON
 
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_parser_options ()
 validate parser selection / options
 
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 stdinInput
 true when user indicated input from stdin (inputFile == "-)
 
bool echoInput
 whether to echo client's input file at parse Dakota JSON input file name, e.g., "dakota.json"
 
String jsonFile
 
nlohmann::json jsonInput
 alternate input means for library clients: in-memory JSON object
 
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
 Parser selection/options from CLI or environment.
 
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"
 
String dumpIrFile
 path for JSON dump of parsed IR/problem DB
 
String versionQuery
 
bool helpFlag
 argument passed to "version" More...
 
bool versionFlag
 whether to print version message and exit
 
bool checkFlag
 flags invocation with command line option -check
 
UserModes userModes {}
 

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().

Member Data Documentation

◆ helpFlag

bool helpFlag
private

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