Changeset 1824


Ignore:
Timestamp:
08/24/09 17:45:33 (15 years ago)
Author:
Eric.Larour
Message:

Brachning back from issm.controlstatic, by hand

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/parallel/control.cpp

    r1708 r1824  
    2727
    2828        /*Fem models : */
    29         FemModel femmodels[5];
     29        Model* model=NULL;
    3030
    3131        /*Results: */
     
    6262        fid=pfopen(inputfilename,"rb");
    6363
     64        /*Initialize model structure: */
     65        model=new Model();
     66
    6467        _printf_("read and create finite element model:\n");
    6568        _printf_("\n   reading control horiz model data:\n");
    66         CreateFemModel(&femmodels[0],fid,ControlAnalysisEnum(),HorizAnalysisEnum());
     69        CreateFemModel(model->DiagnosticHorizontal(),fid,ControlAnalysisEnum(),HorizAnalysisEnum());
    6770        _printf_("\n   reading control vert model data:\n");
    68         CreateFemModel(&femmodels[1],fid,ControlAnalysisEnum(),VertAnalysisEnum());
     71        CreateFemModel(model->DiagnosticVertical(),fid,ControlAnalysisEnum(),VertAnalysisEnum());
    6972        _printf_("\n   reading control stokes model data:\n");
    70         CreateFemModel(&femmodels[2],fid,ControlAnalysisEnum(),StokesAnalysisEnum());
     73        CreateFemModel(model->DiagnosticStokes(),fid,ControlAnalysisEnum(),StokesAnalysisEnum());
    7174        _printf_("\n   reading control hutter model data:\n");
    72         CreateFemModel(&femmodels[3],fid,ControlAnalysisEnum(),HutterAnalysisEnum());
     75        CreateFemModel(model->DiagnosticHutter(),fid,ControlAnalysisEnum(),HutterAnalysisEnum());
    7376        _printf_("\n   reading surface and bed slope computation model data:\n");
    74         CreateFemModel(&femmodels[4],fid,SlopeComputeAnalysisEnum(),NoneAnalysisEnum());
     77        CreateFemModel(model->Slope(),fid,SlopeComputeAnalysisEnum(),NoneAnalysisEnum());
    7578
    7679        _printf_("initialize inputs:\n");
    77         femmodels[0].parameters->FindParam((void*)&u_g_initial,"u_g");
    78         femmodels[0].parameters->FindParam((void*)&u_g_obs,"u_g_obs");
    79         femmodels[0].parameters->FindParam((void*)&numberofnodes,"numberofnodes");
     80        model->DiagnosticHorizontal()->parameters->FindParam((void*)&u_g_initial,"u_g");
     81        model->DiagnosticHorizontal()->parameters->FindParam((void*)&u_g_obs,"u_g_obs");
     82        model->DiagnosticHorizontal()->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
    8083
    8184        inputs=new ParameterInputs;
     
    8588
    8689        /*erase velocities: */
    87         param=(Param*)femmodels[0].parameters->FindParamObject("u_g");
    88         femmodels[0].parameters->DeleteObject((Object*)param);
     90        param=(Param*)model->DiagnosticHorizontal()->parameters->FindParamObject("u_g");
     91        model->DiagnosticHorizontal()->parameters->DeleteObject((Object*)param);
    8992
    90         param=(Param*)femmodels[0].parameters->FindParamObject("u_g_obs");
    91         femmodels[0].parameters->DeleteObject((Object*)param);
     93        param=(Param*)model->DiagnosticHorizontal()->parameters->FindParamObject("u_g_obs");
     94        model->DiagnosticHorizontal()->parameters->DeleteObject((Object*)param);
    9295
    9396        _printf_("initialize results:\n");
     
    9598
    9699        //Add output file name to parameters of femmodels[0]
    97         count=femmodels[0].parameters->Size()+1;
     100        count=model->DiagnosticHorizontal()->parameters->Size()+1;
    98101        param= new Param(count,"outputfilename",STRING);
    99102        param->SetString(outputfilename);
    100         femmodels[0].parameters->AddObject(param);
     103        model->DiagnosticHorizontal()->parameters->AddObject(param);
    101104
    102105        /*are we running the solution sequence, or a qmu wrapper around it? : */
    103         femmodels[0].parameters->FindParam((void*)&qmu_analysis,"qmu_analysis");
     106        model->DiagnosticHorizontal()->parameters->FindParam((void*)&qmu_analysis,"qmu_analysis");
     107       
    104108        if(!qmu_analysis){
    105109
    106110                /*run control analysis: */
    107111                _printf_("call computational core:\n");
    108                 control_core(results,femmodels,inputs);
     112                control_core(results,model,inputs);
    109113
    110114        }
     
    114118
    115119#ifdef _HAVE_DAKOTA_
    116                 Qmux(&femmodels[0],inputs,DiagnosticAnalysisEnum(),NoneAnalysisEnum());
     120                Qmux(model,inputs,DiagnosticAnalysisEnum(),NoneAnalysisEnum());
    117121#else
    118122                throw ErrorException(__FUNCT__," Dakota not present, cannot do qmu!");
     
    124128        results->AddObject(result);
    125129       
    126         femmodels[0].parameters->FindParam((void*)&control_type,"control_type");
     130        model->DiagnosticHorizontal()->parameters->FindParam((void*)&control_type,"control_type");
    127131        result=new Result(results->Size()+1,0,1,"control_type",control_type);
    128132        results->AddObject(result);
    129133
    130134        _printf_("process results:\n");
    131         ProcessResults(&results,&femmodels[0],ControlAnalysisEnum());
     135        ProcessResults(&results,model,ControlAnalysisEnum());
    132136
    133137        _printf_("write results to disk:\n");
     
    135139
    136140        _printf_("write lock file:\n");
    137         femmodels[0].parameters->FindParam((void*)&waitonlock,"waitonlock");
     141        model->DiagnosticHorizontal()->parameters->FindParam((void*)&waitonlock,"waitonlock");
    138142        if (waitonlock){
    139143                WriteLockFile(lockname);
Note: See TracChangeset for help on using the changeset viewer.