Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qucsator : avoid taking a time step that will bring too close to a breakpoint. #202

Merged
merged 1 commit into from
Jan 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions qucs-core/src/trsolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,18 +643,32 @@ void trsolver::adjustDelta (nr_double_t t)
}
else
{
if (delta > (t - current) && t > current)
// check whether this step will bring too close to a breakpoint
// is ok if the step will go past the breakpoint, this is handled by
// the next branch
if ((t - (current + delta) < deltaMin) && ((current + delta) < t))
{
// save last valid delta and set exact step
stepDelta = deltaOld;
delta = t - current;
good = 1;
}
// if we take this delta we will end up too close to the breakpoint
// and next step will be very tiny, possibly causing numerical issues
// so reduce it so that next step will likely not end up too close
// to the breakpoint
delta /= 2.0;
}
else
{
stepDelta = -1.0;
{
if (delta > (t - current) && t > current)
{
// save last valid delta and set exact step
stepDelta = deltaOld;
delta = t - current;
good = 1;
}
else
{
stepDelta = -1.0;
}
}
}
}
if (delta > deltaMax) delta = deltaMax;
if (delta < deltaMin) delta = deltaMin;
}
Expand Down