Dakota
Version 6.20
Explore and Predict with Confidence
|
Base class for the environment class hierarchy. More...
Public Member Functions | |
Environment () | |
default constructor: empty envelope More... | |
Environment (int argc, char *argv[]) | |
envelope constructor for ExecutableEnvironment letter More... | |
Environment (ProgramOptions prog_opts) | |
Environment (MPI_Comm dakota_mpi_comm, ProgramOptions prog_opts=ProgramOptions()) | |
Environment (const String &env_type) | |
envelope constructor for letter type identifed by String More... | |
Environment (const Environment &env) | |
copy constructor More... | |
virtual | ~Environment () |
destructor | |
Environment | operator= (const Environment &env) |
assignment operator | |
virtual void | execute () |
the run function for the environment: invoke the iterator(s) on the model(s). Called from main.cpp. | |
bool | check () const |
Print status of check and return true if in a "check" mode, including version and help. Return false if proceeding to a run mode. | |
MPIManager & | mpi_manager () |
return mpiManager | |
ProgramOptions & | program_options () |
return programOptions | |
OutputManager & | output_manager () |
return outputManager | |
ParallelLibrary & | parallel_library () |
return parallelLib | |
ProblemDescDB & | problem_description_db () |
return probDescDB | |
const Variables & | variables_results () const |
return the final environment solution (variables) | |
const Response & | response_results () const |
return the final environment solution (response) | |
void | exit_mode (const String &mode="exit") |
allow environment clients to set Dakota exit behavior (throw vs. exit) More... | |
Protected Member Functions | |
Environment (BaseConstructor) | |
constructor initializes the base class part of default-constructed letters More... | |
Environment (BaseConstructor, int argc, char *argv[]) | |
constructor initializes the base class part of executable letter classes More... | |
Environment (BaseConstructor, ProgramOptions prog_opts, MPI_Comm dakota_mpi_comm=MPI_COMM_WORLD) | |
constructor initializes the base class part of library letter classes More... | |
void | preprocess_inputs () |
void | parse (bool check_bcast_database=true, DbCallbackFunctionPtr callback=NULL, void *callback_data=NULL) |
parse inputs, callbacks, and optionally check and broadcast More... | |
void | construct () |
Instantiate topLevelIterator. | |
void | destruct () |
Deallocate parallel partitioning for topLevelIterator. | |
bool | assign_model_pointer () const |
Protected Attributes | |
MPIManager | mpiManager |
the MPI manager instance | |
ProgramOptions | programOptions |
the command line options manager | |
OutputManager | outputManager |
(tagged) output stream manager | |
ParallelLibrary | parallelLib |
the parallel library instance | |
ProblemDescDB | probDescDB |
the parser database instance | |
Iterator | topLevelIterator |
the top level (meta-)iterator | |
UsageTracker | usageTracker |
tool for Dakota usage tracking (this is a thin wrapper class) | |
Private Member Functions | |
std::shared_ptr< Environment > | get_environment (const String &env_type) |
Used by the envelope to instantiate the correct letter class. More... | |
Private Attributes | |
std::shared_ptr< Environment > | environmentRep |
pointer to the letter (initialized only for the envelope) | |
Base class for the environment class hierarchy.
The Environment class is the base class for the class hierarchy providing the top level control in DAKOTA. The environment is responsible for creating and managing iterators and models. For memory efficiency and enhanced polymorphism, the environment hierarchy employs the "letter/envelope idiom" (see Coplien "Advanced C++", p. 133), for which the base class (Environment) serves as the envelope and one of the derived classes (selected in Environment::get_environment()) serves as the letter.
Environment | ( | ) |
default constructor: empty envelope
Default envelope constructor. environmentRep is NULL in this case.
Environment | ( | int | argc, |
char * | argv[] | ||
) |
envelope constructor for ExecutableEnvironment letter
Envelope constructor for ExecutableEnvironment. Selection of derived type by get_environment() is not necessary in this case.
References Dakota::abort_handler(), and Environment::environmentRep.
Environment | ( | ProgramOptions | prog_opts | ) |
Envelope constructor for LibraryEnvironment. Selection of derived type by get_environment() is not necessary in this case.
References Dakota::abort_handler(), and Environment::environmentRep.
Environment | ( | MPI_Comm | dakota_mpi_comm, |
ProgramOptions | prog_opts = ProgramOptions() |
||
) |
Envelope constructor for LibraryEnvironment. Selection of derived type by get_environment() is not necessary in this case.
References Dakota::abort_handler(), and Environment::environmentRep.
Environment | ( | const String & | env_type | ) |
envelope constructor for letter type identifed by String
Alternate construction by String. Envelope constructor invokes get_environment() which instantiates a derived class letter; the derived constructor selects a BaseConstructor constructor in its initialization list to avoid the recursion of a base class constructor calling get_environment() again.
References Dakota::abort_handler(), and Environment::environmentRep.
Environment | ( | const Environment & | env | ) |
copy constructor
Copy constructor manages sharing of environmentRep.
|
protected |
constructor initializes the base class part of default-constructed letters
This letter constructor initializes base class data for inherited environments that are default constructed. Since the letter IS the representation, its representation pointer is set to NULL.
Use cases: library with no options, no MPI comm
References ProgramOptions::exit_mode(), Environment::exit_mode(), WorkdirHelper::initialize(), and Environment::programOptions.
|
protected |
constructor initializes the base class part of executable letter classes
This letter constructor initializes base class data for inherited environments: instantiate/initialize the environment, options, parallel library, and problem description database objects. Since the letter IS the representation, its representation pointer is set to NULL.
Use cases: executable with command-line args
References ProgramOptions::exit_mode(), Environment::exit_mode(), WorkdirHelper::initialize(), and Environment::programOptions.
|
protected |
constructor initializes the base class part of library letter classes
This letter constructor initializes base class data for inherited environments. Since the letter IS the representation, its representation pointer is set to NULL.
Use cases: library with program options library with program options and MPI comm
References ProgramOptions::exit_mode(), Environment::exit_mode(), WorkdirHelper::initialize(), and Environment::programOptions.
void exit_mode | ( | const String & | mode = "exit" | ) |
allow environment clients to set Dakota exit behavior (throw vs. exit)
Set the global variable controlling Dakota's exit behavior. Call with no arguments to reset to default behavior.
References Dakota::abort_handler(), and Dakota::abort_mode.
Referenced by Environment::Environment(), and run_dakota_data().
|
protected |
parse inputs, callbacks, and optionally check and broadcast
Parse input file and invoked any callbacks, then optionally check and sync database if check_bcast_database = true
References ProblemDescDB::check_and_broadcast(), ProgramOptions::input_file(), ProgramOptions::input_string(), ProblemDescDB::parse_inputs(), Environment::probDescDB, and Environment::programOptions.
Referenced by ExecutableEnvironment::ExecutableEnvironment(), and LibraryEnvironment::LibraryEnvironment().
|
private |
Used by the envelope to instantiate the correct letter class.
Used only by the envelope constructor to initialize environmentRep to the appropriate derived type, as given by the environmentName attribute.