Changeset 3887


Ignore:
Timestamp:
05/21/10 14:51:20 (15 years ago)
Author:
Eric.Larour
Message:

New call to cores, starting to cleanup the results API

Location:
issm/trunk/src
Files:
42 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/DataSet/DataSet.cpp

    r3869 r3887  
    11261126/*}}}*/
    11271127/*FUNCTION DataSet::Gradj{{{1*/
    1128 void  DataSet::Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,char* control_type){
     1128void  DataSet::Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,int control_type){
    11291129
    11301130
  • issm/trunk/src/c/DataSet/DataSet.h

    r3869 r3887  
    8787                DataSet* Copy(void);
    8888                void  Du(Vec du_g,int analysis_type,int sub_analysis_type);
    89                 void  Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,char* control_type);
     89                void  Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,int control_type);
    9090                void  Misfit(double* pJ, int analysis_type,int sub_analysis_type);
    9191                void  CostFunction(double* pJ, int analysis_type,int sub_analysis_type);
  • issm/trunk/src/c/Gradjx/Gradjx.cpp

    r3775 r3887  
    1111
    1212void Gradjx( Vec* pgrad_g, int numberofnodes, DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials, Parameters* parameters,
    13                         int analysis_type,int sub_analysis_type,char* control_type){
     13                        int analysis_type,int sub_analysis_type,int control_type){
    1414
    1515        /*output: */
  • issm/trunk/src/c/Gradjx/Gradjx.h

    r3673 r3887  
    1111/* local prototypes: */
    1212void Gradjx( Vec* pgrad_g, int numberofnodes, DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials,  Parameters* parameters,
    13                         int analysis_type,int sub_analysis_type,char* control_type);
     13                        int analysis_type,int sub_analysis_type,int control_type);
    1414
    1515#endif  /* _GRADJX_H */
  • issm/trunk/src/c/Qmux/SpawnCoreParallel.cpp

    r3775 r3887  
    9292        _printf_("qmu iteration: %i\n",counter);
    9393
    94         //initialize results:
    95         results=new DataSet(ResultsEnum);
    96 
    9794        /*Modify core inputs in objects contained in model, to reflect the dakota variables inputs: */
    9895        model->UpdateFromDakota(variables,variables_descriptors,numvariables,model->GetFormulation(DiagnosticAnalysisEnum,HorizAnalysisEnum)->parameters,qmu_part,qmu_npart); //diagnostic horiz model is the one holding the parameters for Dakota.
     
    103100                if(verbose)_printf_("Starting diagnostic core\n");
    104101
    105                 diagnostic_core(results,model);
     102                results=diagnostic_core(model);
    106103
    107104        }
     
    109106               
    110107                if(verbose)_printf_("Starting thermal core\n");
    111                 thermal_core(results,model);
     108                results=thermal_core(model);
    112109
    113110        }
     
    115112
    116113                if(verbose)_printf_("Starting prognostic core\n");
    117                 prognostic_core(results,model);
     114                results=prognostic_core(model);
    118115
    119116        }
     
    121118
    122119                if(verbose)_printf_("Starting transient core\n");
    123                 transient_core(results,model);
     120                results=transient_core(model);
    124121
    125122        }
  • issm/trunk/src/c/objects/Elements/Beam.cpp

    r3847 r3887  
    718718/*}}}*/
    719719/*FUNCTION Beam::Gradj{{{1*/
    720 void  Beam::Gradj(Vec, int, int,char*){
     720void  Beam::Gradj(Vec, int, int,int){
    721721        ISSMERROR(" not supported yet!");
    722722}
  • issm/trunk/src/c/objects/Elements/Beam.h

    r3869 r3887  
    8585                void  GetThicknessList(double* thickness_list);
    8686                void  Du(Vec, int,int);
    87                 void  Gradj(Vec,  int, int,char*);
     87                void  Gradj(Vec,  int, int,int);
    8888                void  GradjDrag(Vec,  int,int );
    8989                void  GradjB(Vec,  int,int );
  • issm/trunk/src/c/objects/Elements/Element.h

    r3869 r3887  
    3636                virtual void   GetBedList(double* bed_list)=0;
    3737                virtual void   Du(Vec du_g,int analysis_type,int sub_analysis_type)=0;
    38                 virtual void   Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,char* control_type)=0;
     38                virtual void   Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,int control_type)=0;
    3939                virtual void   GradjDrag(Vec grad_g,int analysis_type,int sub_analysis_type)=0;
    4040                virtual void   GradjB(Vec grad_g,int analysis_type,int sub_analysis_type)=0;
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r3877 r3887  
    42424242/*}}}*/
    42434243/*FUNCTION Penta::Gradj {{{1*/
    4244 void  Penta::Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,char* control_type){
     4244void  Penta::Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,int control_type){
    42454245
    42464246        /*inputs: */
     
    42534253        if(onwater)return;
    42544254
    4255         if (strcmp(control_type,"drag")==0){
     4255        if (control_type==DragCoefficientEnum){
    42564256                GradjDrag( grad_g,analysis_type,sub_analysis_type);
    42574257        }
    4258         else if (strcmp(control_type,"B")==0){
     4258        else if (control_type=RheologyBEnum){
    42594259                GradjB( grad_g, analysis_type,sub_analysis_type);
    42604260        }
    4261         else ISSMERROR("%s%s","control type not supported yet: ",control_type);
     4261        else ISSMERROR("%s%i","control type not supported yet: ",control_type);
    42624262}
    42634263/*}}}*/
  • issm/trunk/src/c/objects/Elements/Penta.h

    r3877 r3887  
    7777                bool   GetOnBed();
    7878                void  Du(Vec du_g,int analysis_type,int sub_analysis_type);
    79                 void  Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,char* control_type);
     79                void  Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,int control_type);
    8080                void  GradjDrag(Vec grad_g,int analysis_type,int sub_analysis_type);
    8181                void  GradjB(Vec grad_g,int analysis_type,int sub_analysis_type);
  • issm/trunk/src/c/objects/Elements/Sing.cpp

    r3821 r3887  
    508508/*}}}*/
    509509/*FUNCTION Sing::Gradj {{{1*/
    510 void  Sing::Gradj(Vec,  int, int ,char*){
     510void  Sing::Gradj(Vec,  int, int ,int){
    511511        ISSMERROR(" not supported yet!");
    512512}
  • issm/trunk/src/c/objects/Elements/Sing.h

    r3869 r3887  
    8484                void  GetThicknessList(double* thickness_list);
    8585                void  Du(Vec,int,int);
    86                 void  Gradj(Vec, int, int,char*);
     86                void  Gradj(Vec, int, int,int);
    8787                void  GradjDrag(Vec , int,int);
    8888                void  GradjB(Vec,  int,int);
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r3877 r3887  
    658658        double  dk[NDOF2];
    659659        double  dB[NDOF2];
    660         char*   control_type=NULL;
     660        int    control_type;
    661661        double  cm_noisedmp;
    662662
     
    700700
    701701                /*Add Tikhonov regularization term to misfit*/
    702                 if (strcmp(control_type,"drag")==0){
     702                if (control_type==DragCoefficientEnum){
    703703                        if (shelf){
    704704                                inputs->GetParameterDerivativeValue(&dk[0],&xyz_list[0][0],&gauss_l1l2l3[0],DragCoefficientEnum);
     
    707707                        }
    708708                }
    709                 else if (strcmp(control_type,"B")==0){
     709                else if (control_type==RheologyBEnum){
    710710                        inputs->GetParameterDerivativeValue(&dB[0], &xyz_list[0][0], &gauss_l1l2l3[0],RheologyBEnum);
    711711                        Jelem+=cm_noisedmp*1/2*(pow(dB[0],2)+pow(dB[1],2))*Jdet*gauss_weight;
    712712                }
    713713                else{
    714                         ISSMERROR("%s%s","unsupported control type: ",control_type);
     714                        ISSMERROR("%s%i","unsupported control type: ",control_type);
    715715                }
    716716
     
    721721        xfree((void**)&third_gauss_area_coord);
    722722        xfree((void**)&gauss_weights);
    723         xfree((void**)&control_type);
    724723
    725724        /*Return: */
     
    38313830/*}}}*/
    38323831/*FUNCTION Tria::Gradj {{{1*/
    3833 void  Tria::Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,char* control_type){
     3832void  Tria::Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,int control_type){
    38343833
    38353834        /*inputs: */
     
    38423841        if(onwater)return;
    38433842
    3844         if (strcmp(control_type,"drag")==0){
     3843        if (control_type==DragCoefficientEnum){
    38453844                GradjDrag( grad_g,analysis_type,sub_analysis_type);
    38463845        }
    3847         else if (strcmp(control_type,"B")==0){
     3846        else if (control_type==RheologyBEnum){
    38483847                GradjB( grad_g,analysis_type,sub_analysis_type);
    38493848        }
    3850         else ISSMERROR("%s%s","control type not supported yet: ",control_type);
     3849        else ISSMERROR("%s%i","control type not supported yet: ",control_type);
    38513850}
    38523851/*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.h

    r3869 r3887  
    8080                void  GetJacobian(double* J, double* xyz_list,double* gauss_l1l2l3);
    8181                void  Du(Vec du_g,int analysis_type,int sub_analysis_type);
    82                 void  Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,char* control_type);
     82                void  Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,int control_type);
    8383                void  GradjDrag(Vec grad_g,int analysis_type,int sub_analysis_type);
    8484                void  GradjDragStokes(Vec grad_g,int analysis_type,int sub_analysis_type);
  • issm/trunk/src/c/parallel/ControlRestart.cpp

    r3751 r3887  
    3939        temporary_results->AddObject(result);
    4040       
    41         result=new Result(temporary_results->Size()+1,0,1,"analysis_type","diagnostic");
     41        result=new Result(temporary_results->Size()+1,0,1,"analysis_type",EnumAsString(DiagnosticAnalysisEnum));
    4242        temporary_results->AddObject(result);
    4343
  • issm/trunk/src/c/parallel/balancedthickness.cpp

    r3859 r3887  
    7979        model->FindParam(&qmu_analysis,QmuAnalysisEnum);
    8080
    81         _printf_("initialize results:\n");
    82         results=new DataSet(ResultsEnum);
    8381        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
    8482
     
    8987                _printf_("call computational core:\n");
    9088                MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    91                 balancedthickness_core(results,model);
     89                results=balancedthickness_core(model);
    9290                MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    9391
     
    107105        }
    108106
    109         /*Add analysis_type to results: */
    110         result=new Result(results->Size()+1,0,1,"analysis_type","balancedthickness");
    111         results->AddObject(result);
    112        
    113107        _printf_("process results:\n");
    114108        ProcessResults(&processedresults,results,model,BalancedthicknessAnalysisEnum);
  • issm/trunk/src/c/parallel/balancedthickness2.cpp

    r3859 r3887  
    7979        model->FindParam(&qmu_analysis,QmuAnalysisEnum);
    8080
    81         _printf_("initialize results:\n");
    82         results=new DataSet(ResultsEnum);
    8381        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
    8482
     
    8987                _printf_("call computational core:\n");
    9088                MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    91                 balancedthickness2_core(results,model);
     89                results=balancedthickness2_core(model);
    9290                MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    9391
     
    107105        }
    108106
    109         /*Add analysis_type to results: */
    110         result=new Result(results->Size()+1,0,1,"analysis_type","balancedthickness2");
    111         results->AddObject(result);
    112        
    113107        _printf_("process results:\n");
    114108        ProcessResults(&processedresults,results,model,Balancedthickness2AnalysisEnum);
  • issm/trunk/src/c/parallel/balancedthickness2_core.cpp

    r3775 r3887  
    1111#include "../modules.h"
    1212
    13 void balancedthickness2_core(DataSet* results,Model* model){
     13DataSet* balancedthickness2_core(Model* model){
    1414
    1515        extern int my_rank;
     
    1717        /*output: */
    1818        Result* result=NULL;
     19        DataSet* results=NULL;
    1920
    2021        /*intermediary: */
     
    3536        FemModel* fem_p=NULL;
    3637
     38        //initialize results:
     39        results=new DataSet(ResultsEnum);
    3740
    3841        fem_p=model->GetFormulation(Balancedthickness2AnalysisEnum);
     
    6871        results->AddObject(result);
    6972
     73        /*Add analysis_type to results: */
     74        result=new Result(results->Size()+1,0,1,"analysis_type","balancedthickness2");
     75        results->AddObject(result);
     76
    7077        /*Free ressources:*/
    7178        VecFree(&vx_g);
    7279        VecFree(&vy_g);
    7380        VecFree(&h_g);
     81       
     82        /*return: */
     83        return results;
     84
    7485}
  • issm/trunk/src/c/parallel/balancedthickness_core.cpp

    r3775 r3887  
    1111#include "../modules.h"
    1212
    13 void balancedthickness_core(DataSet* results,Model* model){
     13DataSet* balancedthickness_core(Model* model){
    1414
    1515        extern int my_rank;
     
    1717        /*output: */
    1818        Result* result=NULL;
     19        DataSet* results=NULL;
    1920
    2021        /*intermediary: */
     
    3334        FemModel* fem_p=NULL;
    3435
     36        //initialize results:
     37        results=new DataSet(ResultsEnum);
    3538
    3639        /*recover fem model: */
     
    5861        results->AddObject(result);
    5962
     63        /*Add analysis_type to results: */
     64        result=new Result(results->Size()+1,0,1,"analysis_type","balancedthickness");
     65        results->AddObject(result);
     66
    6067        /*Free ressources:*/
    6168        VecFree(&u_g);
    6269        VecFree(&h_g);
     70       
     71        /*return: */
     72        return results;
     73
    6374}
  • issm/trunk/src/c/parallel/balancedvelocities.cpp

    r3859 r3887  
    3535        DataSet* processedresults=NULL;
    3636        Result*  result=NULL;
    37 
    3837        Param*   param=NULL;
    3938
     
    7877        model->FindParam(&qmu_analysis,QmuAnalysisEnum);
    7978
    80         _printf_("initialize results:\n");
    81         results=new DataSet(ResultsEnum);
    8279        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
    8380
     
    8885                _printf_("call computational core:\n");
    8986                MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    90                 balancedvelocities_core(results,model);
     87                results=balancedvelocities_core(model);
    9188                MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    9289
     
    106103        }
    107104
    108         /*Add analysis_type to results: */
    109         result=new Result(results->Size()+1,0,1,"analysis_type","balancedvelocities");
    110         results->AddObject(result);
    111        
    112105        _printf_("process results:\n");
    113106        ProcessResults(&processedresults,results,model,BalancedvelocitiesAnalysisEnum);
  • issm/trunk/src/c/parallel/balancedvelocities_core.cpp

    r3751 r3887  
    1010#include "../modules.h"
    1111
    12 void balancedvelocities_core(DataSet* results,Model* model){
     12DataSet* balancedvelocities_core(Model* model){
    1313
    1414        extern int my_rank;
     
    1616        /*output: */
    1717        Result* result=NULL;
     18        DataSet* results=NULL;
    1819
    1920        /*intermediary: */
     
    3233        FemModel* fem_p=NULL;
    3334
     35        //initialize results:
     36        results=new DataSet(ResultsEnum);
    3437
    3538        /*recover fem model: */
     
    5760        results->AddObject(result);
    5861
     62        /*Add analysis_type to results: */
     63        result=new Result(results->Size()+1,0,1,"analysis_type","balancedvelocities");
     64        results->AddObject(result);
     65
    5966        /*Free ressources:*/
    6067        VecFree(&u_g);
    6168        VecFree(&v_g);
     69
     70        /*return: */
     71        return results;
    6272}
  • issm/trunk/src/c/parallel/control_core.cpp

    r3751 r3887  
    77#include "../EnumDefinitions/EnumDefinitions.h"
    88
    9 void control_core(DataSet* results,Model* model){
     9DataSet* control_core(Model* model){
    1010
    1111        extern int my_rank;
     
    1515
    1616        /*output: */
     17        DataSet* results=NULL;
    1718        Result* result=NULL;
    1819
     
    5556        int numberofnodes;
    5657
     58        //initialize results
     59        results=new DataSet(ResultsEnum);
     60
    5761        /*Process models*/
    5862        ControlInitialization(model);
     
    9195                 * distribution: */
    9296                if (control_steady){
    93                         steadystate_results=new DataSet(ResultsEnum);
    94                         steadystate_core(steadystate_results,model);
     97                        steadystate_results= steadystate_core(model);
    9598                        VecFree(&t_g); steadystate_results->FindResult(&t_g,"t_g");
    9699                        delete steadystate_results;
     
    99102       
    100103                _printf_("%s\n","      computing gradJ...");
    101                 gradjcompute_results=new DataSet(ResultsEnum);
    102                 gradjcompute_core(gradjcompute_results,model);
     104                gradjcompute_results= gradjcompute_core(model);
    103105                gradjcompute_results->FindResult(&grad_g,"grad_g");
    104106                delete gradjcompute_results;
     
    110112                        result=new Result(results->Size()+1,0,1,"grad_g",grad_g);
    111113                        results->AddObject(result);
    112                
     114       
     115                        result=new Result(results->Size()+1,0,1,"analysis_type",EnumAsString(analysis_type));
     116                        results->AddObject(result);
     117       
    113118                        /*Free ressources: */
    114119                        xfree((void**)&control_type);
     
    123128                        VecFree(&m_g);
    124129                        xfree((void**)&J);
    125                         return;
     130                        return results;
    126131                }
    127132
     
    196201        if (control_steady){
    197202                model->UpdateInputsFromVector(param_g,control_type,VertexEnum);
    198                 steadystate_results=new DataSet(ResultsEnum);
    199                 steadystate_core(steadystate_results,model);
     203                steadystate_results=steadystate_core(model);
    200204
    201205                //extract u_g ,t_g and m_g from steadystate results, and erase diagnostic_results;
     
    207211        else{
    208212                model->UpdateInputsFromVector(param_g,control_type,VertexEnum);
    209                 diagnostic_results=new DataSet(ResultsEnum);
    210                 diagnostic_core(diagnostic_results,model);
     213                diagnostic_results=diagnostic_core(model);
    211214
    212215                //extract u_g from diagnostic_results, and erase diagnostic_results;
     
    228231                results->AddObject(result);
    229232        }
     233       
     234        /*Add analysis_type and control_type to results: */
     235        result=new Result(results->Size()+1,0,1,"analysis_type",EnumAsString(analysis_type));
     236        results->AddObject(result);
     237        result=new Result(results->Size()+1,0,1,"control_type",EnumAsString(control_type));
     238        results->AddObject(result);
     239
    230240
    231241        /*Free ressources: */
     
    242252        VecFree(&m_g);
    243253        xfree((void**)&J);
     254
     255        //return:
     256        return results;
    244257}
  • issm/trunk/src/c/parallel/diagnostic.cpp

    r3859 r3887  
    2626        bool  qmu_analysis=false;
    2727        bool  control_analysis=false;
    28         char* control_type=NULL;
    2928
    3029        /*Model: */
     
    9089        model->FindParam(&waitonlock,WaitOnLockEnum);
    9190
    92         _printf_("initialize results:\n");
    93         results=new DataSet(ResultsEnum);
    9491        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
    9592
     
    9794        if(!qmu_analysis){
    9895                if(!control_analysis){
    99                         /*run diagnostic analysis: */
     96                       
    10097                        _printf_("call computational core:\n");
    10198                        MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    102                         diagnostic_core(results,model);
     99                        results=diagnostic_core(model);
    103100                        MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    104101
    105                         /*Add analysis_type to results: */
    106                         result=new Result(results->Size()+1,0,1,"analysis_type","diagnostic");
    107                         results->AddObject(result);
    108                        
    109102                        _printf_("process results:\n");
    110103                        ProcessResults(&processed_results,results,model,DiagnosticAnalysisEnum);
     
    114107                        _printf_("call computational core:\n");
    115108                        MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    116                         control_core(results,model);
     109                        results=control_core(model);
    117110                        MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    118 
    119                         /*Add analysis_type and control_type to results: */
    120                         result=new Result(results->Size()+1,0,1,"analysis_type","diagnostic");
    121                         results->AddObject(result);
    122                        
    123                         model->FindParam(&control_type,ControlTypeEnum);
    124                         result=new Result(results->Size()+1,0,1,"control_type",control_type);
    125                         results->AddObject(result);
    126111
    127112                        _printf_("process results:\n");
     
    151136
    152137        /*Free ressources */
    153         xfree((void**)&control_type);
    154138        delete model;
    155139        delete results;
  • issm/trunk/src/c/parallel/diagnostic_core.cpp

    r3855 r3887  
    1111#include "../include/include.h"
    1212
    13 void diagnostic_core(DataSet* results,Model* model){
     13DataSet* diagnostic_core(Model* model){
    1414
    1515        extern int my_rank;
     
    2424
    2525        /*output: */
     26        DataSet* results=NULL;
    2627        Result* result=NULL;
    2728
     
    6667        double* dofset=NULL;
    6768
     69        //initialize results
     70        results=new DataSet(ResultsEnum);
     71
    6872        //first recover parameters common to all solutions
    6973        model->FindParam(&verbose,VerboseEnum);
     
    180184        result=new Result(results->Size()+1,0,1,"p_g",pg);
    181185        results->AddObject(result);
     186        result=new Result(results->Size()+1,0,1,"analysis_type",EnumAsString(DiagnosticAnalysisEnum));
     187        results->AddObject(result);
    182188
    183189        /*output if we have rifts: */
     
    199205        VecFree(&bedslopey);
    200206
     207        /*return: */
     208        return results;
    201209}
  • issm/trunk/src/c/parallel/gradjcompute_core.cpp

    r3775 r3887  
    1313#endif
    1414
    15 void gradjcompute_core(DataSet* results,Model* model){
     15DataSet* gradjcompute_core(Model* model){
    1616       
    1717       
     
    2525        int numberofdofspernode;
    2626        char* solverstring=NULL;
    27         char* control_type=NULL;
     27        int  control_type;
    2828       
    2929        Vec u_g=NULL;
     
    4545       
    4646        /*output: */
     47        DataSet* results=NULL;
    4748        Result* result=NULL;
    4849
     
    5152        int dim=-1;
    5253        int extrude_param=0;
     54
     55        //initialize results
     56        results=new DataSet(ResultsEnum);
    5357       
    5458        /*some parameters:*/
     
    100104
    101105        if(control_steady){
    102                 diagnostic_results=new DataSet(ResultsEnum);
    103                 diagnostic_core(diagnostic_results,model);
     106                diagnostic_results= diagnostic_core(model);
    104107
    105108                //extract u_g and add it to input (3d velocity needed by thermal_core)
     
    117120        result=new Result(results->Size()+1,0,1,"grad_g",grad_g);
    118121        results->AddObject(result);
     122        result=new Result(results->Size()+1,0,1,"analysis_type",EnumAsString(GradientAnalysisEnum));
     123        results->AddObject(result);
    119124       
    120125        /*Free ressources:*/
     
    122127        VecFree(&grad_g);
    123128        xfree((void**)&solverstring);
    124         xfree((void**)&control_type);
    125129        xfree((void**)&lambdax);
    126130        xfree((void**)&lambday);
  • issm/trunk/src/c/parallel/objectivefunctionC.cpp

    r3775 r3887  
    9898        else{
    9999                //We need a 3D velocity!! (vz is required for the next thermal run)
    100                 diagnostic_results=new DataSet(ResultsEnum);
    101                 diagnostic_core(diagnostic_results,model);
     100                diagnostic_results=     diagnostic_core(model);
    102101
    103102                //extract u_g and add it to input (3d velocity needed by thermal_core)
  • issm/trunk/src/c/parallel/parallel.h

    r3722 r3887  
    1212class FemModel;
    1313
    14 void gradjcompute_core(DataSet* results,Model* model);
     14/*cores: */
     15DataSet* gradjcompute_core(Model* model);
     16DataSet* diagnostic_core(Model* model);
     17DataSet* prognostic_core(Model* model);
     18DataSet* prognostic2_core(Model* model);
     19DataSet* balancedthickness_core(Model* model);
     20DataSet* balancedthickness2_core(Model* model);
     21DataSet* balancedvelocities_core(Model* model);
     22DataSet* slopecompute_core(Model* model);
     23DataSet* control_core(Model* model);
     24DataSet* steadystate_core(Model* model);
     25DataSet* transient_core(Model* model);
     26DataSet* transient_core_2d(Model* model);
     27DataSet* transient_core_3d(Model* model);
     28DataSet* thermal_core(Model* model);
    1529
    16 void diagnostic_core(DataSet* results,Model* model);
    17 void prognostic_core(DataSet* results,Model* model);
    18 void prognostic2_core(DataSet* results,Model* model);
    19 void balancedthickness_core(DataSet* results,Model* model);
    20 void balancedthickness2_core(DataSet* results,Model* model);
    21 void balancedvelocities_core(DataSet* results,Model* model);
    22 void slopecompute_core(DataSet* results,Model* model);
    23 void control_core(DataSet* results,Model* model);
    24 
    25 void thermal_core(DataSet* results,Model* model);
     30/*computational cores: */
    2631void thermal_core_nonlinear(Vec* ptg,double* pmelting_offset,FemModel* fem,int analysis_type,int sub_analysis_type);
    27 
    28 void steadystate_core(DataSet* results,Model* model);
    29 
    3032void diagnostic_core_nonlinear(Vec* pug,Mat* pK_ff0,Mat* pK_fs0, DataSet* loads, FemModel* fem,int analysis_type,int sub_analysis_type);
    3133void diagnostic_core_linear(Vec* ppg,FemModel* fem,int  analysis_type,int sub_analysis_type);
    32 void convergence(int* pconverged, Mat K_ff,Vec p_f,Vec u_f,Vec u_f_old,Parameters* parameters);
    33 
    34 void transient_core(DataSet* results,Model* model);
    35 void transient_core_2d(DataSet* results,Model* model);
    36 void transient_core_3d(DataSet* results,Model* model);
    37 
    3834void slope_core(Vec* pslopex,Vec* pslopey,FemModel* fem,int AnalysisEnum);
    3935
     36
     37
     38
     39
    4040//int GradJOrth(WorkspaceParams* workspaceparams);
     41void convergence(int* pconverged, Mat K_ff,Vec p_f,Vec u_f,Vec u_f_old,Parameters* parameters);
    4142
    4243int GoldenSearch(double* psearch_scalar,double* pJ,double xa, double xb, double tolerance, int maxiter, double fit,double optscal,double (*f)(double*,double,double,FemModel*),FemModel* femmodel);
  • issm/trunk/src/c/parallel/prognostic.cpp

    r3859 r3887  
    7676        model->FindParam(&qmu_analysis,QmuAnalysisEnum);
    7777
    78         _printf_("initialize results:\n");
    79         results=new DataSet(ResultsEnum);
    8078        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
    8179
     
    8684                _printf_("call computational core:\n");
    8785                MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    88                 prognostic_core(results,model);
     86                results=prognostic_core(model);
    8987                MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    9088
     
    104102        }
    105103
    106         /*Add analysis_type to results: */
    107         result=new Result(results->Size()+1,0,1,"analysis_type","prognostic");
    108         results->AddObject(result);
    109        
     104               
    110105        _printf_("process results:\n");
    111106        ProcessResults(&processedresults,results,model,PrognosticAnalysisEnum);
  • issm/trunk/src/c/parallel/prognostic2.cpp

    r3859 r3887  
    7777        model->FindParam(&numberofnodes,NumberOfNodesEnum);
    7878
    79         _printf_("initialize results:\n");
    80         results=new DataSet(ResultsEnum);
    8179        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
    8280
     
    8785                _printf_("call computational core:\n");
    8886                MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    89                 prognostic2_core(results,model);
     87                results=prognostic2_core(model);
    9088                MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    9189
     
    105103        }
    106104
    107         /*Add analysis_type to results: */
    108         result=new Result(results->Size()+1,0,1,"analysis_type","prognostic2");
    109         results->AddObject(result);
    110        
    111105        _printf_("process results:\n");
    112106        ProcessResults(&processedresults,results,model,Prognostic2AnalysisEnum);
  • issm/trunk/src/c/parallel/prognostic2_core.cpp

    r3751 r3887  
    1010#include "../modules.h"
    1111
    12 void prognostic2_core(DataSet* results,Model* model){
     12DataSet* prognostic2_core(Model* model){
    1313
    1414        extern int my_rank;
     
    1616        /*output: */
    1717        Result* result=NULL;
     18        DataSet* results=NULL;
    1819
    1920        /*intermediary: */
     
    3334        /*fem prognostic model: */
    3435        FemModel* fem_p=NULL;
     36
     37        //initialize results:
     38        results=new DataSet(ResultsEnum);
    3539
    3640        /*recover fem model: */
     
    6367        VecFree(&vy_g);
    6468        VecFree(&h_g);
     69
     70        /*Add analysis_type to results: */
     71        result=new Result(results->Size()+1,0,1,"analysis_type",EnumAsString(Prognostic2AnalysisEnum));
     72        results->AddObject(result);
     73       
     74        /*return: */
     75        return results;
     76
    6577}
  • issm/trunk/src/c/parallel/prognostic_core.cpp

    r3806 r3887  
    1010#include "../modules.h"
    1111
    12 void prognostic_core(DataSet* results,Model* model){
     12DataSet* prognostic_core(Model* model){
    1313
    1414        extern int my_rank;
    1515
    1616        /*output: */
     17        DataSet* results=NULL;
    1718        Result* result=NULL;
    1819
     
    2627        FemModel* fem_p=NULL;
    2728
     29        //initialize results
     30        results=new DataSet(ResultsEnum);
    2831
    2932        /*recover fem model: */
     
    5053        results->AddObject(result);
    5154
     55        /*Add analysis_type to results: */
     56        result=new Result(results->Size()+1,0,1,"analysis_type",EnumAsString(PrognosticAnalysisEnum));
     57        results->AddObject(result);
     58
    5259        /*Free ressources:*/
    5360        VecFree(&h_g);
     61       
     62        //return:
     63        return results;
     64
    5465}
  • issm/trunk/src/c/parallel/slopecompute.cpp

    r3775 r3887  
    7676        model->FindParam(&waitonlock,WaitOnLockEnum);
    7777
    78         _printf_("initialize results:\n");
    79         results=new DataSet(ResultsEnum);
    8078        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
    8179
     
    8381        _printf_("call computational core:\n");
    8482        MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    85         slopecompute_core(results,model);
     83        results=slopecompute_core(model);
    8684        MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    8785
    88         /*Add analysis_type to results: */
    89         result=new Result(results->Size()+1,0,1,"analysis_type","slopecompute");
    90         results->AddObject(result);
    91        
    9286        _printf_("process results:\n");
    9387        ProcessResults(&processedresults,results,model,SlopecomputeAnalysisEnum);
  • issm/trunk/src/c/parallel/slopecompute_core.cpp

    r3751 r3887  
    1010#include "../modules.h"
    1111
    12 void slopecompute_core(DataSet* results,Model* model){
     12DataSet* slopecompute_core(Model* model){
    1313
    1414        extern int my_rank;
    1515
    1616        /*output: */
     17        DataSet* results=NULL;
    1718        Result* result=NULL;
    1819
     
    2930        /*fem slopecompute model: */
    3031        FemModel* fem_sl=NULL;
     32
     33        //initialize results
     34        results=new DataSet(ResultsEnum);
    3135
    3236        /*recover fem model: */
     
    5155        result=new Result(results->Size()+1,0,1,"sy_g",sy_g);
    5256        results->AddObject(result);
     57        result=new Result(results->Size()+1,0,1,"analysis_type",EnumAsString(SlopecomputeAnalysisEnum));
     58        results->AddObject(result);
     59
    5360
    5461        /*Free ressources:*/
    5562        VecFree(&sx_g);
    5663        VecFree(&sy_g);
     64       
     65        //return:
     66        return results;
    5767}
  • issm/trunk/src/c/parallel/steadystate.cpp

    r3859 r3887  
    106106        model->FindParam(&qmu_analysis,QmuAnalysisEnum);
    107107
    108         _printf_("initialize results:\n");
    109         results=new DataSet(ResultsEnum);
    110108        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
    111109
     
    117115                        _printf_("call computational core:\n");
    118116                        MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    119                         steadystate_core(results,model);
     117                        results=steadystate_core(model);
    120118                        MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    121 
    122                         /*Add analysis_type to results: */
    123                         result=new Result(results->Size()+1,0,1,"analysis_type","steadystate");
    124                         results->AddObject(result);
    125119
    126120                        _printf_("process results:\n");
     
    138132                        _printf_("call computational core:\n");
    139133                        MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    140                         control_core(results,model);
     134                        results=control_core(model);
    141135                        MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    142 
    143                         /*Add analysis_type and control_type to results: */
    144                         result=new Result(results->Size()+1,0,1,"analysis_type","steadystate");
    145                         results->AddObject(result);
    146 
    147                         model->FindParam(&control_type,ControlTypeEnum);
    148                         result=new Result(results->Size()+1,0,1,"control_type",control_type);
    149                         results->AddObject(result);
    150136
    151137                        _printf_("process results:\n");
  • issm/trunk/src/c/parallel/steadystate_core.cpp

    r3751 r3887  
    1010#include "../modules.h"
    1111
    12 void steadystate_core(DataSet* results,Model* model){
     12DataSet* steadystate_core(Model* model){
    1313
    1414        extern int my_rank;
     
    2525        /*output: */
    2626        Result* result=NULL;
     27        DataSet* results=NULL;
    2728        DataSet* results_thermal=NULL;
    2829        DataSet* results_diagnostic=NULL;
     
    7879
    7980                //first compute temperature at steady state.
    80                 results_thermal=new DataSet(ResultsEnum);
    81                 thermal_core(results_thermal,model);
     81                results_thermal=thermal_core(model);
    8282       
    8383                //get t_g and m_g;
     
    9595
    9696                //now compute diagnostic velocity using the steady state temperature.
    97                 results_diagnostic=new DataSet(ResultsEnum);
    98                 diagnostic_core(results_diagnostic,model);
     97                results_diagnostic=diagnostic_core(model);
    9998
    10099                //get p_g and u_g
     
    137136        result=new Result(results->Size()+1,0,1,"m_g",m_g);
    138137        results->AddObject(result);
     138        result=new Result(results->Size()+1,0,1,"analysis_type",EnumAsString(SteadyAnalysisEnum));
     139        results->AddObject(result);
     140
    139141
    140142        /*Free ressource*/
  • issm/trunk/src/c/parallel/thermal.cpp

    r3859 r3887  
    8181        model->FindParam(&qmu_analysis,QmuAnalysisEnum);
    8282
    83         _printf_("initialize results:\n");
    84         results=new DataSet(ResultsEnum);
    8583        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
    8684
     
    9189                _printf_("call computational core:\n");
    9290                MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    93                 thermal_core(results,model);
     91                results=thermal_core(model);
    9492                MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    9593
    96                 /*Add analysis_type to results: */
    97                 result=new Result(results->Size()+1,0,1,"analysis_type","thermal");
    98                 results->AddObject(result);
    99                        
    10094                _printf_("process results:\n");
    10195                ProcessResults(&processed_results,results,model,ThermalAnalysisEnum);
  • issm/trunk/src/c/parallel/thermal_core.cpp

    r3881 r3887  
    1010#include "../modules.h"
    1111
    12 void thermal_core(DataSet* results,Model* model){
     12DataSet* thermal_core(Model* model){
    1313
    1414        extern int my_rank;
     
    2020
    2121        /*output: */
     22        DataSet* results=NULL;
    2223        Result* result=NULL;
    2324
     
    4344        int    sub_analysis_type;
    4445        double melting_offset;
     46
     47        //initialize results
     48        results=new DataSet(ResultsEnum);
    4549
    4650        /*recover fem models: */
     
    120124                }
    121125        }
     126        /*Add analysis_type to results: */
     127        result=new Result(results->Size()+1,0,1,"analysis_type",EnumAsString(ThermalAnalysisEnum));
     128        results->AddObject(result);
    122129
    123130        /*free ressource*/
     
    125132        xfree((void**)&m_g);
    126133        xfree((void**)&time);
     134       
     135        //return:
     136        return results;
     137
    127138
    128139}
  • issm/trunk/src/c/parallel/transient.cpp

    r3859 r3887  
    102102        model->FindParam(&qmu_analysis,QmuAnalysisEnum);
    103103       
    104         _printf_("initialize results:\n");
    105         results=new DataSet(ResultsEnum);
    106104        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
    107105
     
    112110                _printf_("call computational core:\n");
    113111                MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    114                 transient_core(results,model);
     112                results=transient_core(model);
    115113                MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    116114       
    117                 /*Add analysis_type to results: */
    118                 result=new Result(results->Size()+1,0,1,"analysis_type","transient");
    119                 results->AddObject(result);
    120 
    121115                _printf_("process results:\n");
    122116                ProcessResults(&processed_results,results,model,TransientAnalysisEnum);
  • issm/trunk/src/c/parallel/transient_core.cpp

    r3751 r3887  
    1010#include "../modules.h"
    1111
    12 void transient_core(DataSet* results,Model* model){
    13 
    14         extern int my_rank;
     12DataSet* transient_core(Model* model){
    1513
    1614        int dim=-1;
     15        DataSet* results=NULL;
    1716
    1817        //first recover parameters common to all solutions
     
    2120        //branch out
    2221        if(dim==2){
    23                 transient_core_2d(results,model);
     22                results=transient_core_2d(model);
    2423        }
    2524        else if(dim==3){
    26                 transient_core_3d(results,model);
     25                results=transient_core_3d(model);
    2726        }
    2827        else ISSMERROR("%s%i%s"," dimension ",dim," not supported yet!");
  • issm/trunk/src/c/parallel/transient_core_2d.cpp

    r3775 r3887  
    1010#include "../modules.h"
    1111
    12 void transient_core_2d(DataSet* results,Model* model){
     12DataSet* transient_core_2d(Model* model){
    1313
    1414        extern int my_rank;
     
    2323
    2424        /*output: */
     25        DataSet* results=NULL;
    2526        Result* result=NULL;
    2627
     
    5859        int dof3[1]={3};
    5960
     61        //initialize results
     62        results=new DataSet(ResultsEnum);
     63
    6064        /*recover fem models: */
    6165        fem_dh=model->GetFormulation(DiagnosticAnalysisEnum,HorizAnalysisEnum);
     
    8690                //Deal with velocities.
    8791                _printf_("%s\n","computing new velocity");
    88                 diagnostic_results=new DataSet(ResultsEnum);
    89                 diagnostic_core(diagnostic_results,model);
     92                diagnostic_results= diagnostic_core(model);
    9093
    9194                //extract u_g and p_g from diagnostic_results, and erase diagnostic_results;
     
    102105                xfree((void**)&vx); xfree((void**)&vy);
    103106               
    104                 prognostic_results=new DataSet(ResultsEnum);
    105                 prognostic_core(prognostic_results,model);
     107                prognostic_results= prognostic_core(model);
    106108       
    107109                //extract h_g prognostic_results, and erase prognostic_results;
     
    136138        }
    137139
     140        /*Add analysis_type to results: */
     141        result=new Result(results->Size()+1,0,1,"analysis_type",EnumAsString(TransientAnalysisEnum));
     142        results->AddObject(result);
     143
    138144        /*Free ressources:*/
    139145        VecFree(&u_g);
     
    144150        xfree((void**)&vx);
    145151        xfree((void**)&vy);
     152       
     153        //return:
     154        return results;
     155
    146156}
  • issm/trunk/src/c/parallel/transient_core_3d.cpp

    r3775 r3887  
    1010#include "../modules.h"
    1111
    12 void transient_core_3d(DataSet* results,Model* model){
     12DataSet* transient_core_3d(Model* model){
    1313
    1414        extern int my_rank;
     
    2525
    2626        /*output: */
     27        DataSet* results=NULL;
    2728        Result* result=NULL;
    2829
     
    6364        int dof3[1]={3};
    6465
     66        //initialize results
     67        results=new DataSet(ResultsEnum);
     68
    6569        /*recover fem models: */
    6670        fem_dh=model->GetFormulation(DiagnosticAnalysisEnum,HorizAnalysisEnum);
     
    107111
    108112                //Deal with velocities.
    109                 diagnostic_results=new DataSet(ResultsEnum);
    110                 diagnostic_core(diagnostic_results,model);
     113                diagnostic_results=diagnostic_core(model);
    111114
    112115                //extract u_g and p_g from diagnostic_results, and erase diagnostic_results;
     
    124127                xfree((void**)&vx); xfree((void**)&vy); xfree((void**)&vz);
    125128       
    126                 prognostic_results=new DataSet(ResultsEnum); prognostic_core(prognostic_results,model);
     129                prognostic_results=prognostic_core(model);
    127130       
    128131                //extract h_g prognostic_results, and erase prognostic_results;
     
    186189        }
    187190
     191        /*Add analysis_type to results: */
     192        result=new Result(results->Size()+1,0,1,"analysis_type",EnumAsString(TransientAnalysisEnum));
     193        results->AddObject(result);
     194
     195
    188196        /*Free ressources:*/
    189197        VecFree(&u_g);
     
    197205        xfree((void**)&vy);
    198206        xfree((void**)&vz);
     207       
     208        //return:
     209        return results;
     210
    199211}
  • issm/trunk/src/mex/Gradj/Gradj.cpp

    r3715 r3887  
    1717        DataSet* materials=NULL;
    1818        Parameters* parameters=NULL;
    19         char*    control_type=NULL;
     19        int      control_type;
    2020        int      analysis_type;
    2121        int      sub_analysis_type;
     
    5757        delete materials;
    5858        delete parameters;
    59         xfree((void**)&control_type);
    6059        VecFree(&grad_g);
    6160
Note: See TracChangeset for help on using the changeset viewer.