Changeset 5479


Ignore:
Timestamp:
08/23/10 00:31:02 (15 years ago)
Author:
Eric.Larour
Message:

Adapted to be able to fire up a control core.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/Qmux/SpawnCoreParallel.cpp

    r5103 r5479  
    3535#include "../modules.h"
    3636
    37 void SpawnCoreParallel(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, FemModel* femmodel,int counter){
     37void 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!: */
    3840
    3941        int i;
    4042        extern int my_rank;
    4143       
    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;
    4346        char    *string                    = NULL;
    4447        int      string_length;
    4548        int      verbose                   = 0;
    46         int      dummy;
    4749        int      solution_type;
     50        bool     control_analysis          = false;
    4851        void (*solutioncore)(FemModel*)    = NULL;
    4952
     
    5457        /*retrieve parameters: */
    5558        femmodel->parameters->FindParam(&verbose,VerboseEnum);
    56         femmodel->parameters->FindParam(&responses_descriptors,&dummy,ResponseDescriptorsEnum);
     59        femmodel->parameters->FindParam(&responses_descriptors,&numresponsedescriptors,ResponseDescriptorsEnum);
    5760        femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
     61        femmodel->parameters->FindParam(&control_analysis,ControlAnalysisEnum);
    5862
    5963        /* 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);
    6165
    6266        /*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;
    6473
    6574        /*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);
    6875        solutioncore(femmodel);
    6976
    7077        /*compute responses: */
    7178        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       
    7481        /*Free ressources:*/
    75         DakotaFree(&variables,&variables_descriptors,&responses_descriptors, numvariables, numresponses);
     82        DakotaFree(&d_variables,&d_variables_descriptors,&responses_descriptors, d_numvariables, numresponsedescriptors);
    7683}
    7784
Note: See TracChangeset for help on using the changeset viewer.