commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r676618 - in /commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode: AbstractIntegrator.java nonstiff/EmbeddedRungeKuttaIntegrator.java nonstiff/RungeKuttaIntegrator.java
Date Mon, 14 Jul 2008 15:12:38 GMT
Author: luc
Date: Mon Jul 14 08:12:36 2008
New Revision: 676618

URL: http://svn.apache.org/viewvc?rev=676618&view=rev
Log:
fixed a problem preventing integration stop when end time was exactly 0

Modified:
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/AbstractIntegrator.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/AbstractIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/AbstractIntegrator.java?rev=676618&r1=676617&r2=676618&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/AbstractIntegrator.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/AbstractIntegrator.java
Mon Jul 14 08:12:36 2008
@@ -164,12 +164,14 @@
      * <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 @@
                                        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;
     }
 

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java?rev=676618&r1=676617&r2=676618&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
Mon Jul 14 08:12:36 2008
@@ -198,7 +198,7 @@
     for (StepHandler handler : stepHandlers) {
         handler.reset();
     }
-    CombinedEventsManager manager = addEndTimeChecker(t, eventsHandlersManager);
+    CombinedEventsManager manager = addEndTimeChecker(t0, t, eventsHandlersManager);
     boolean lastStep = false;
 
     // main integration loop

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java?rev=676618&r1=676617&r2=676618&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java
Mon Jul 14 08:12:36 2008
@@ -113,7 +113,7 @@
     for (StepHandler handler : stepHandlers) {
         handler.reset();
     }
-    CombinedEventsManager manager = addEndTimeChecker(t, eventsHandlersManager);
+    CombinedEventsManager manager = addEndTimeChecker(t0, t, eventsHandlersManager);
     boolean lastStep = false;
 
     // main integration loop



Mime
View raw message