36 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
40 #if !defined(_WRAPPERS_) && defined(_HAVE_DAKOTA_) && (_DAKOTA_MAJOR_ <= 5) //this only works for Dakota <=5, which had no effective parallel capabilities yet.
43 #if (_DAKOTA_MAJOR_ < 5 || (_DAKOTA_MAJOR_ == 5 && _DAKOTA_MINOR_ < 3))
44 #include <DirectApplicInterface.H>
45 #include <DakotaResponse.H>
46 #include <ParamResponsePair.H>
47 #include <system_defs.h>
48 #include <ProblemDescDB.H>
49 #include <ParallelLibrary.H>
51 #include <DirectApplicInterface.hpp>
52 #include <DakotaResponse.hpp>
53 #include <ParamResponsePair.hpp>
54 #include <ProblemDescDB.hpp>
55 #include <ParallelLibrary.hpp>
59 int DakotaSpawnCore(
double* d_responses,
int d_numresponses,
double* d_variables,
char** d_variables_descriptors,
int d_numvariables,
void* void_femmodel,
int counter);
63 class IssmDirectApplicInterface:
public Dakota::DirectApplicInterface{
69 IssmDirectApplicInterface(
const Dakota::ProblemDescDB& problem_db,
void* in_femmodel):Dakota::DirectApplicInterface(problem_db){
73 ~IssmDirectApplicInterface(){
80 int derived_map_ac(
const Dakota::String& driver){
84 char** variable_descriptors=NULL;
85 char* variable_descriptor=NULL;
95 variables=xNew<IssmDouble>(numACV);
96 for(i=0;i<numACV;i++){
100 variable_descriptors=xNew<char*>(numACV);
101 for(i=0;i<numACV;i++){
102 std::string label=xCLabels[i];
103 variable_descriptor=xNew<char>(strlen(label.c_str())+1);
104 memcpy(variable_descriptor,label.c_str(),(strlen(label.c_str())+1)*
sizeof(
char));
106 variable_descriptors[i]=variable_descriptor;
110 responses=xNewZeroInit<IssmDouble>(numFns);
113 DakotaSpawnCore(responses,numFns, variables,variable_descriptors,numACV,
femmodel,counter);
116 for(i=0;i<numFns;i++){
117 fnVals[i]=responses[i];
121 xDelete<IssmDouble>(variables);
122 for(i=0;i<numACV;i++){
123 variable_descriptor=variable_descriptors[i];
124 xDelete<char>(variable_descriptor);
126 xDelete<char*>(variable_descriptors);
127 xDelete<IssmDouble>(responses);