Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends
ProblemDescDB Class Reference

The database containing information parsed from the DAKOTA input file. More...

Inheritance diagram for ProblemDescDB:
NIDRProblemDescDB

List of all members.

Public Member Functions

 ProblemDescDB ()
 default constructor
 ProblemDescDB (ParallelLibrary &parallel_lib)
 standard constructor
 ProblemDescDB (const ProblemDescDB &db)
 copy constructor
 ~ProblemDescDB ()
 destructor
ProblemDescDB operator= (const ProblemDescDB &db)
 assignment operator
void manage_inputs (CommandLineHandler &cmd_line_handler)
 invokes manage_inputs(const char*, ...) using the dakota input filename passed with the "-input" option on the DAKOTA command line. This is the normal API employed in main.C.
void manage_inputs (const char *dakota_input_file, const char *parser_options=NULL, void(*callback)(void *)=NULL, void *callback_data=NULL)
 invokes parse_inputs() to populate the problem description database and execute any callback function, broadcast() to propagate DB data to all processors, and post_process() to construct default variables/response vectors. This is an alternate API used by the file parsing mode in library_mode.C.
void parse_inputs (const char *dakota_input_file, const char *parser_options=NULL, void(*callback)(void *)=NULL, void *callback_data=NULL)
 parses the input file and populates the problem description database. This function reads from the dakota input filename passed in and allows subsequent modifications to be done by a callback function. This API is used by the mixed mode option in library_mode.C since it allows broadcast() and post_process() to be deferred until all inputs have been provided.
