Dakota
Version
Explore and Predict with Confidence
|
The database containing information parsed from the DAKOTA input file. More...
Public Member Functions | |
ProblemDescDB () | |
default constructor More... | |
ProblemDescDB (ParallelLibrary ¶llel_lib) | |
standard constructor More... | |
ProblemDescDB (const ProblemDescDB &db) | |
copy constructor More... | |
~ProblemDescDB () | |
destructor More... | |
ProblemDescDB | operator= (const ProblemDescDB &db) |
assignment operator More... | |
void | parse_inputs (ProgramOptions &prog_opts, DbCallbackFunctionPtr callback=NULL, void *callback_data=NULL) |
Parses the input file or input string if present and executes callbacks. Does not perform any validation. More... | |
void | check_and_broadcast (const ProgramOptions &prog_opts) |
performs check_input, broadcast, and post_process, but for now, allowing separate invocation through the public API as well More... | |
void | check_input () |
verifies that there is at least one of each of the required keywords in the dakota input file More... | |
void | broadcast () |
invokes send_db_buffer() and receive_db_buffer() to broadcast DB data across the processor allocation. Used by manage_inputs(). | |
void | post_process () |
post-processes the (minimal) input specification to assign default variables/responses specification arrays. Used by manage_inputs(). More... | |
void | lock () |
Locks the database in order to prevent data access when the list nodes may not be set properly. Unlocked by a set nodes operation. | |
void | unlock () |
Explicitly unlocks the database. Use with care. | |
void | set_db_list_nodes (const String &method_tag) |
set dataMethodIter based on a method identifier string to activate a particular method specification in dataMethodList and use pointers from this method specification to set all other list iterators. | |
void | set_db_list_nodes (size_t method_index) |
set dataMethodIter based on an index within dataMethodList to activate a particular method specification and use pointers from this method specification to set all other list iterators. | |
void | resolve_top_method (bool set_model_nodes=true) |
For a (default) environment lacking a top method pointer, this function is used to determine which of several potential method specifications corresponds to the top method and then sets the list nodes accordingly. | |
void | set_db_method_node (const String &method_tag) |
set dataMethodIter based on a method identifier string to activate a particular method specification (only). | |
void | set_db_method_node (size_t method_index) |
set dataMethodIter based on an index within dataMethodList to activate a particular method specification (only). | |
size_t | get_db_method_node () |
return the index of the active node in dataMethodList | |
void | set_db_model_nodes (const String &model_tag) |
set the model list iterators (dataModelIter, dataVariablesIter, dataInterfaceIter, and dataResponsesIter) based on the model identifier string | |
void | set_db_model_nodes (size_t model_index) |
set the model list iterators (dataModelIter, dataVariablesIter, dataInterfaceIter, and dataResponsesIter) based on an index within dataModelList | |
size_t | get_db_model_node () |
return the index of the active node in dataModelList | |
void | set_db_variables_node (const String &variables_tag) |
set dataVariablesIter based on the variables identifier string | |
void | set_db_interface_node (const String &interface_tag) |
set dataInterfaceIter based on the interface identifier string | |
void | set_db_responses_node (const String &responses_tag) |
set dataResponsesIter based on the responses identifier string | |
ParallelLibrary & | parallel_library () const |
return the parallelLib reference | |
IteratorList & | iterator_list () |
return a list of all Iterator objects that have been instantiated | |
ModelList & | model_list () |
return a list of all Model objects that have been instantiated | |
VariablesList & | variables_list () |
return a list of all Variables objects that have been instantiated | |
InterfaceList & | interface_list () |
return a list of all Interface objects that have been instantiated | |
ResponseList & | response_list () |
return a list of all Response objects that have been instantiated | |
const RealMatrixArray & | get_rma (const String &entry_name) const |
get a RealMatrixArray out of the database based on an identifier string | |
const RealVector & | get_rv (const String &entry_name) const |
get a RealVector out of the database based on an identifier string | |
const IntVector & | get_iv (const String &entry_name) const |
get an IntVector out of the database based on an identifier string | |
const BitArray & | get_ba (const String &entry_name) const |
get a BitArray out of the database based on an identifier string | |
const SizetArray & | get_sza (const String &entry_name) const |
get an SizetArray out of the database based on an identifier string | |
const UShortArray & | get_usa (const String &entry_name) const |
get an UShortArray out of the database based on an identifier string | |
const RealSymMatrix & | get_rsm (const String &entry_name) const |
get a RealSymMatrix out of the database based on an identifier string | |
const RealVectorArray & | get_rva (const String &entry_name) const |
get a RealVectorArray out of the database based on an identifier string | |
const IntVectorArray & | get_iva (const String &entry_name) const |
get an IntVectorArray out of the database based on an identifier string | |
const IntSet & | get_is (const String &entry_name) const |
get an IntSet out of the database based on an identifier string | |
const IntSetArray & | get_isa (const String &entry_name) const |
get an IntSetArray out of the database based on an identifier string | |
const SizetSet & | get_szs (const String &entry_name) const |
get a SizetSet out of the database based on an identifier string | |
const StringSetArray & | get_ssa (const String &entry_name) const |
get an StringSetArray out of the database based on an identifier string | |
const RealSetArray & | get_rsa (const String &entry_name) const |
get a RealSetArray out of the database based on an identifier string | |
const IntRealMapArray & | get_irma (const String &entry_name) const |
get an IntRealMapArray out of the database based on an identifier string | |
const StringRealMapArray & | get_srma (const String &entry_name) const |
get an StringRealMapArray out of the database based on an identifier string | |
const RealRealMapArray & | get_rrma (const String &entry_name) const |
get a RealRealMapArray out of the database based on an identifier string | |
const RealRealPairRealMapArray & | get_rrrma (const String &entry_name) const |
get a RealRealPairRealMapArray out of the database based on an identifier string | |
const IntIntPairRealMapArray & | get_iirma (const String &entry_name) const |
get an IntIntPairRealMapArray out of the database based on an identifier string | |
const StringArray & | get_sa (const String &entry_name) const |
get a StringArray out of the database based on an identifier string | |
const String2DArray & | get_s2a (const String &entry_name) const |
get a String2DArray out of the database based on an identifier string | |
const String & | get_string (const String &entry_name) const |
get a String out of the database based on an identifier string | |
const Real & | get_real (const String &entry_name) const |
get a Real out of the database based on an identifier string | |
int | get_int (const String &entry_name) const |
get an int out of the database based on an identifier string | |
short | get_short (const String &entry_name) const |
get a short out of the database based on an identifier string | |
unsigned short | get_ushort (const String &entry_name) const |
get an unsigned short out of the database based on an identifier string | |
size_t | get_sizet (const String &entry_name) const |
get a size_t out of the database based on an identifier string | |
bool | get_bool (const String &entry_name) const |
get a bool out of the database based on an identifier string | |
void ** | get_voidss (const String &entry_name) const |
for getting a void**, e.g., &dlLib More... | |
void | insert_node (const DataEnvironment &data_env) |
set the DataEnvironment object | |
void | insert_node (const DataMethod &data_method) |
add a DataMethod object to the dataMethodList | |
void | insert_node (const DataModel &data_model) |
add a DataModel object to the dataModelList | |
void | insert_node (DataVariables &data_variables) |
add a DataVariables object to the dataVariablesList | |
void | insert_node (const DataInterface &data_interface) |
add a DataInterface object to the dataInterfaceList | |
void | insert_node (const DataResponses &data_responses) |
add a DataResponses object to the dataResponsesList | |
void | set (const String &entry_name, const RealVector &rv) |
set a RealVector within the database based on an identifier string | |
void | set (const String &entry_name, const IntVector &iv) |
set an IntVector within the database based on an identifier string | |
void | set (const String &entry_name, const BitArray &ba) |
set a BitArray within the database based on an identifier string | |
void | set (const String &entry_name, const RealSymMatrix &rsm) |
set a RealMatrix within the database based on an identifier string | |
void | set (const String &entry_name, const RealVectorArray &rva) |
set a RealVectorArray within the database based on an identifier string | |
void | set (const String &entry_name, const IntVectorArray &iva) |
set an IntVectorArray within the database based on an identifier string | |
void | set (const String &entry_name, const IntSetArray &isa) |
set an IntSetArray within the database based on an identifier string | |
void | set (const String &entry_name, const RealSetArray &rsa) |
set a RealSetArray within the database based on an identifier string | |
void | set (const String &entry_name, const IntRealMapArray &irma) |
set an IntRealMapArray within the database based on an identifier string | |
void | set (const String &entry_name, const StringRealMapArray &srma) |
set a StringRealMapArray within the database based on an identifier string | |
void | set (const String &entry_name, const RealRealMapArray &rrma) |
set a RealRealMapArray within the database based on an identifier string | |
void | set (const String &entry_name, const RealRealPairRealMapArray &iirma) |
set a RealRealPairRealMapArray in the db based on an identifier string | |
void | set (const String &entry_name, const IntIntPairRealMapArray &iirma) |
set an IntIntPairRealMapArray in the db based on an identifier string | |
void | set (const String &entry_name, const StringArray &sa) |
set a StringArray within the database based on an identifier string | |
int | min_procs_per_ea () |
compute minimum evaluation partition size based on lower level overrides | |
int | max_procs_per_ea () |
compute maximum evaluation partition size based on lower level overrides and concurrency levels | |
int | min_procs_per_ie () |
compute minimum iterator partition size based on lower level overrides | |
int | max_procs_per_ie (int max_eval_concurrency) |
compute maximum iterator partition size based on lower level overrides and concurrency levels | |
bool | method_locked () const |
return methodDBLocked | |
bool | model_locked () const |
return modelDBLocked | |
bool | variables_locked () const |
return variablesDBLocked | |
bool | interface_locked () const |
return interfaceDBLocked | |
bool | responses_locked () const |
return responsesDBLocked | |
bool | is_null () const |
function to check dbRep (does this envelope contain a letter) | |
Static Public Member Functions | |
static int | min_procs_per_level (int min_procs_per_server, int pps_spec, int num_serv_spec) |
compute minimum partition size for a parallel level based on lower level overrides | |
static int | max_procs_per_level (int max_procs_per_server, int pps_spec, int num_serv_spec, short sched_spec, int asynch_local_conc, bool peer_dynamic_avail, int max_concurrency) |
compute maximum partition size for a parallel level based on lower level overrides | |
Protected Member Functions | |
ProblemDescDB (BaseConstructor, ParallelLibrary ¶llel_lib) | |
constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139) More... | |
virtual void | derived_parse_inputs (const std::string &dakota_input_file, const std::string &dakota_input_string, const std::string &parser_options) |
derived class specifics within parse_inputs() | |
virtual void | derived_broadcast () |
derived class specifics within broadcast() | |
virtual void | derived_post_process () |
derived class specifics within post_process() | |
Protected Attributes | |
DataEnvironment | environmentSpec |
the environment specification (only one allowed) resulting from a call to environment_kwhandler() or insert_node() | |
std::list< DataMethod > | dataMethodList |
list of method specifications, one for each call to method_kwhandler() or insert_node() | |
std::list< DataModel > | dataModelList |
list of model specifications, one for each call to model_kwhandler() or insert_node() | |
std::list< DataVariables > | dataVariablesList |
list of variables specifications, one for each call to variables_kwhandler() or insert_node() | |
std::list< DataInterface > | dataInterfaceList |
list of interface specifications, one for each call to interface_kwhandler() or insert_node() | |
std::list< DataResponses > | dataResponsesList |
list of responses specifications, one for each call to responses_kwhandler() or insert_node() | |
size_t | environmentCntr |
counter for environment specifications used in check_input | |
Private Member Functions | |
template<typename T > | |
T & | get (const std::string &context_msg, const std::map< std::string, T DataEnvironmentRep::* > &env_map, const std::map< std::string, T DataMethodRep::* > &met_map, const std::map< std::string, T DataModelRep::* > &mod_map, const std::map< std::string, T DataVariablesRep::* > &var_map, const std::map< std::string, T DataInterfaceRep::* > &int_map, const std::map< std::string, T DataResponsesRep::* > &res_map, const std::string &entry_name, const std::shared_ptr< ProblemDescDB > &db_rep) const |
Encapsulate lookups across Data*Rep types: given lookup tables mapping strings to pointers to Data*Rep members, and an entry_name = block.entry_key, return the corresponding member value from the appropriate Data*Rep in the ProblemDescDB rep. | |
const Iterator & | get_iterator () |
retrieve an existing Iterator, if it exists in iteratorList, or instantiate a new one | |
const Iterator & | get_iterator (Model &model) |
retrieve an existing Iterator, if it exists in iteratorList, or instantiate a new one | |
const Iterator & | get_iterator (const String &method_name, Model &model) |
retrieve an existing Iterator, if it exists in iteratorByNameList, or instantiate a new one | |
const Model & | get_model () |
retrieve an existing Model, if it exists, or instantiate a new one | |
const Variables & | get_variables () |
retrieve an existing Variables, if it exists, or instantiate a new one | |
const Interface & | get_interface () |
retrieve an existing Interface, if it exists, or instantiate a new one | |
const Response & | get_response (short type, const Variables &vars) |
retrieve an existing Response, if it exists, or instantiate a new one | |
std::shared_ptr< ProblemDescDB > | get_db (ParallelLibrary ¶llel_lib) |
Used by the envelope constructor to instantiate the correct letter class. More... | |
void | send_db_buffer () |
MPI send of a large buffer containing environmentSpec and all objects in dataMethodList, dataModelList, dataVariablesList, dataInterfaceList, and dataResponsesList. Used by manage_inputs(). | |
void | receive_db_buffer () |
MPI receive of a large buffer containing environmentSpec and all objects in dataMethodList, dataModelList, dataVariablesList, dataInterfaceList, and dataResponsesList. Used by manage_inputs(). | |
bool | model_has_interface (const DataModelRep &model_rep) const |
helper function for determining whether an interface specification should be active, based on model type | |
void | echo_input_file (const std::string &dakota_input_file, const std::string &dakota_input_string, const std::string &tmpl_qualifier="") |
echo the (potentially) specified input file or string to stdout | |
void | enforce_unique_ids () |
require user-specified block identifiers to be unique More... | |
Private Attributes | |
ParallelLibrary & | parallelLib |
reference to the parallel_lib object passed from main | |
std::list< DataMethod >::iterator | dataMethodIter |
iterator identifying the active list node in dataMethodList | |
std::list< DataModel >::iterator | dataModelIter |
iterator identifying the active list node in dataModelList | |
std::list< DataVariables >::iterator | dataVariablesIter |
iterator identifying the active list node in dataVariablesList | |
std::list< DataInterface >::iterator | dataInterfaceIter |
iterator identifying the active list node in dataInterfaceList | |
std::list< DataResponses >::iterator | dataResponsesIter |
iterator identifying the active list node in dataResponsesList | |
IteratorList | iteratorList |
list of iterator objects, one for each method specification | |
IteratorList | iteratorByNameList |
list of iterator objects, one for each lightweight instantiation by name | |
ModelList | modelList |
list of model objects, one for each model specification | |
VariablesList | variablesList |
list of variables objects, one for each variables specification | |
InterfaceList | interfaceList |
list of interface objects, one for each interface specification | |
ResponseList | responseList |
list of response objects, one for each responses specification | |
bool | methodDBLocked |
prevents use of get_<type> retrieval and set_<type> update functions prior to setting the list node for the active method specification | |
bool | modelDBLocked |
prevents use of get_<type> retrieval and set_<type> update functions prior to setting the list node for the active model specification | |
bool | variablesDBLocked |
prevents use of get_<type> retrieval and set_<type> update functions prior to setting the list node for the active variables specification | |
bool | interfaceDBLocked |
prevents use of get_<type> retrieval and set_<type> update functions prior to setting the list node for the active interface specification | |
bool | responsesDBLocked |
prevents use of get_<type> retrieval and set_<type> update functions prior to setting the list node for the active responses specification | |
std::shared_ptr< ProblemDescDB > | dbRep |
pointer to the letter (initialized only for the envelope) | |
The database containing information parsed from the DAKOTA input file.
The ProblemDescDB class is a database for DAKOTA input file data that is populated by a parser defined in a derived class. When the parser reads a complete keyword, it populates a data class object (DataEnvironment, DataMethod, DataVariables, DataInterface, or DataResponses) and, for all cases except environment, appends the object to a linked list (dataMethodList, dataVariablesList, dataInterfaceList, or dataResponsesList). No environment linked list is used since only one environment specification is allowed.
ProblemDescDB | ( | ) |
default constructor
The default constructor: dbRep is NULL in this case. This makes it necessary to check for NULL in the copy constructor, assignment operator, and destructor.
ProblemDescDB | ( | ParallelLibrary & | parallel_lib | ) |
standard constructor
This is the envelope constructor which uses problem_db to build a fully populated db object. It only needs to extract enough data to properly execute get_db(problem_db), since the constructor overloaded with BaseConstructor builds the actual base class data inherited by the derived classes.
References Dakota::abort_handler(), and ProblemDescDB::dbRep.
ProblemDescDB | ( | const ProblemDescDB & | db | ) |
copy constructor
Copy constructor manages sharing of dbRep
~ProblemDescDB | ( | ) |
|
protected |
constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139)
This constructor is the one which must build the base class data for all derived classes. get_db() instantiates a derived class letter and the derived constructor selects this base class constructor in its initialization list (to avoid the recursion of the base class constructor calling get_db() again). Since the letter IS the representation, its representation pointer is set to NULL.
ProblemDescDB operator= | ( | const ProblemDescDB & | db | ) |
void parse_inputs | ( | ProgramOptions & | prog_opts, |
DbCallbackFunctionPtr | callback = NULL , |
||
void * | callback_data = NULL |
||
) |
Parses the input file or input string if present and executes callbacks. Does not perform any validation.
DB setup phase 1: parse the input file and execute callback functions if present. Rank 0 only.
DB setup phase 2: optionally insert additional data via late sets. Rank 0 only.
References Dakota::abort_handler(), ProblemDescDB::dbRep, ProblemDescDB::derived_parse_inputs(), ProgramOptions::echo_input(), ProblemDescDB::echo_input_file(), ProgramOptions::input_file(), ProgramOptions::input_string(), ProblemDescDB::parallelLib, ProgramOptions::parser_options(), ProgramOptions::preproc_input(), ProgramOptions::preprocessed_file(), and ParallelLibrary::world_rank().
Referenced by Environment::parse().
void check_and_broadcast | ( | const ProgramOptions & | prog_opts | ) |
performs check_input, broadcast, and post_process, but for now, allowing separate invocation through the public API as well
DB setup phase 3: perform basic checks on keywords counts in current DB state, then sync to all processors.
References ProblemDescDB::broadcast(), ProblemDescDB::check_input(), ProblemDescDB::dbRep, ProblemDescDB::parallelLib, ProblemDescDB::post_process(), and ParallelLibrary::world_rank().
Referenced by LibraryEnvironment::done_modifying_db(), and Environment::parse().
void check_input | ( | ) |
verifies that there is at least one of each of the required keywords in the dakota input file
NOTE: when using library mode in a parallel application, check_input() should either be called only on worldRank 0, or it should follow a matched send_db_buffer()/receive_db_buffer() pair.
References Dakota::abort_handler(), ParallelLibrary::command_line_post_run_input(), ParallelLibrary::command_line_post_run_output(), ParallelLibrary::command_line_pre_run_input(), ParallelLibrary::command_line_pre_run_output(), ParallelLibrary::command_line_run_input(), ParallelLibrary::command_line_run_output(), ParallelLibrary::command_line_user_modes(), ProblemDescDB::dataInterfaceList, ProblemDescDB::dataMethodList, ProblemDescDB::dataModelList, ProblemDescDB::dataResponsesList, ProblemDescDB::dataVariablesList, ProblemDescDB::dbRep, ProblemDescDB::environmentCntr, ProblemDescDB::parallelLib, and Dakota::strbegins().
Referenced by ProblemDescDB::check_and_broadcast().
void post_process | ( | ) |
post-processes the (minimal) input specification to assign default variables/responses specification arrays. Used by manage_inputs().
When using library mode in a parallel application, post_process() should be called on all processors following broadcast() of a minimal problem specification.
References ProblemDescDB::dbRep, and ProblemDescDB::derived_post_process().
Referenced by ProblemDescDB::check_and_broadcast().
void ** get_voidss | ( | const String & | entry_name | ) | const |
for getting a void**, e.g., &dlLib
This special case involving pointers doesn't use generic lookups
References ProblemDescDB::dbRep.
|
private |
Used by the envelope constructor to instantiate the correct letter class.
Initializes dbRep to the appropriate derived type. The standard derived class constructors are invoked.
References Dakota::Dak_pddb.
|
private |
require user-specified block identifiers to be unique
Require string idenfitiers id_* to be unique across all blocks of each type (method, model, variables, interface, responses
For now, this allows duplicate empty ID strings. Would be better to require unique IDs when more than one block of a given type appears in the input file (instead of use-the-last-parsed)
References Dakota::abort_handler(), ProblemDescDB::dataInterfaceList, ProblemDescDB::dataMethodList, ProblemDescDB::dataModelList, ProblemDescDB::dataResponsesList, and ProblemDescDB::dataVariablesList.
Referenced by ProblemDescDB::broadcast().