fixed a problem preventing integration stop when end time was exactly 0
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/branches/MATH_2_0@676618 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e1306edb51
commit
0c125f71ed
|
@ -164,12 +164,14 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator {
|
|||
* <p>This method can be used to simplify handling of integration end time.
|
||||
* It leverages the nominal stop condition with the exceptional stop
|
||||
* conditions.</p>
|
||||
* @param startTime integration start time
|
||||
* @param endTime desired end time
|
||||
* @param manager manager containing the user-defined handlers
|
||||
* @return a new manager containing all the user-defined handlers plus a
|
||||
* dedicated manager triggering a stop event at entTime
|
||||
*/
|
||||
protected CombinedEventsManager addEndTimeChecker(final double endTime,
|
||||
protected CombinedEventsManager addEndTimeChecker(final double startTime,
|
||||
final double endTime,
|
||||
final CombinedEventsManager manager) {
|
||||
CombinedEventsManager newManager = new CombinedEventsManager();
|
||||
for (final EventState state : manager.getEventsStates()) {
|
||||
|
@ -179,7 +181,9 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator {
|
|||
state.getMaxIterationCount());
|
||||
}
|
||||
newManager.addEventHandler(new EndTimeChecker(endTime),
|
||||
Double.POSITIVE_INFINITY, Math.ulp(endTime), 10);
|
||||
Double.POSITIVE_INFINITY,
|
||||
Math.ulp(Math.max(Math.abs(startTime), Math.abs(endTime))),
|
||||
100);
|
||||
return newManager;
|
||||
}
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ public abstract class EmbeddedRungeKuttaIntegrator
|
|||
for (StepHandler handler : stepHandlers) {
|
||||
handler.reset();
|
||||
}
|
||||
CombinedEventsManager manager = addEndTimeChecker(t, eventsHandlersManager);
|
||||
CombinedEventsManager manager = addEndTimeChecker(t0, t, eventsHandlersManager);
|
||||
boolean lastStep = false;
|
||||
|
||||
// main integration loop
|
||||
|
|
|
@ -113,7 +113,7 @@ public abstract class RungeKuttaIntegrator extends AbstractIntegrator {
|
|||
for (StepHandler handler : stepHandlers) {
|
||||
handler.reset();
|
||||
}
|
||||
CombinedEventsManager manager = addEndTimeChecker(t, eventsHandlersManager);
|
||||
CombinedEventsManager manager = addEndTimeChecker(t0, t, eventsHandlersManager);
|
||||
boolean lastStep = false;
|
||||
|
||||
// main integration loop
|
||||
|
|
Loading…
Reference in New Issue