Skip to content

Commit

Permalink
some fixes from static analysis
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@22423 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Vitalij Ruge committed Sep 23, 2014
1 parent 351ba91 commit f1353a1
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions SimulationRuntime/c/optimization/eval_all/EvalG.c
Expand Up @@ -675,7 +675,9 @@ static inline void printMaxError(Number *g, const int m, const int nx, const int
}
}
for(; k< nJ; ++k, ++l){
tmp = fmax(fabs(g[l] - optData->ipop.gmax[l]), fabs(g[l] - optData->ipop.gmin[l]));
tmp1 = g[l] > optData->ipop.gmax[l] ? fabs(g[l] - optData->ipop.gmax[l]) : 0.0;
tmp = g[l] < optData->ipop.gmin[l] ? fabs(g[l] - optData->ipop.gmin[l]) : 0.0;
tmp = fmax(tmp, tmp1);
if(tmp > gmax){
ii = i;
jj = j;
Expand Down Expand Up @@ -708,15 +710,15 @@ static inline void printMaxError(Number *g, const int m, const int nx, const int
}
*/
}

if(kk < nx){
printf("\nmax error for |%s(%g) - collocation_poly| = %g\n",
if(k>0){
if(kk < nx){
printf("\nmax error for |%s(%g) - collocation_poly| = %g\n",
data->modelData.realVarsData[kk].info.name, (double)t[ii][jj], gmax);
}else if(kk < nJ){
printf("\nmax error for |cosntrain[%i](%g)| = %g\n", kk - nx, (double)t[ii][jj], gmax);
}else{
printf("\nmax error for |final_cosntrain[%i](%g)| = %g\n", kk - nJ, (double)t[ii][jj], gmax);
}else if(kk < nJ){
printf("\nmax error for |cosntrain[%i](%g)| = %g\n", kk - nx, (double)t[ii][jj], gmax);
}else{
printf("\nmax error for |final_cosntrain[%i](%g)| = %g\n", kk - nJ, (double)t[ii][jj], gmax);
}
}


}

0 comments on commit f1353a1

Please sign in to comment.