commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r651282 - in /commons/proper/math/branches/MATH_2_0/src: java/org/apache/commons/math/ode/ site/xdoc/ test/org/apache/commons/math/ode/
Date Thu, 24 Apr 2008 14:44:17 GMT
Author: luc
Date: Thu Apr 24 07:44:00 2008
New Revision: 651282

URL: http://svn.apache.org/viewvc?rev=651282&view=rev
Log:
added the getSwitchingFunctions and clearSwitchingfunctions to the integrator interface
JIRA: MATH-202

Modified:
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/AdaptiveStepsizeIntegrator.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/FirstOrderIntegrator.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/RungeKuttaIntegrator.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/SwitchingFunctionsHandler.java
    commons/proper/math/branches/MATH_2_0/src/site/xdoc/changes.xml
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/ClassicalRungeKuttaIntegratorTest.java
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/DormandPrince54IntegratorTest.java
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/DormandPrince853IntegratorTest.java
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/GraggBulirschStoerIntegratorTest.java
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/HighamHall54IntegratorTest.java

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/AdaptiveStepsizeIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/AdaptiveStepsizeIntegrator.java?rev=651282&r1=651281&r2=651282&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/AdaptiveStepsizeIntegrator.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/AdaptiveStepsizeIntegrator.java
Thu Apr 24 07:44:00 2008
@@ -17,6 +17,8 @@
 
 package org.apache.commons.math.ode;
 
+import java.util.Collection;
+
 /**
  * This abstract class holds the common part of all adaptive
  * stepsize integrators for Ordinary Differential Equations.
@@ -154,12 +156,31 @@
    * @param convergence convergence threshold in the event time search
    * @param maxIterationCount upper limit of the iteration count in
    * the event time search
+   * @see #getSwitchingFunctions()
+   * @see #clearSwitchingFunctions()
    */
   public void addSwitchingFunction(SwitchingFunction function,
                                    double maxCheckInterval,
                                    double convergence,
                                    int maxIterationCount) {
     switchesHandler.add(function, maxCheckInterval, convergence, maxIterationCount);
+  }
+
+  /** Get all the switching functions that have been added to the integrator.
+   * @return an unmodifiable collection of the added switching functions
+   * @see #add(SwitchingFunction, double, double, int)
+   * @see #clearSwitchingFunctions()
+   */
+  public Collection getSwitchingFunctions() {
+      return switchesHandler.getSwitchingFunctions();
+  }
+
+  /** Remove all the switching functions that have been added to the integrator.
+   * @see #add(SwitchingFunction, double, double, int)
+   * @see #getSwitchingFunctions()
+   */
+  public void clearSwitchingFunctions() {
+      switchesHandler.clearSwitchingFunctions();
   }
 
   /** Perform some sanity checks on the integration parameters.

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/FirstOrderIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/FirstOrderIntegrator.java?rev=651282&r1=651281&r2=651282&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/FirstOrderIntegrator.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/FirstOrderIntegrator.java
Thu Apr 24 07:44:00 2008
@@ -17,6 +17,8 @@
 
 package org.apache.commons.math.ode;
 
+import java.util.Collection;
+
 /** This interface represents a first order integrator for
  * differential equations.
 
@@ -59,11 +61,26 @@
    * @param convergence convergence threshold in the event time search
    * @param maxIterationCount upper limit of the iteration count in
    * the event time search
+   * @see #getSwitchingFunctions()
+   * @see #clearSwitchingFunctions()
    */
   public void addSwitchingFunction(SwitchingFunction function,
                                    double maxCheckInterval,
                                    double convergence,
                                    int maxIterationCount);
