Changeset 4439


Ignore:
Timestamp:
07/07/10 15:48:47 (15 years ago)
Author:
Eric.Larour
Message:

Some modificiations on Qmu analysis

Location:
issm/trunk/src
Files:
7 added
1 deleted
10 edited
2 moved

Legend:

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

    r4200 r4439  
    1111void InputUpdateFromDakotax(FemModel* femmodel, double* variables,char** variables_descriptors,int numvariables){
    1212
    13         int verbose;
    14         int qmu_npart;
    15         int dummy;
     13        int     verbose;
     14        int     qmu_npart;
    1615        double* qmu_part=NULL;
     16        int     dummy;
    1717
    1818        /*retrieve parameters: */
  • issm/trunk/src/c/modules/OutputResultsx/MatlabWriteResults.cpp

    r4321 r4439  
    2424        /*output: */
    2525        mxArray* dataref=NULL;
     26        mxArray* processeddataref=NULL;
    2627        mwSize nfields;
    2728        mwSize maxfields;
     
    9091                result->SetMatlabField(dataref);
    9192        }
    92        
     93
     94        /*Now, process the patch in the dataref structure, by calling MatlabProcessPatch.m
     95         *on the current dataref structure: */
     96        mexCallMATLAB(1,&processeddataref,1,&dataref, "MatlabProcessPatch");
     97
    9398        /*Assign output pointers:*/
    94         *pdataref=dataref;
    95 
     99        *pdataref=processeddataref;
    96100}
    97101#endif
  • issm/trunk/src/c/modules/Qmux/SpawnCore.cpp

    r4193 r4439  
    2424                SpawnCoreSerial(responses, numresponses, variables, variables_descriptors,numvariables, (mxArray*)femmodel, counter);
    2525        #else
    26 
    2726                /*Call SpawnCoreParallel unless counter=-1 on cpu0, in which case, bail out and return 0: */
    2827                MPI_Bcast(&counter,1,MPI_INT,0,MPI_COMM_WORLD);
    2928                if(counter==-1)return 0;
    30 
    3129                SpawnCoreParallel(responses, numresponses, variables, variables_descriptors,numvariables, (FemModel*)femmodel,counter);
    3230        #endif
    33 
    3431        return 1;
    3532}
  • issm/trunk/src/c/modules/Qmux/SpawnCoreParallel.cpp

    r4233 r4439  
    4646        int      dummy;
    4747        int      solution_type;
     48        void (*solutioncore)(FemModel*)    = NULL;
    4849
    4950        /*synchronize all cpus, as CPU 0 is probably late (it is starting the entire dakota strategy!) : */
     
    5455        femmodel->parameters->FindParam(&verbose,VerboseEnum);
    5556        femmodel->parameters->FindParam(&responses_descriptors,&dummy,ResponseDescriptorsEnum);
     57        femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
    5658
    5759        /* only cpu 0, running dakota is providing us with variables and variables_descriptors and numresponses: broadcast onto other cpus: */
     
    5961
    6062        /*Modify core inputs in objects contained in femmodel, to reflect the dakota variables inputs: */
    61         InputUpdateFromDakotax(femmodel,variables,variables_descriptors,numvariables);
     63        InputUpdateFromDakotax(femmodel->elements,femmodel->nodes,femmodel->vertices,loads,femmodel->materials,femmodel->parameters,variables,variables_descriptors,numvariables);
    6264
    63         /*Run the analysis core solution sequence: */
    64         femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
     65        /*Run the core solution sequence: */
    6566        if(verbose)_printf_("%s%s%s\n","Starting ",EnumAsString(solution_type)," core:");
    66         switch(solution_type){
    67                 case DiagnosticAnalysisEnum:
    68                         diagnostic_core(femmodel);
    69                         break;
    70                 case ThermalAnalysisEnum:
    71                         thermal_core(femmodel);
    72                         break;
    73                 case PrognosticAnalysisEnum:
    74                         prognostic_core(femmodel);
    75                         break;
    76                 case Transient2DAnalysisEnum:
    77                         transient2d_core(femmodel);
    78                         break;
    79                 case Transient3DAnalysisEnum:
    80                         transient3d_core(femmodel);
    81                 default:
    82                         ISSMERROR("%s%s%s"," solution_type: ",EnumAsString(solution_type),", not supported yet!");
    83                         break;
    84         }
     67        SolutionConfiguration(NULL,NULL,&solutioncore); solution_core(femmodel);
    8568
    8669        /*compute responses: */
    8770        if(verbose)_printf_("compute dakota responses:\n");
    88         DakotaResponses(responses,responses_descriptors,numresponses,femmodel);
     71        DakotaResponsesx(responses,femmodel->elements,femmodel->nodes,femmodel->vertices,loads,femmodel->materials,femmodel->parameters,responses_descriptors,numresponses,);
    8972
    9073        /*Free ressources:*/
  • issm/trunk/src/c/modules/Qmux/SpawnCoreSerial.cpp

    r4058 r4439  
    3131
    3232        //mexCallMATLAB arrays
    33         mxArray* array[7];
     33        mxArray* array[5];
    3434
    3535        //output from SpawnCore in matlab routine.
  • issm/trunk/src/c/solutions/SolutionConfiguration.cpp

    r4406 r4439  
    145145       
    146146        /*Assign output pointers:*/
    147         *pnumanalyses=numanalyses;
    148         *panalyses=analyses;
    149         *psolutioncore=solutioncore;
     147        if(pnumanalyses) *pnumanalyses=numanalyses;
     148        if(panalyses)*panalyses=analyses;
     149        else xfree((void**)&analyses);
     150        if(psolutioncore)*psolutioncore=solutioncore;
    150151
    151152}
  • issm/trunk/src/m/classes/public/parseresultsfromdisk.m

    r4319 r4439  
    2929
    3030%process patch if necessary
    31 results=ProcessPatch(results);
     31results=MatlabProcessPatch(results);
    3232
    3333fclose(fid);
  • issm/trunk/src/m/classes/public/solve.m

    r4403 r4439  
    5353
    5454%Launch correct solution sequence
    55 md=issm(md);
     55md=issm(md,md.analysis_type);
    5656
    5757%post processes qmu results if necessary
  • issm/trunk/src/m/solutions/MatlabProcessPatch.m

    r4429 r4439  
    1 function structure=ProcessPatch(structure);
     1function structure=MatlabProcessPatch(structure);
    22%PROCESSPATCH - create a structure from a patch
    33%
  • issm/trunk/src/m/solutions/SpawnCore.m

    r4193 r4439  
    66%
    77
    8 %recover parameters
     8%retrieve parameters
    99verbose=femmodel.parameters.Verbose;
    1010responsedescriptors=femmodel.parameters.responsedescriptors;
    11 npart=femmodel.parameters.qmu_npart;
    12 part=femmodel.parameters.qmu_part+1; %C indexing
    13 numberofnodes=femmodel.parameters.NumberOfNodes;
     11solution_type=femmodel.parameters.SolutionType;
    1412
    1513displaystring(verbose,'%s%i',['   qmu iteration:'],counter);
    1614
    1715%first update the inputs to the femmodel using the variables provided to us by dakota.
    18 count=1;
    19 while count<=numel(variables)
    20        
    21         descriptor=variabledescriptors{count};
    22         if ~qmuisdistributed(descriptor),
    23                 inputs=add(inputs,descriptor,variables(count),'double');
    24 
    25                 count=count+1;
    26         else
    27                 root=qmuroot(descriptor);
    28                 param=femmodel.parameters.(root);
    29 
    30                 %next npart values in variables are partition values for this param, collect them.
    31                 partition=variables(count:count+npart-1);
    32 
    33                 %update parameter:
    34                 param=param.*partition(part);
    35 
    36                 %add parameter to inputs
    37                 inputs=add(inputs,root,param,'doublevec',1,numberofnodes);
    38 
    39                 %skip next npart iterations, they all deal with the same parameter descriptor
    40                 count=count+npart;
    41         end
    42 end
    43 
     16[femmodel.elements femmodel.loads]=InputUpdateFromDakota(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,variables,variabledescriptors);
    4417
    4518%now run the core solution
    46 if analysis_type==DiagnosticAnalysisEnum(),
    47 
    48         results=diagnostic_core(femmodel);
    49 
    50 else
    51         error(['SpawnCore error message: could not find core solutoin for analysis type: ' analysis_type]);
    52 end
    53 
    54 %process results
    55 processedresults=processresults(femmodel,results);
     19[dummy,dummy,solutioncore]=SolutionConfiguration(solution_type);
     20eval(['femmodel=' solutioncore '(femmodel);']);
    5621
    5722%now process the results to get response function values
     
    5924for i=1:numel(responsedescriptors),
    6025        descriptor=responsedescriptors{i};
    61         responses(i)=qmuresponse(femmodel,results,processedresults,descriptor);
     26        responses(i)=qmuresponse(femmodel,descriptor);
    6227end
  • issm/trunk/src/m/solutions/issm.m

    r4429 r4439  
    1 function md=issm(md);
     1function md=issm(md,solution_type);
    22%ISSM - ISSM main parallel program
    33%
     
    77        %timing
    88        t1=clock;
    9 
    10         solution_type=md.analysis_type;
    119
    1210        %out of solution_type, figure out solution core function pointer, and types of analyses needed:
     
    3634               
    3735                displaystring(verbose,'%s',['write results'])
    38                 results=OutputResults(femmodel.elements, femmodel.nodes , femmodel.vertices , femmodel.loads , femmodel.materials, femmodel.parameters, femmodel.results);
    39                 md.results.(EnumAsString(solution_type))=ProcessPatch(results);
     36                md.results.(EnumAsString(solution_type))=OutputResults(femmodel.elements, femmodel.nodes , femmodel.vertices , femmodel.loads , femmodel.materials, femmodel.parameters, femmodel.results);
    4037        else
    4138                %launch dakota driver for diagnostic core solution
  • issm/trunk/src/mex/Makefile.am

    r4226 r4439  
    6666                                TriMeshRefine\
    6767                                InputUpdateFromConstant\
     68                                InputUpdateFromDakota\
    6869                                InputUpdateFromSolution\
    6970                                InputUpdateFromVector\
     
    278279                          InputUpdateFromConstant/InputUpdateFromConstant.h
    279280
     281InputUpdateFromDakota_SOURCES = InputUpdateFromDakota/InputUpdateFromDakota.cpp\
     282                          InputUpdateFromDakota/InputUpdateFromDakota.h
     283
    280284InputUpdateFromSolution_SOURCES = InputUpdateFromSolution/InputUpdateFromSolution.cpp\
    281285                          InputUpdateFromSolution/InputUpdateFromSolution.h
Note: See TracChangeset for help on using the changeset viewer.