CSolveCap::SolveMain()'s auto-refinement (-a) loop only assigns
capRe/capIm on its convergence break:
if(diff <= globalVars.m_dAutoMaxErr) {
capRe = cRe[i];
capIm = cIm[i];
break;
}
That's the only assignment in the loop. If it runs out all
SOLVE_MAX_AUTO_ITERATIONS rounds without ever hitting this break,
the loop just ends and the function returns ret, still holding
FC_NORMAL_END from the last SolveForCapacitance() call --
"success," with an output matrix that was never populated for that
run. Nothing distinguishes this from a real convergence.
Fix: populate capRe/capIm with the last computed iteration and
return a new, distinct code (FC_CONVERGENCE_FAILED) instead.
CSolveCap::SolveMain()'s auto-refinement (-a) loop only assignscapRe/capImon its convergence break:That's the only assignment in the loop. If it runs out all
SOLVE_MAX_AUTO_ITERATIONSrounds without ever hitting this break,the loop just ends and the function returns
ret, still holdingFC_NORMAL_ENDfrom the lastSolveForCapacitance()call --"success," with an output matrix that was never populated for that
run. Nothing distinguishes this from a real convergence.
Fix: populate
capRe/capImwith the last computed iteration andreturn a new, distinct code (
FC_CONVERGENCE_FAILED) instead.