void check_input ()
 verifies that there is at least one of each of the required keywords in the dakota input file. Used by parse_inputs().
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().
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 (const 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 ()
 For a (default) strategy lacking a 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 (const 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 (const 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
ParallelLibraryparallel_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 RealVector & get_rdv (const String &entry_name) const
 get a RealVector out of the database based on an identifier string
const IntVector & get_idv (const String &entry_name) const
 get an IntVector out of the database based on an identifier string
const UShortArray & get_dusa (const String &entry_name) const
 get an UShortArray out of the database based on an identifier string
const RealSymMatrix & get_rsdm (const String &entry_name) const
 get a RealSymMatrix out of the database based on an identifier string
const RealVectorArray & get_rdva (const String &entry_name) const
 get a RealVectorArray out of the database based on an identifier string
const IntList & get_dil (const String &entry_name) const
 get an IntList out of the database based on an identifier string
const IntSet & get_dis (const String &entry_name) const
 get an IntSet out of the database based on an identifier string
const IntSetArray & get_disa (const String &entry_name) const
 get an IntSetArray out of the database based on an identifier string
const RealSetArray & get_drsa (const String &entry_name) const
 get a RealSetArray out of the database based on an identifier string
const StringArray & get_dsa (const String &entry_name) const
 get a StringArray out of the database based on an identifier string
const String2DArray & get_ds2a (const String &entry_name) const
 get a String2DArray out of the database based on an identifier string
const Stringget_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
void insert_node (const DataStrategy &data_strategy)
 set the DataStrategy 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 &rdv)
 set a RealVector within the database based on an identifier string
void set (const String &entry_name, const IntVector &idv)
 set an IntVector within the database based on an identifier string
void set (const String &entry_name, const RealSymMatrix &rsdm)
 set a RealMatrix within the database based on an identifier string
void set (const String &entry_name, const RealVectorArray &rdva)
 set a RealVectorArray within the database based on an identifier string
void set (const String &entry_name, const StringArray &dsa)
 set a StringArray within the database based on an identifier string
bool is_null () const
 function to check dbRep (does this envelope contain a letter)

Protected Member Functions

 ProblemDescDB (BaseConstructor, ParallelLibrary &parallel_lib)
 constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139)
virtual void derived_parse_inputs (const char *dakota_input_file, const char *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

DataStrategy strategySpec
 the strategy specification (only one allowed) resulting from a call to strategy_kwhandler() or insert_node()
std::list< DataMethoddataMethodList
 list of method specifications, one for each call to method_kwhandler() or insert_node()
std::list< DataModeldataModelList
 list of model specifications, one for each call to model_kwhandler() or insert_node()
std::list< DataVariablesdataVariablesList
 list of variables specifications, one for each call to variables_kwhandler() or insert_node()
std::list< DataInterfacedataInterfaceList
 list of interface specifications, one for each call to interface_kwhandler() or insert_node()
std::list< DataResponsesdataResponsesList
 list of responses specifications, one for each call to responses_kwhandler() or insert_node()
size_t strategyCntr
 counter for strategy specifications used in check_input

Private Member Functions

const Iteratorget_iterator (Model &model)
 retrieve an existing Iterator, if it exists, or instantiate a new one
const Modelget_model ()
 retrieve an existing Model, if it exists, or instantiate a new one
const Variablesget_variables ()
 retrieve an existing Variables, if it exists, or instantiate a new one
const Interfaceget_interface ()
 retrieve an existing Interface, if it exists, or instantiate a new one
const Responseget_response (const Variables &vars)
 retrieve an existing Response, if it exists, or instantiate a new one
ProblemDescDBget_db (ParallelLibrary &parallel_lib)
 Used by the envelope constructor to instantiate the correct letter class.
void send_db_buffer ()
 MPI send of a large buffer containing strategySpec 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 strategySpec and all objects in dataMethodList, dataModelList, dataVariablesList, dataInterfaceList, and dataResponsesList. Used by manage_inputs().

Private Attributes

ParallelLibraryparallelLib
 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
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
ProblemDescDBdbRep
 pointer to the letter (initialized only for the envelope)
int referenceCount
 number of objects sharing dbRep

Friends

class Model
 Model requires access to get_variables() and get_response()
class SingleModel
 SingleModel requires access to get_interface()
class HierarchSurrModel
 HierarchSurrModel requires access to get_model()
class DataFitSurrModel
 DataFitSurrModel requires access to get_iterator() and get_model()
class NestedModel
 NestedModel requires access to get_interface(), get_response(), get_iterator(), and get_model()
class Strategy
 Strategy requires access to get_iterator()
class SingleMethodStrategy
 SingleMethodStrategy requires access to get_model()
class HybridStrategy
 HybridStrategy requires access to get_model()
class SequentialHybridStrategy
 SequentialStrategy requires access to get_iterator()
class ConcurrentStrategy
 ConcurrentStrategy requires access to get_model()
class SurrBasedLocalMinimizer
 SurrBasedLocalMinimizer requires access to get_iterator()
class SurrBasedGlobalMinimizer
 SurrBasedGlobalMinimizer requires access to get_iterator()

Detailed Description

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 (DataStrategy, DataMethod, DataVariables, DataInterface, or DataResponses) and, for all cases except strategy, appends the object to a linked list (dataMethodList, dataVariablesList, dataInterfaceList, or dataResponsesList). No strategy linked list is used since only one strategy specification is allowed.


Constructor & Destructor Documentation

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(), ProblemDescDB::dbRep, and ProblemDescDB::get_db().

ProblemDescDB ( const ProblemDescDB db)

copy constructor

Copy constructor manages sharing of dbRep and incrementing of referenceCount.

References ProblemDescDB::dbRep, and ProblemDescDB::referenceCount.

destructor

Destructor decrements referenceCount and only deletes dbRep when referenceCount reaches zero.

References Dakota::Dak_pddb, ProblemDescDB::dbRep, and ProblemDescDB::referenceCount.

ProblemDescDB ( BaseConstructor  ,
ParallelLibrary parallel_lib 
) [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 (an uninitialized pointer causes problems in ~ProblemDescDB).


Member Function Documentation

ProblemDescDB operator= ( const ProblemDescDB db)

assignment operator

Assignment operator decrements referenceCount for old dbRep, assigns new dbRep, and increments referenceCount for new dbRep.

References ProblemDescDB::dbRep, and ProblemDescDB::referenceCount.

void manage_inputs ( CommandLineHandler cmd_line_handler)

invokes manage_inputs(const char*, ...) using the dakota input filename passed with the "-input" option on the DAKOTA command line. This is the normal API employed in main.C.

Manage command line inputs using the CommandLineHandler class and parse the input file.

References ProblemDescDB::dbRep, ProblemDescDB::manage_inputs(), ProblemDescDB::parallelLib, GetLongOpt::retrieve(), and ParallelLibrary::world_rank().

Referenced by main(), ProblemDescDB::manage_inputs(), run_dakota(), and run_dakota_parse().

void manage_inputs ( const char *  dakota_input_file,
const char *  parser_options = NULL,
void(*)(void *)  callback = NULL,
void *  callback_data = NULL 
)

invokes parse_inputs() to populate the problem description database and execute any callback function, broadcast() to propagate DB data to all processors, and post_process() to construct default variables/response vectors. This is an alternate API used by the file parsing mode in library_mode.C.

Parse the input file, broadcast it to all processors, and post-process the data on all processors.

References ProblemDescDB::broadcast(), ProblemDescDB::dbRep, ProblemDescDB::manage_inputs(), ProblemDescDB::parse_inputs(), and ProblemDescDB::post_process().

void parse_inputs ( const char *  dakota_input_file,
const char *  parser_options = NULL,
void(*)(void *)  callback = NULL,
void *  callback_data = NULL 
)

parses the input file and populates the problem description database. This function reads from the dakota input filename passed in and allows subsequent modifications to be done by a callback function. This API is used by the mixed mode option in library_mode.C since it allows broadcast() and post_process() to be deferred until all inputs have been provided.

Parse the input file, execute the callback function (if present), and perform basic checks on keyword counts.

References ProblemDescDB::check_input(), ProblemDescDB::dbRep, ProblemDescDB::derived_parse_inputs(), ProblemDescDB::parallelLib, ProblemDescDB::parse_inputs(), and ParallelLibrary::world_rank().

Referenced by ProblemDescDB::manage_inputs(), ProblemDescDB::parse_inputs(), and run_dakota_mixed().

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::manage_inputs(), Dakota::run_dakota_data(), and run_dakota_mixed().

ProblemDescDB * get_db ( ParallelLibrary parallel_lib) [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.

Referenced by ProblemDescDB::ProblemDescDB().


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