Changeset 5479
- Timestamp:
- 08/23/10 00:31:02 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/Qmux/SpawnCoreParallel.cpp
r5103 r5479 35 35 #include "../modules.h" 36 36 37 void SpawnCoreParallel(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, FemModel* femmodel,int counter){ 37 void SpawnCoreParallel(double* d_responses, int d_numresponses, double* d_variables, char** d_variables_descriptors,int d_numvariables, FemModel* femmodel,int counter){ 38 39 /*Notice the d_, which prefixes anything that is being provided to us by the Dakota pluggin. Careful. some things are ours, some are dakotas!: */ 38 40 39 41 int i; 40 42 extern int my_rank; 41 43 42 char **responses_descriptors = NULL; 44 char **responses_descriptors = NULL; //these are our! there are only numresponsedescriptors of them, not d_numresponses!!! 45 int numresponsedescriptors; 43 46 char *string = NULL; 44 47 int string_length; 45 48 int verbose = 0; 46 int dummy;47 49 int solution_type; 50 bool control_analysis = false; 48 51 void (*solutioncore)(FemModel*) = NULL; 49 52 … … 54 57 /*retrieve parameters: */ 55 58 femmodel->parameters->FindParam(&verbose,VerboseEnum); 56 femmodel->parameters->FindParam(&responses_descriptors,& dummy,ResponseDescriptorsEnum);59 femmodel->parameters->FindParam(&responses_descriptors,&numresponsedescriptors,ResponseDescriptorsEnum); 57 60 femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum); 61 femmodel->parameters->FindParam(&control_analysis,ControlAnalysisEnum); 58 62 59 63 /* only cpu 0, running dakota is providing us with variables and variables_descriptors and numresponses: broadcast onto other cpus: */ 60 DakotaMPI_Bcast(& variables,&variables_descriptors,&numvariables,&numresponses);64 DakotaMPI_Bcast(&d_variables,&d_variables_descriptors,&d_numvariables,&d_numresponses); 61 65 62 66 /*Modify core inputs in objects contained in femmodel, to reflect the dakota variables inputs: */ 63 InputUpdateFromDakotax(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,femmodel->partition,variables,variables_descriptors,numvariables); 67 InputUpdateFromDakotax(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,femmodel->partition,d_variables,d_variables_descriptors,d_numvariables); 68 69 /*Determine solution sequence: */ 70 if(verbose)_printf_("%s%s%s\n","Starting ",EnumToString(solution_type)," core:"); 71 SolutionConfiguration(NULL,NULL,&solutioncore,solution_type); 72 if(control_analysis)solutioncore=&control_core; 64 73 65 74 /*Run the core solution sequence: */ 66 if(verbose)_printf_("%s%s%s\n","Starting ",EnumToString(solution_type)," core:");67 SolutionConfiguration(NULL,NULL,&solutioncore,solution_type);68 75 solutioncore(femmodel); 69 76 70 77 /*compute responses: */ 71 78 if(verbose)_printf_("compute dakota responses:\n"); 72 DakotaResponsesx( responses,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,responses_descriptors,numresponses);73 79 DakotaResponsesx(d_responses,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,femmodel->partition,responses_descriptors,numresponsedescriptors,d_numresponses); 80 74 81 /*Free ressources:*/ 75 DakotaFree(& variables,&variables_descriptors,&responses_descriptors, numvariables, numresponses);82 DakotaFree(&d_variables,&d_variables_descriptors,&responses_descriptors, d_numvariables, numresponsedescriptors); 76 83 } 77 84
Note:
See TracChangeset
for help on using the changeset viewer.