Changeset 19495


Ignore:
Timestamp:
08/14/15 16:21:06 (10 years ago)
Author:
glperez
Message:

CHG: fix for the AD test3015 bug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/Autodiff/CreateParametersAutodiff.cpp

    r19489 r19495  
    3030        iomodel->Constant(&autodiff_analysis,AutodiffIsautodiffEnum);
    3131
     32                /*initialize a placeholder to store solver pointers: {{{*/
     33                GenericParam<Adolc_edf> *theAdolcEDF_p=new GenericParam<Adolc_edf>(AdolcParamEnum);
     34
     35                /*Solver pointers depend on what type of solver we are implementing: */
     36                options=OptionsFromAnalysis(parameters,DefaultAnalysisEnum); //options database is not filled in yet, use default.
     37                ToolkitOptions::Init(options);
     38
     39                switch(IssmSolverTypeFromToolkitOptions()){
     40                        case MumpsEnum:{
     41                                #ifdef _HAVE_MUMPS_
     42                                theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p=reg_ext_fct(mumpsSolveEDF);
     43                                #else
     44                                _error_("requesting mumps solver without MUMPS being compiled in!");
     45                                #endif
     46                                break;
     47                                                        }
     48                        case GslEnum: {
     49                                #ifdef _HAVE_GSL_
     50                                theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p=reg_ext_fct(EDF_for_solverx);
     51                                #else
     52                                _error_("requesting GSL solver without GSL being compiled in!");
     53                                #endif
     54                            break;
     55                                                  }
     56                        default:
     57                                _error_("solver type not supported yet!");
     58                }
     59
     60                // to save some space:
     61                // we know we won't use adolc inside of  the solver:
     62                theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p->nestedAdolc=false;
     63                // the solution vector is just allocated and doesn't have a meaningful prior value
     64                theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p->dp_y_priorRequired=false;
     65                // the solver wrapper makes sure the matrix and the right hand side don't change
     66                theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p->dp_x_changes=false;
     67                parameters->AddObject(theAdolcEDF_p);
     68
     69                /*Free ressources: */
     70                xDelete<char>(options);
     71                /*}}}*/
    3272        if(autodiff_analysis){
    3373
    34                 #ifdef _HAVE_ADOLC_
     74        #ifdef _HAVE_ADOLC_
    3575
    3676                /*Copy some parameters from IoModel to parameters dataset: {{{*/
     
    115155                parameters->AddObject(new DataSetParam(AutodiffIndependentObjectsEnum,iomodel->independent_objects));
    116156                /*}}}*/
    117                 /*initialize a placeholder to store solver pointers: {{{*/
    118                 GenericParam<Adolc_edf> *theAdolcEDF_p=new GenericParam<Adolc_edf>(AdolcParamEnum);
    119 
    120                 /*Solver pointers depend on what type of solver we are implementing: */
    121                 options=OptionsFromAnalysis(parameters,DefaultAnalysisEnum); //options database is not filled in yet, use default.
    122                 ToolkitOptions::Init(options);
    123 
    124                 switch(IssmSolverTypeFromToolkitOptions()){
    125                         case MumpsEnum:{
    126                                 #ifdef _HAVE_MUMPS_
    127                                 theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p=reg_ext_fct(mumpsSolveEDF);
    128                                 #else
    129                                 _error_("requesting mumps solver without MUMPS being compiled in!");
    130                                 #endif
    131                                 break;
    132                                                         }
    133                         case GslEnum: {
    134                                 #ifdef _HAVE_GSL_
    135                                 theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p=reg_ext_fct(EDF_for_solverx);
    136                                 #else
    137                                 _error_("requesting GSL solver without GSL being compiled in!");
    138                                 #endif
    139                             break;
    140                                                   }
    141                         default:
    142                                 _error_("solver type not supported yet!");
    143                 }
    144 
    145                 // to save some space:
    146                 // we know we won't use adolc inside of  the solver:
    147                 theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p->nestedAdolc=false;
    148                 // the solution vector is just allocated and doesn't have a meaningful prior value
    149                 theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p->dp_y_priorRequired=false;
    150                 // the solver wrapper makes sure the matrix and the right hand side don't change
    151                 theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p->dp_x_changes=false;
    152                 parameters->AddObject(theAdolcEDF_p);
    153 
    154                 /*Free ressources: */
    155                 xDelete<char>(options);
    156                 /*}}}*/
    157157        #endif
    158158        }
Note: See TracChangeset for help on using the changeset viewer.