Changeset 15009
- Timestamp:
- 05/10/13 15:55:24 (12 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Makefile.am
r14996 r15009 341 341 #}}} 342 342 #DAKOTA sources {{{ 343 dakota_sources = ./classes/dakota/DakotaPlugin.h\ 344 ./classes/dakota/DakotaPlugin.cpp\ 345 ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.h\ 343 dakota_sources = ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.h\ 346 344 ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp\ 347 345 ./modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.h\ -
issm/trunk-jpl/src/c/analyses/dakota_core.cpp
r15007 r15009 46 46 #include <DakotaInterface.H> 47 47 #include "./DakotaSpawnCore.h" 48 #include "../classes/dakota/DakotaPlugin.h" 48 #endif 49 /*}}}*/ 50 /*DakotaPlugin class {{{*/ 51 #ifdef _HAVE_DAKOTA_ //only works if dakota library has been compiled in. 52 #include <DirectApplicInterface.H> 53 #include <DakotaResponse.H> 54 #include <ParamResponsePair.H> 55 #include <system_defs.h> 56 #include <ProblemDescDB.H> 57 #include <ParallelLibrary.H> 58 namespace SIM { 59 class DakotaPlugin: public Dakota::DirectApplicInterface{ 60 public: 61 /*these fields are used by core solutions: */ 62 void *femmodel; 63 int counter; 64 /*Constructors/Destructors*/ 65 DakotaPlugin(const Dakota::ProblemDescDB& problem_db,void* in_femmodel):Dakota::DirectApplicInterface(problem_db){/*{{{*/ 66 femmodel = in_femmodel; 67 counter = 0; 68 }/*}}}*/ 69 ~DakotaPlugin(){/*{{{*/ 70 /* Virtual destructor handles referenceCount at Interface level. */ 71 }/*}}}*/ 72 protected: 73 /*execute the input filter portion of a direct evaluation invocation*/ 74 //int derived_map_if(const Dakota::String& if_name); 75 /*execute an analysis code portion of a direct evaluation invocation*/ 76 int derived_map_ac(const Dakota::String& driver){/*{{{*/ 77 78 int i; 79 IssmDouble* variables=NULL; 80 char** variable_descriptors=NULL; 81 char* variable_descriptor=NULL; 82 IssmDouble* responses=NULL; 83 84 /*increae counter: */ 85 counter++; 86 87 /*Before launching analysis, we need to transfer the dakota inputs into Issm 88 *readable variables: */ 89 90 /*First, the variables: */ 91 variables=xNew<IssmDouble>(numACV); 92 for(i=0;i<numACV;i++){ 93 variables[i]=xC[i]; 94 } 95 /*The descriptors: */ 96 variable_descriptors=xNew<char*>(numACV); 97 for(i=0;i<numACV;i++){ 98 std::string label=xCLabels[i]; 99 variable_descriptor=xNew<char>(strlen(label.c_str())+1); 100 memcpy(variable_descriptor,label.c_str(),(strlen(label.c_str())+1)*sizeof(char)); 101 102 variable_descriptors[i]=variable_descriptor; 103 } 104 105 /*Initialize responses: */ 106 responses=xNewZeroInit<IssmDouble>(numFns); 107 108 /*run core solution: */ 109 DakotaSpawnCore(responses,numFns, variables,variable_descriptors,numACV,femmodel,counter); 110 111 /*populate responses: */ 112 for(i=0;i<numFns;i++){ 113 fnVals[i]=responses[i]; 114 } 115 116 /*Free ressources:*/ 117 xDelete<IssmDouble>(variables); 118 for(i=0;i<numACV;i++){ 119 variable_descriptor=variable_descriptors[i]; 120 xDelete<char>(variable_descriptor); 121 } 122 xDelete<char*>(variable_descriptors); 123 xDelete<IssmDouble>(responses); 124 125 return 0; 126 }/*}}}*/ 127 /*execute the output filter portion of a direct evaluation invocation*/ 128 //int derived_map_of(const Dakota::String& of_name); 129 /*add for issm: */ 130 int GetCounter(){/*{{{*/ 131 return counter; 132 }/*}}}*/ 133 private: 134 }; 135 } 49 136 #endif 50 137 /*}}}*/ -
issm/trunk-jpl/src/c/classes/classes.h
r15007 r15009 24 24 #include "./kriging/krigingobjects.h" 25 25 26 /*dakota:*/27 //#include "./dakota/DakotaPlugin.h"28 29 26 /*diverse: */ 30 27 #include "./Hook.h"
Note:
See TracChangeset
for help on using the changeset viewer.