Dakota  Version 6.21
Explore and Predict with Confidence
Public Member Functions | List of all members
LibraryEnvironment Class Reference

Environment corresponding to execution as an embedded library. More...

Inheritance diagram for LibraryEnvironment:
Environment

Public Member Functions

 LibraryEnvironment ()
 default constructor
 
 LibraryEnvironment (ProgramOptions prog_opts, bool check_bcast_construct=true, DbCallbackFunctionPtr callback=NULL, void *callback_data=NULL)
 Primary constructor: program options typically specifies an input file or input string. Optionally specify a callback function to be invoked after parsing. Set check_bcast_construct if performing late updates and later calling done_modifying_db(). More...
 
 LibraryEnvironment (MPI_Comm dakota_mpi_comm, ProgramOptions prog_opts=ProgramOptions(), bool check_bcast_construct=true, DbCallbackFunctionPtr callback=NULL, void *callback_data=NULL)
 Alternate constructor accepting communicator, same options as primary. More...
 
 ~LibraryEnvironment ()
 destructor
 
void insert_nodes (Dakota::DataMethod &dme, Dakota::DataModel &dmo, Dakota::DataVariables &dv, Dakota::DataInterface &di, Dakota::DataResponses &dr)
 Insert DB nodes for a {Method,Model,Variables,Interface,Responses} set.
 
void done_modifying_db ()
 Check database contents, broadcast, and construct iterators.
 
bool plugin_interface (const String &model_type, const String &interf_type, const String &an_driver, Interface *plugin_iface)
 DEPRECATED raw pointer version: transfers memory ownership to Dakota Plug-in the passed interface into any interface matching the specified (possibly empty) model, interface, and driver strings; returns true if a plugin was performed. More...
 
bool plugin_interface (const String &model_type, const String &interf_type, const String &an_driver, std::shared_ptr< Interface > plugin_iface)
 Plug-in the passed interface into any interface matching the specified (possibly empty) model, interface, and driver strings; returns true if a plugin was performed.
 
InterfaceList filtered_interface_list (const String &interf_type, const String &an_driver)
 filter the available Interface instances based on matching interface type and analysis drivers (empty String matches any) More...
 
ModelList filtered_model_list (const String &model_type, const String &interf_type, const String &an_driver)
 filter the available Model instances based on matching model type, interface type, and analysis drivers (empty String matches any) More...
 
- Public Member Functions inherited from Environment
 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.
 
MPIManagermpi_manager ()
 return mpiManager
 
ProgramOptionsprogram_options ()
 return programOptions
 
OutputManageroutput_manager ()
 return outputManager
 
ParallelLibraryparallel_library ()
 return parallelLib
 
ProblemDescDBproblem_description_db ()
 return probDescDB
 
const Variablesvariables_results () const
 return the final environment solution (variables)
 
const Responseresponse_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...
 

Additional Inherited Members

- Protected Member Functions inherited from Environment
 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 inherited from Environment
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)
 

Detailed Description

Environment corresponding to execution as an embedded library.

This environment corresponds to use of Dakota as a library within another application, e.g., within library_mode.cpp. It sets up the ParallelLibrary and ProblemDescDB objects without access to command line arguments.

Constructor & Destructor Documentation

◆ LibraryEnvironment() [1/2]

LibraryEnvironment ( ProgramOptions  prog_opts,
bool  check_bcast_construct = true,
DbCallbackFunctionPtr  callback = NULL,
void *  callback_data = NULL 
)

Primary constructor: program options typically specifies an input file or input string. Optionally specify a callback function to be invoked after parsing. Set check_bcast_construct if performing late updates and later calling done_modifying_db().

Construct library environment, optionally performing check/bcast of database and iterator construction

References Environment::construct(), OutputManager::output_startup_message(), Environment::outputManager, and Environment::parse().

◆ LibraryEnvironment() [2/2]

LibraryEnvironment ( MPI_Comm  dakota_mpi_comm,
ProgramOptions  prog_opts = ProgramOptions(),
bool  check_bcast_construct = true,
DbCallbackFunctionPtr  callback = NULL,
void *  callback_data = NULL 
)

Alternate constructor accepting communicator, same options as primary.

Construct library environment on passed MPI Comm, optionally performing check/bcast of database and iterator construction. MPI Comm is first argument so client doesn't have to pass all args

References Environment::construct(), OutputManager::output_startup_message(), Environment::outputManager, and Environment::parse().

Member Function Documentation

◆ plugin_interface()

bool plugin_interface ( const String &  model_type,
const String &  interf_type,
const String &  an_driver,
Interface plugin_iface 
)

DEPRECATED raw pointer version: transfers memory ownership to Dakota Plug-in the passed interface into any interface matching the specified (possibly empty) model, interface, and driver strings; returns true if a plugin was performed.

DEPRECATED raw pointer API; assumes memory ownership is transferred to Dakota as API historically did.

Referenced by serial_interface_plugin().

◆ filtered_interface_list()

InterfaceList filtered_interface_list ( const String &  interf_type,
const String &  an_driver 
)

filter the available Interface instances based on matching interface type and analysis drivers (empty String matches any)

This convenience function helps clients locate and plugin to the right Interface instance for simple cases. Pass an empty string to match any instead of a specific instance

References Interface::analysis_drivers(), Dakota::contains(), Interface::interface_type(), ProblemDescDB::model_list(), and Environment::probDescDB.

◆ filtered_model_list()

ModelList filtered_model_list ( const String &  model_type,
const String &  interf_type,
const String &  an_driver 
)

filter the available Model instances based on matching model type, interface type, and analysis drivers (empty String matches any)

This convenience function helps clients locate and plugin to the right Interface instance for cases where the parallel configuration is needed in constructing a parallel plugin. Pass an empty string to match any instead of a specific instance

References Interface::analysis_drivers(), Dakota::contains(), Interface::interface_type(), ProblemDescDB::model_list(), and Environment::probDescDB.

Referenced by parallel_interface_plugin(), LibraryEnvironment::plugin_interface(), run_dakota(), and run_dakota_mixed().


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