Changeset 19652
- Timestamp:
- 10/19/15 12:53:22 (9 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Makefile.am
r19634 r19652 264 264 if DAKOTA 265 265 issm_sources += ./classes/Dakota/IssmDirectApplicInterface.h\ 266 ./classes/Dakota/IssmParallelDirectApplicInterface. h\266 ./classes/Dakota/IssmParallelDirectApplicInterface.cpp\ 267 267 ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp\ 268 268 ./modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.cpp\ -
issm/trunk-jpl/src/c/classes/Dakota/IssmParallelDirectApplicInterface.h
r19632 r19652 29 29 /*}}}*/ 30 30 31 #if defined(_HAVE_DAKOTA_) && _DAKOTA_MAJOR_ >= 632 31 33 /*Dakota include files: {{{*/ 32 #if !defined(_WRAPPERS_) && defined(_HAVE_DAKOTA_) && _DAKOTA_MAJOR_ >= 6 33 34 34 #include <DirectApplicInterface.hpp> 35 /*}}}*/ 35 class FemModel; 36 36 37 37 namespace SIM { 38 38 class IssmParallelDirectApplicInterface: public Dakota::DirectApplicInterface{ 39 39 40 private: 41 FemModel* femmodel_init; 40 42 public: 41 /*these fields are used by core solutions: */ 42 void *femmodel; 43 44 /*Constructors/Destructors{{{*/ 45 IssmParallelDirectApplicInterface(const Dakota::ProblemDescDB& problem_db, const MPI_Comm& analysis_comm, void* in_femmodel):Dakota::DirectApplicInterface(problem_db){ 46 47 #ifdef MPI_DEBUG 48 // For testing purposes, output size/rank of the incoming analysis_comm 49 int rank, size; 50 MPI_Comm_rank(analysis_comm, &rank); 51 MPI_Comm_size(analysis_comm, &size); 52 Cout << "In SIM::ParallelDirectApplicInterface ctor, rank = " << rank 53 << " size = " << size << std::endl; 54 #endif // MPI_DEBUG 55 56 femmodel = in_femmodel; 57 } 58 ~IssmParallelDirectApplicInterface(){ 59 } 60 /*}}}*/ 61 43 IssmParallelDirectApplicInterface(const Dakota::ProblemDescDB& problem_db, const MPI_Comm& evaluation_comm, int argc, char** argv); 44 ~IssmParallelDirectApplicInterface(); 62 45 protected: 63 64 46 /// execute an analysis code portion of a direct evaluation invocation 65 int derived_map_ac(const Dakota::String& driver){/*{{{*/ 66 67 #ifdef MPI_DEBUG 68 Cout << "analysis server " << analysisServerId << " invoking " << ac_name 69 << " within SIM::ParallelDirectApplicInterface." << std::endl; 70 #endif // MPI_DEBUG 71 72 int i; 73 IssmDouble* variables=NULL; 74 char** variable_descriptors=NULL; 75 char* variable_descriptor=NULL; 76 IssmDouble* responses=NULL; 77 78 /*Before launching analysis, we need to transfer the dakota inputs into Issm 79 *readable variables: */ 80 81 /*First, the variables: */ 82 variables=xNew<IssmDouble>(numACV); 83 for(i=0;i<numACV;i++){ 84 variables[i]=xC[i]; 85 } 86 /*The descriptors: */ 87 variable_descriptors=xNew<char*>(numACV); 88 for(i=0;i<numACV;i++){ 89 std::string label=xCLabels[i]; 90 variable_descriptor=xNew<char>(strlen(label.c_str())+1); 91 memcpy(variable_descriptor,label.c_str(),(strlen(label.c_str())+1)*sizeof(char)); 92 93 variable_descriptors[i]=variable_descriptor; 94 } 95 96 /*Initialize responses: */ 97 responses=xNewZeroInit<IssmDouble>(numFns); 98 99 /*run core solution: */ 100 //DakotaSpawnCore(responses,numFns, variables,variable_descriptors,numACV,femmodel); 101 102 /*populate responses: */ 103 for(i=0;i<numFns;i++){ 104 fnVals[i]=responses[i]; 105 } 106 107 /*Free ressources:*/ 108 xDelete<IssmDouble>(variables); 109 for(i=0;i<numACV;i++){ 110 variable_descriptor=variable_descriptors[i]; 111 xDelete<char>(variable_descriptor); 112 } 113 xDelete<char*>(variable_descriptors); 114 xDelete<IssmDouble>(responses); 115 116 return 0; 117 }/*}}}*/ 118 119 /// no-op hides base error; job batching occurs within wait_local_evaluations() 120 //void derived_map_asynch(const Dakota::ParamResponsePair& pair){}; 121 122 /// evaluate the batch of jobs contained in prp_queue 123 //void wait_local_evaluations(Dakota::PRPQueue& prp_queue); 124 125 /// invokes wait_local_evaluations() (no special nowait support) 126 //void test_local_evaluations(Dakota::PRPQueue& prp_queue) { wait_local_evaluations(prp_queue); }; 127 128 /// no-op hides default run-time error checks at DirectApplicInterface level 129 //void set_communicators_checks(int max_eval_concurrency){}; 130 131 private: 47 int derived_map_ac(const Dakota::String& ac_name); 132 48 }; 133 49 }
Note:
See TracChangeset
for help on using the changeset viewer.