Dakota
Version 6.20
Explore and Predict with Confidence
|
file containing a mock simulator main for testing Dakota in library mode More...
Classes | |
struct | callback_data |
Functions | |
void | fpinit_ASL () |
void | run_dakota_parse (const char *dakota_input_file) |
Run a Dakota LibraryEnvironment, mode 1: parsing an input file. More... | |
void | run_dakota_data () |
Run a Dakota LibraryEnvironment, mode 2: from C++ API inserted data. More... | |
void | run_dakota_mixed (const char *dakota_input_file, bool mpirun_flag) |
Run a Dakota LibraryEnvironment, from string or input file input, supplemented with additional C++ API adjustments. More... | |
void | serial_interface_plugin (Dakota::LibraryEnvironment &env) |
Convenience function with simplest example of interface plugin: plugin a serial DirectApplicInterface that can be constructed independent of Dakota's configuration details. More... | |
void | parallel_interface_plugin (Dakota::LibraryEnvironment &env) |
Convenience function to plug a library client's interface into the appropriate model, demonstrating use of Dakota parallel configuration in constructing the plugin Interface on the right MPI_Comm. More... | |
static void | callback_function (Dakota::ProblemDescDB *db, void *ptr) |
Example: user-provided post-parse callback (Dakota::DbCallbackFunction) More... | |
int | main (int argc, char *argv[]) |
A mock simulator main for testing Dakota in library mode. More... | |
Variables | |
static const char | serial_input [] |
Default Dakota input string for serial case (rosenbrock): More... | |
static const char | parallel_input [] |
Default Dakota input string for parallel case (text_book) More... | |
file containing a mock simulator main for testing Dakota in library mode
void fpinit_ASL | ( | ) |
Floating-point initialization from AMPL: switch to 53-bit rounding if appropriate, to eliminate some cross-platform differences.
Referenced by main().
void run_dakota_parse | ( | const char * | dakota_input_file | ) |
Run a Dakota LibraryEnvironment, mode 1: parsing an input file.
Simplest library case: this function parses from an input file to define the ProblemDescDB data.
References Environment::execute(), ProgramOptions::input_file(), Environment::mpi_manager(), MPIManager::mpirun_flag(), parallel_interface_plugin(), serial_interface_plugin(), and MPIManager::world_rank().
Referenced by main().
void run_dakota_data | ( | ) |
Run a Dakota LibraryEnvironment, mode 2: from C++ API inserted data.
Rather than parsing from an input file, this function populates Data class objects directly using a minimal specification and relies on constructor defaults and post-processing in post_process() to fill in the rest.
References DataInterface::data_rep(), DataMethod::data_rep(), DataResponses::data_rep(), DataVariables::data_rep(), LibraryEnvironment::done_modifying_db(), Environment::execute(), Environment::exit_mode(), DataResponsesRep::gradientType, DataResponsesRep::hessianType, LibraryEnvironment::insert_nodes(), DataMethodRep::methodName, Environment::mpi_manager(), MPIManager::mpirun_flag(), ParallelLibrary::mpirun_flag(), DataVariablesRep::numContinuousDesVars, DataResponsesRep::numNonlinearIneqConstraints, DataResponsesRep::numObjectiveFunctions, parallel_interface_plugin(), Environment::parallel_library(), serial_interface_plugin(), and ParallelLibrary::world_rank().
Referenced by main().
void run_dakota_mixed | ( | const char * | dakota_input_file, |
bool | mpirun_flag | ||
) |
Run a Dakota LibraryEnvironment, from string or input file input, supplemented with additional C++ API adjustments.
Function to encapsulate the Dakota object instantiations for mode 3: mixed parsing and direct updating.
This function showcases multiple features. For parsing, either an input file (dakota_input_file != NULL) or a default input string (dakota_input_file == NULL) are shown. This parsed input is then mixed with input from three sources: (1) input from a user-supplied callback function, (2) updates to the DB prior to Environment instantiation, (3) updates directly to Iterators/Models following Environment instantiation.
References callback_function(), LibraryEnvironment::done_modifying_db(), ProgramOptions::echo_input(), Environment::execute(), LibraryEnvironment::filtered_model_list(), ProblemDescDB::get_sa(), ProgramOptions::input_file(), ProgramOptions::input_string(), Environment::mpi_manager(), MPIManager::mpirun_flag(), parallel_input, parallel_interface_plugin(), Environment::parallel_library(), Environment::problem_description_db(), ProblemDescDB::resolve_top_method(), callback_data::rosen_cdv_upper_bd, serial_input, serial_interface_plugin(), ProblemDescDB::set(), and ParallelLibrary::world_rank().
Referenced by main().
void serial_interface_plugin | ( | Dakota::LibraryEnvironment & | env | ) |
Convenience function with simplest example of interface plugin: plugin a serial DirectApplicInterface that can be constructed independent of Dakota's configuration details.
Demonstration of simple plugin where client code doesn't require access to detailed Dakota data (such as Model-based parallel configuration information) to construct the DirectApplicInterface. This example plugs-in a derived serial direct application interface instance ("plugin_rosenbrock").
References Dakota::abort_handler(), LibraryEnvironment::plugin_interface(), and Environment::problem_description_db().
Referenced by run_dakota_data(), run_dakota_mixed(), and run_dakota_parse().
void parallel_interface_plugin | ( | Dakota::LibraryEnvironment & | env | ) |
Convenience function to plug a library client's interface into the appropriate model, demonstrating use of Dakota parallel configuration in constructing the plugin Interface on the right MPI_Comm.
From a filtered list of Model candidates, plug-in a derived direct application interface instance ("plugin_text_book" for parallel). This approach provides more complete access to the Model, e.g., for access to analysis communicators.
References Dakota::abort_handler(), Interface::assign_rep(), LibraryEnvironment::filtered_model_list(), ProblemDescDB::get_db_model_node(), Environment::problem_description_db(), and ProblemDescDB::set_db_model_nodes().
Referenced by run_dakota_data(), run_dakota_mixed(), and run_dakota_parse().
|
static |
Example: user-provided post-parse callback (Dakota::DbCallbackFunction)
Example of user-provided callback function (an instance of Dakota::DbCallbackFunction) to override input provided by parsed Dakota input file or input string data.
References Dakota::contains(), ProblemDescDB::get_sa(), ProblemDescDB::get_ushort(), ProblemDescDB::resolve_top_method(), callback_data::rosen_cdv_upper_bd, and ProblemDescDB::set().
Referenced by run_dakota_mixed().
int main | ( | int | argc, |
char * | argv[] | ||
) |
A mock simulator main for testing Dakota in library mode.
Overall Usage: dakota_library_mode [-mixed] [dakota.in]
Uses alternative instantiation syntax as described in the library mode documentation within the Developers Manual. Tests several problem specification modes:
(1) run_dakota_parse: reads all problem specification data from a Dakota input file. Usage: dakota_library_mode dakota.in
(2) run_dakota_data: creates all problem specification from direct Data instance instantiations in the C++ code. Usage: dakota_library_mode
(3) run_dakota_mixed: a mixture of input parsing and direct data updates, where the data updates occur: (a) via the DB during Environment instantiation, and (b) via Iterators/Models following Environment instantiation. Usage: dakota_library_mode -mixed (input from default string) dakota_library_mode -mixed dakota.in (input from specified file)
Serial cases use a plugin rosenbrock model, while parallel cases use textbook.
References MPIManager::detect_parallel_launch(), fpinit_ASL(), Dakota::mpi_debug_hold(), run_dakota_data(), run_dakota_mixed(), and run_dakota_parse().
|
static |
Default Dakota input string for serial case (rosenbrock):
Referenced by run_dakota_mixed().
|
static |
Default Dakota input string for parallel case (text_book)
Referenced by run_dakota_mixed().