Derived application interface class which spawns simulation codes and testers using direct procedure calls. More...
Public Member Functions | |
DirectApplicInterface (const ProblemDescDB &problem_db) | |
constructor | |
~DirectApplicInterface () | |
destructor | |
void | derived_map (const Variables &vars, const ActiveSet &set, Response &response, int fn_eval_id) |
Called by map() and other functions to execute the simulation in synchronous mode. The portion of performing an evaluation that is specific to a derived class. | |
void | derived_map_asynch (const ParamResponsePair &pair) |
Called by map() and other functions to execute the simulation in asynchronous mode. The portion of performing an asynchronous evaluation that is specific to a derived class. | |
void | derived_synch (PRPQueue &prp_queue) |
For asynchronous function evaluations, this method is used to detect completion of jobs and process their results. It provides the processing code that is specific to derived classes. This version waits for at least one completion. | |
void | derived_synch_nowait (PRPQueue &prp_queue) |
For asynchronous function evaluations, this method is used to detect completion of jobs and process their results. It provides the processing code that is specific to derived classes. This version is nonblocking and will return without any completions if none are immediately available. | |
int | derived_synchronous_local_analysis (const int &analysis_id) |
const StringArray & | analysis_drivers () const |
retrieve the analysis drivers specification for application interfaces | |
Protected Member Functions | |
virtual int | derived_map_if (const Dakota::String &if_name) |
execute the input filter portion of a direct evaluation invocation | |
virtual int | derived_map_ac (const Dakota::String &ac_name) |
execute an analysis code portion of a direct evaluation invocation | |
virtual int | derived_map_of (const Dakota::String &of_name) |
execute the output filter portion of a direct evaluation invocation | |
void | set_local_data (const Variables &vars, const ActiveSet &set, const Response &response) |
convenience function for local test simulators which sets per-evaluation variable and response attributes | |
void | overlay_response (Response &response) |
convenience function for local test simulators which overlays response contributions from multiple analyses using MPI_Reduce | |
Protected Attributes | |
String | iFilterName |
name of the direct function input filter | |
String | oFilterName |
name of the direct function output filter | |
driver_t | iFilterType |
enum type of the direct function input filter | |
driver_t | oFilterType |
enum type of the direct function output filter | |
bool | gradFlag |
signals use of fnGrads in direct simulator functions | |
bool | hessFlag |
signals use of fnHessians in direct simulator functions | |
size_t | numFns |
number of functions in fnVals | |
size_t | numVars |
total number of continuous and discrete variables | |
size_t | numACV |
total number of continuous variables | |
size_t | numADIV |
total number of discete integer variables | |
size_t | numADRV |
total number of discete real variables | |
size_t | numDerivVars |
number of active derivative variables | |
unsigned short | localDataView |
bit-wise record of which local data views are active; see enum local_data_t | |
RealVector | xC |
continuous variables used within direct simulator fns | |
IntVector | xDI |
discrete int variables used within direct simulator fns | |
RealVector | xDR |
discrete real variables used within direct simulator fns | |
StringMultiArray | xCLabels |
continuous variable labels | |
StringMultiArray | xDILabels |
discrete integer variable labels | |
StringMultiArray | xDRLabels |
discrete real variable labels | |
std::map< String, var_t > | varTypeMap |
map from variable label to enum | |
std::map< String, driver_t > | driverTypeMap |
map from driver name to enum | |
std::map< var_t, Real > | xCM |
map from var_t enum to continuous value | |
std::map< var_t, int > | xDIM |
map from var_t enum to discrete int value | |
std::map< var_t, Real > | xDRM |
map from var_t enum to discrete real value | |
std::vector< var_t > | varTypeDVV |
var_t enumerations corresponding to DVV components | |
std::vector< var_t > | xCMLabels |
var_t enumerations corresponding to continuous variable labels | |
std::vector< var_t > | xDIMLabels |
var_t enumerations corresponding to discrete integer variable labels | |
std::vector< var_t > | xDRMLabels |
var_t enumerations corresponding to discrete real variable labels | |
ShortArray | directFnASV |
class scope active set vector | |
SizetArray | directFnDVV |
class scope derivative variables vector | |
RealVector | fnVals |
response fn values within direct simulator fns | |
RealMatrix | fnGrads |
response fn gradients w/i direct simulator fns | |
RealSymMatrixArray | fnHessians |
response fn Hessians within direct fns | |
StringArray | analysisDrivers |
the set of analyses within each function evaluation (from the analysis_drivers interface specification) | |
std::vector< driver_t > | analysisDriverTypes |
conversion of analysisDrivers to driver_t | |
size_t | analysisDriverIndex |
the index of the active analysis driver within analysisDrivers | |
String2DArray | analysisComponents |
the set of optional analysis components used by the analysis drivers (from the analysis_components interface specification) | |
engine * | matlabEngine |
pointer to the MATLAB engine used for direct evaluations | |
Private Member Functions | |
int | cantilever () |
scaled cantilever test function for optimization | |
int | mod_cantilever () |
unscaled cantilever test function for UQ | |
int | cyl_head () |
the cylinder head constrained optimization test fn | |
int | multimodal () |
multimodal UQ test function | |
int | rosenbrock () |
the Rosenbrock optimization and least squares test fn | |
int | generalized_rosenbrock () |
n-dimensional Rosenbrock (Schittkowski) | |
int | extended_rosenbrock () |
n-dimensional Rosenbrock (Nocedal/Wright) | |
int | log_ratio () |
the log_ratio UQ test function | |
int | short_column () |
the short_column UQ/OUU test function | |
int | steel_column_cost () |
the steel_column_cost UQ/OUU test function | |
int | steel_column_perf () |
the short_column_perf UQ/OUU test function | |
int | sobol_rational () |
Sobol SA rational test function. | |
int | sobol_g_function () |
Sobol SA discontinuous test function. | |
int | sobol_ishigami () |
Sobol SA transcendental test function. | |
int | text_book () |
the text_book constrained optimization test function | |
int | text_book1 () |
portion of text_book() evaluating the objective fn | |
int | text_book2 () |
portion of text_book() evaluating constraint 1 | |
int | text_book3 () |
portion of text_book() evaluating constraint 2 | |
int | text_book_ouu () |
the text_book_ouu OUU test function | |
int | salinas () |
direct interface to the SALINAS structural dynamics code | |
int | mc_api_run () |
direct interface to ModelCenter via API, HKIM 4/3/03 | |
int | matlab_engine_run () |
direct interface to Matlab via API, BMA 11/28/05 | |
int | matlab_field_prep (mxArray *dakota_matlab, const char *field_name) |
check that the dakota_matlab strucutre has the specified field_name and add if necessary; free structure memory in preparation for new alloc | |
int | python_run () |
direct interface to Python via API, BMA 07/02/07 | |
template<class ArrayT , class Size > | |
bool | python_convert_int (const ArrayT &src, Size size, PyObject **dst) |
convert arrays of integer types to Python list or numpy array | |
bool | python_convert (const RealVector &src, PyObject **dst) |
convert RealVector to Python list or numpy array | |
bool | python_convert (const RealVector &c_src, const IntVector &di_src, const RealVector &dr_src, PyObject **dst) |
convert RealVector + IntVector + RealVector to Python mixed list or numpy double array | |
bool | python_convert (const StringMultiArray &src, PyObject **dst) |
convert labels | |
bool | python_convert (const StringMultiArray &c_src, const StringMultiArray &di_src, const StringMultiArray &dr_src, PyObject **dst) |
convert all labels to single list | |
bool | python_convert (PyObject *pyv, RealVector &rv, const int &dim) |
convert python [list of int or float] or [numpy array of double] to RealVector (for fns) | |
bool | python_convert (PyObject *pyv, double *rv, const int &dim) |
convert python [list of int or float] or [numpy array of double] to double[], for use as helper in converting gradients | |
bool | python_convert (PyObject *pym, RealMatrix &rm) |
convert python [list of lists of int or float] or [numpy array of dbl] to RealMatrix (for gradients) | |
bool | python_convert (PyObject *pym, RealSymMatrix &rm) |
convert python [list of lists of int or float] or [numpy array of dbl] to RealMatrix (used as helper in Hessian conversion) | |
bool | python_convert (PyObject *pyma, RealSymMatrixArray &rma) |
convert python [list of lists of lists of int or float] or [numpy array of double] to RealSymMatrixArray (for Hessians) | |
Private Attributes | |
bool | userNumpyFlag |
whether the user requested numpy data structures |
Derived application interface class which spawns simulation codes and testers using direct procedure calls.
DirectApplicInterface uses a few linkable simulation codes and several internal member functions to perform parameter to response mappings.
int derived_synchronous_local_analysis | ( | const int & | analysis_id | ) | [inline, virtual] |
This code provides the derived function used by ApplicationInterface::serve_analyses_synch().
Reimplemented from ApplicationInterface.
References DirectApplicInterface::analysisDriverIndex, DirectApplicInterface::analysisDrivers, and DirectApplicInterface::derived_map_ac().
int derived_map_ac | ( | const Dakota::String & | ac_name | ) | [protected, virtual] |
execute an analysis code portion of a direct evaluation invocation
When a direct analysis/filter is a member function, the (vars,set,response) data does not need to be passed through the API. If, however, non-member analysis/filter functions are added, then pass (vars,set,response) through to the non-member fns:
// API declaration int sim(const Variables& vars, const ActiveSet& set, Response& response); // use of API within derived_map_ac() if (ac_name == "sim") fail_code = sim(directFnVars, directFnActSet, directFnResponse);
Reimplemented in ParallelDirectApplicInterface, and SerialDirectApplicInterface.
References Dakota::abort_handler(), ApplicationInterface::analysisServerId, DirectApplicInterface::cantilever(), DirectApplicInterface::cyl_head(), DirectApplicInterface::driverTypeMap, DirectApplicInterface::extended_rosenbrock(), DirectApplicInterface::generalized_rosenbrock(), DirectApplicInterface::log_ratio(), DirectApplicInterface::matlab_engine_run(), DirectApplicInterface::mc_api_run(), DirectApplicInterface::mod_cantilever(), DirectApplicInterface::multimodal(), DirectApplicInterface::python_run(), DirectApplicInterface::rosenbrock(), DirectApplicInterface::salinas(), DirectApplicInterface::short_column(), DirectApplicInterface::sobol_g_function(), DirectApplicInterface::sobol_ishigami(), DirectApplicInterface::sobol_rational(), DirectApplicInterface::steel_column_cost(), DirectApplicInterface::steel_column_perf(), DirectApplicInterface::text_book(), DirectApplicInterface::text_book1(), DirectApplicInterface::text_book2(), DirectApplicInterface::text_book3(), and DirectApplicInterface::text_book_ouu().
Referenced by DirectApplicInterface::derived_map(), and DirectApplicInterface::derived_synchronous_local_analysis().
bool python_convert_int | ( | const ArrayT & | src, |
Size | sz, | ||
PyObject ** | dst | ||
) | [private] |
convert arrays of integer types to Python list or numpy array
convert all integer array types including IntVector, ShortArray, and SizetArray to Python list of ints or numpy array of ints
References DirectApplicInterface::userNumpyFlag.
Referenced by DirectApplicInterface::python_run().