Changeset 23307
- Timestamp:
- 09/18/18 09:26:24 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/cores/controlm1qn3_core.cpp
r23306 r23307 39 39 40 40 /*Intermediaries*/ 41 long 42 double 43 int 44 int 45 IssmDouble*scaling_factors = NULL;46 double 47 double 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; 48 48 49 49 /*Recover some parameters*/ … … 93 93 for(int i=0;i<numberofvertices;i++){ 94 94 int index = numberofvertices*c+i; 95 X[index] = X[index]/ reCast<double>(scaling_factors[c]);95 X[index] = X[index]/scaling_factors[c]; 96 96 } 97 97 } … … 148 148 for(int i=0;i<numberofvertices;i++){ 149 149 int index = numberofvertices*c+i; 150 X[index] = X[index]* reCast<double>(scaling_factors[c]);150 X[index] = X[index]*scaling_factors[c]; 151 151 if(X[index]>XU[index]) X[index]=XU[index]; 152 152 if(X[index]<XL[index]) X[index]=XL[index]; … … 187 187 xDelete<double>(XU); 188 188 xDelete<double>(XL); 189 xDelete< IssmDouble>(scaling_factors);189 xDelete<double>(scaling_factors); 190 190 xDelete<double>(mystruct.Jlist); 191 191 xDelete<int>(mystruct.i); … … 203 203 /*Recover some parameters*/ 204 204 int num_responses,num_controls,numberofvertices,solution_type; 205 IssmDouble* scaling_factors = NULL;205 double* scaling_factors = NULL; 206 206 femmodel->parameters->FindParam(&num_responses,InversionNumCostFunctionsEnum); 207 207 femmodel->parameters->FindParam(&num_controls,InversionNumControlParametersEnum); 208 femmodel->parameters->FindParam (&scaling_factors,NULL,InversionControlScalingFactorsEnum);208 femmodel->parameters->FindParamAndMakePassive(&scaling_factors,NULL,InversionControlScalingFactorsEnum); 209 209 femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum); 210 210 numberofvertices=femmodel->vertices->NumberOfVertices(); … … 223 223 for(int i=0;i<numberofvertices;i++){ 224 224 int index = numberofvertices*c+i; 225 X[index] = X[index]* reCast<double>(scaling_factors[c]);225 X[index] = X[index]*scaling_factors[c]; 226 226 if(X[index]>XU[index]) X[index]=XU[index]; 227 227 if(X[index]<XL[index]) X[index]=XL[index]; … … 290 290 if(X[index]>=XU[index]) G[index]=0.; 291 291 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]; 294 294 Gnorm += G[index]*G[index]; 295 295 } … … 306 306 xDelete<double>(XU); 307 307 xDelete<double>(XL); 308 xDelete< IssmDouble>(scaling_factors);308 xDelete<double>(scaling_factors); 309 309 }/*}}}*/ 310 310
Note:
See TracChangeset
for help on using the changeset viewer.