Changeset 23307


Ignore:
Timestamp:
09/18/18 09:26:24 (7 years ago)
Author:
Mathieu Morlighem
Message:

CHG: scaling factor should be double, not active

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/cores/controlm1qn3_core.cpp

    r23306 r23307  
    3939
    4040        /*Intermediaries*/
    41         long         omode;
    42         double       f,dxmin,gttol;
    43         int          maxsteps,maxiter;
    44         int          intn,numberofvertices,num_controls,num_cost_functions,solution_type;
    45         IssmDouble *scaling_factors = NULL;
    46         double      *X  = NULL;
    47         double      *G  = NULL;
     41        long    omode;
     42        double  f,dxmin,gttol;
     43        int     maxsteps,maxiter;
     44        int     intn,numberofvertices,num_controls,num_cost_functions,solution_type;
     45        double *scaling_factors = NULL;
     46        double *X  = NULL;
     47        double *G  = NULL;
    4848
    4949        /*Recover some parameters*/
     
    9393                for(int i=0;i<numberofvertices;i++){
    9494                        int index = numberofvertices*c+i;
    95                         X[index] = X[index]/reCast<double>(scaling_factors[c]);
     95                        X[index] = X[index]/scaling_factors[c];
    9696                }
    9797        }
     
    148148                for(int i=0;i<numberofvertices;i++){
    149149                        int index = numberofvertices*c+i;
    150                         X[index] = X[index]*reCast<double>(scaling_factors[c]);
     150                        X[index] = X[index]*scaling_factors[c];
    151151                        if(X[index]>XU[index]) X[index]=XU[index];
    152152                        if(X[index]<XL[index]) X[index]=XL[index];
     
    187187        xDelete<double>(XU);
    188188        xDelete<double>(XL);
    189         xDelete<IssmDouble>(scaling_factors);
     189        xDelete<double>(scaling_factors);
    190190        xDelete<double>(mystruct.Jlist);
    191191        xDelete<int>(mystruct.i);
     
    203203        /*Recover some parameters*/
    204204        int num_responses,num_controls,numberofvertices,solution_type;
    205         IssmDouble* scaling_factors = NULL;
     205        double* scaling_factors = NULL;
    206206        femmodel->parameters->FindParam(&num_responses,InversionNumCostFunctionsEnum);
    207207        femmodel->parameters->FindParam(&num_controls,InversionNumControlParametersEnum);
    208         femmodel->parameters->FindParam(&scaling_factors,NULL,InversionControlScalingFactorsEnum);
     208        femmodel->parameters->FindParamAndMakePassive(&scaling_factors,NULL,InversionControlScalingFactorsEnum);
    209209        femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
    210210        numberofvertices=femmodel->vertices->NumberOfVertices();
     
    223223                for(int i=0;i<numberofvertices;i++){
    224224                        int index = numberofvertices*c+i;
    225                         X[index] = X[index]*reCast<double>(scaling_factors[c]);
     225                        X[index] = X[index]*scaling_factors[c];
    226226                        if(X[index]>XU[index]) X[index]=XU[index];
    227227                        if(X[index]<XL[index]) X[index]=XL[index];
     
    290290                        if(X[index]>=XU[index]) G[index]=0.;
    291291                        if(X[index]<=XL[index]) G[index]=0.;
    292                         G[index] = G[index]*reCast<double>(scaling_factors[c]);
    293                         X[index] = X[index]/reCast<double>(scaling_factors[c]);
     292                        G[index] = G[index]*scaling_factors[c];
     293                        X[index] = X[index]/scaling_factors[c];
    294294                        Gnorm += G[index]*G[index];
    295295                }
     
    306306        xDelete<double>(XU);
    307307        xDelete<double>(XL);
    308         xDelete<IssmDouble>(scaling_factors);
     308        xDelete<double>(scaling_factors);
    309309}/*}}}*/
    310310
Note: See TracChangeset for help on using the changeset viewer.