+
+  /** Get all the switching functions that have been added to the integrator.
+   * @return an unmodifiable collection of the added switching functions
+   * @see #add(SwitchingFunction, double, double, int)
+   * @see #clearSwitchingFunctions()
+   */
+  public Collection getSwitchingFunctions();
+
+  /** Remove all the switching functions that have been added to the integrator.
+   * @see #add(SwitchingFunction, double, double, int)
+   * @see #getSwitchingFunctions()
+   */
+  public void clearSwitchingFunctions();
 
   /** Integrate the differential equations up to the given time.
    * <p>This method solves an Initial Value Problem (IVP).</p>

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/RungeKuttaIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/RungeKuttaIntegrator.java?rev=651282&r1=651281&r2=651282&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/RungeKuttaIntegrator.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/RungeKuttaIntegrator.java
Thu Apr 24 07:44:00 2008
@@ -17,6 +17,8 @@
 
 package org.apache.commons.math.ode;
 
+import java.util.Collection;
+
 /**
  * This class implements the common part of all fixed step Runge-Kutta
  * integrators for Ordinary Differential Equations.
@@ -96,12 +98,31 @@
    * @param convergence convergence threshold in the event time search
    * @param maxIterationCount upper limit of the iteration count in
    * the event time search
+   * @see #getSwitchingFunctions()
+   * @see #clearSwitchingFunctions()
    */
   public void addSwitchingFunction(SwitchingFunction function,
                                    double maxCheckInterval,
                                    double convergence,
                                    int maxIterationCount) {
     switchesHandler.add(function, maxCheckInterval, convergence, maxIterationCount);
+  }
+
+  /** Get all the switching functions that have been added to the integrator.
+   * @return an unmodifiable collection of the added switching functions
+   * @see #add(SwitchingFunction, double, double, int)
+   * @see #clearSwitchingFunctions()
+   */
+  public Collection getSwitchingFunctions() {
+      return switchesHandler.getSwitchingFunctions();
+  }
+
+  /** Remove all the switching functions that have been added to the integrator.
+   * @see #add(SwitchingFunction, double, double, int)
+   * @see #getSwitchingFunctions()
+   */
+  public void clearSwitchingFunctions() {
+      switchesHandler.clearSwitchingFunctions();
   }
 
   /** Perform some sanity checks on the integration parameters.

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/SwitchingFunctionsHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/SwitchingFunctionsHandler.java?rev=651282&r1=651281&r2=651282&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/SwitchingFunctionsHandler.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/SwitchingFunctionsHandler.java
Thu Apr 24 07:44:00 2008
@@ -21,6 +21,8 @@
 import org.apache.commons.math.FunctionEvaluationException;
 
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
@@ -51,11 +53,30 @@
    * @param convergence convergence threshold in the event time search
    * @param maxIterationCount upper limit of the iteration count in
    * the event time search
+   * @see #getSwitchingFunctions()
+   * @see #clearSwitchingFunctions()
    */
   public void add(SwitchingFunction function, double maxCheckInterval,
                   double convergence, int maxIterationCount) {
     functions.add(new SwitchState(function, maxCheckInterval,
                                   convergence, maxIterationCount));
+  }
+
+  /** Get all the switching functions that have been added to the handler.
+   * @return an unmodifiable collection of the added switching functions
+   * @see #add(SwitchingFunction, double, double, int)
+   * @see #clearSwitchingFunctions()
+   */
+  public Collection getSwitchingFunctions() {
+      return Collections.unmodifiableCollection(functions);
+  }
+
+  /** Remove all the switching functions that have been added to the handler.
+   * @see #add(SwitchingFunction, double, double, int)
+   * @see #getSwitchingFunctions()
+   */
+  public void clearSwitchingFunctions() {
+      functions.clear();
   }
 
   /** Check if the handler does not have any condition.

Modified: commons/proper/math/branches/MATH_2_0/src/site/xdoc/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/site/xdoc/changes.xml?rev=651282&r1=651281&r2=651282&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/branches/MATH_2_0/src/site/xdoc/changes.xml Thu Apr 24 07:44:00 2008
@@ -40,6 +40,10 @@
   </properties>
   <body>
     <release version="2.0" date="TBD" description="TBD">
+      <action dev="luc" type="add" issue="MATH-202">
+        Added the getSwitchingFunctions and clearSwitchingFunctions to the
+        FirstOrderIntegrator interface and all its implementations
+      </action>
       <action dev="luc" type="update" >
         Removed deprecated features. This includes the following changes. Factory-based
         instantiation replaced by setter injection in 1.2 in several classes have been

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/ClassicalRungeKuttaIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/ClassicalRungeKuttaIntegratorTest.java?rev=651282&r1=651281&r2=651282&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/ClassicalRungeKuttaIntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/ClassicalRungeKuttaIntegratorTest.java
Thu Apr 24 07:44:00 2008
@@ -88,6 +88,7 @@
           integ.addSwitchingFunction(functions[l],
                                      Double.POSITIVE_INFINITY, 1.0e-6 * step, 1000);
         }
+        assertEquals(functions.length, integ.getSwitchingFunctions().size());
         integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
                         pb.getFinalTime(), new double[pb.getDimension()]);
 
@@ -97,6 +98,8 @@
         }
         previousError = error;
         assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+        integ.clearSwitchingFunctions();
+        assertEquals(0, integ.getSwitchingFunctions().size());
       }
 
     }

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/DormandPrince54IntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/DormandPrince54IntegratorTest.java?rev=651282&r1=651281&r2=651282&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/DormandPrince54IntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/DormandPrince54IntegratorTest.java
Thu Apr 24 07:44:00 2008
@@ -191,6 +191,7 @@
       integ.addSwitchingFunction(functions[l],
                                  Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 1000);
     }
+    assertEquals(functions.length, integ.getSwitchingFunctions().size());
     integ.integrate(pb,
                     pb.getInitialTime(), pb.getInitialState(),
                     pb.getFinalTime(), new double[pb.getDimension()]);
@@ -198,6 +199,8 @@
     assertTrue(handler.getMaximalValueError() < 5.0e-6);
     assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
     assertEquals(12.0, handler.getLastTime(), 1.0e-8 * maxStep);
+    integ.clearSwitchingFunctions();
+    assertEquals(0, integ.getSwitchingFunctions().size());
 
   }
 

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/DormandPrince853IntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/DormandPrince853IntegratorTest.java?rev=651282&r1=651281&r2=651282&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/DormandPrince853IntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/DormandPrince853IntegratorTest.java
Thu Apr 24 07:44:00 2008
@@ -144,6 +144,7 @@
       integ.addSwitchingFunction(functions[l],
                                  Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 1000);
     }
+    assertEquals(functions.length, integ.getSwitchingFunctions().size());
     integ.integrate(pb,
                     pb.getInitialTime(), pb.getInitialState(),
                     pb.getFinalTime(), new double[pb.getDimension()]);
@@ -151,6 +152,8 @@
     assertTrue(handler.getMaximalValueError() < 5.0e-8);
     assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
     assertEquals(12.0, handler.getLastTime(), 1.0e-8 * maxStep);
+    integ.clearSwitchingFunctions();
+    assertEquals(0, integ.getSwitchingFunctions().size());
 
   }
 

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/GraggBulirschStoerIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/GraggBulirschStoerIntegratorTest.java?rev=651282&r1=651281&r2=651282&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/GraggBulirschStoerIntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/GraggBulirschStoerIntegratorTest.java
Thu Apr 24 07:44:00 2008
@@ -184,6 +184,7 @@
       integ.addSwitchingFunction(functions[l],
                                  Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 1000);
     }
+    assertEquals(functions.length, integ.getSwitchingFunctions().size());
     integ.integrate(pb,
                     pb.getInitialTime(), pb.getInitialState(),
                     pb.getFinalTime(), new double[pb.getDimension()]);
@@ -191,6 +192,8 @@
     assertTrue(handler.getMaximalValueError() < 5.0e-8);
     assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
     assertEquals(12.0, handler.getLastTime(), 1.0e-8 * maxStep);
+    integ.clearSwitchingFunctions();
+    assertEquals(0, integ.getSwitchingFunctions().size());
 
   }
 

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/HighamHall54IntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/HighamHall54IntegratorTest.java?rev=651282&r1=651281&r2=651282&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/HighamHall54IntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/HighamHall54IntegratorTest.java
Thu Apr 24 07:44:00 2008
@@ -153,6 +153,7 @@
       integ.addSwitchingFunction(functions[l],
                                  Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 1000);
     }
+    assertEquals(functions.length, integ.getSwitchingFunctions().size());
     integ.integrate(pb,
                     pb.getInitialTime(), pb.getInitialState(),
                     pb.getFinalTime(), new double[pb.getDimension()]);
@@ -160,6 +161,8 @@
     assertTrue(handler.getMaximalValueError() < 1.0e-7);
     assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
     assertEquals(12.0, handler.getLastTime(), 1.0e-8 * maxStep);
+    integ.clearSwitchingFunctions();
+    assertEquals(0, integ.getSwitchingFunctions().size());
 
   }
 



Mime
View raw message