You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2015/11/15 10:27:30 UTC

[math] Added init methods for primary and secondary ODE.

Repository: commons-math
Updated Branches:
  refs/heads/field-ode 136f644e2 -> 70e48a02d


Added init methods for primary and secondary ODE.

This addition is for consistency with other user-implemented interfaces
as step handlers and event handlers. However, since the equations have
only the state as input and the produce derivatives as output, their
init method also only uses state, as derivatives can be computed only
after equations have been initialized, not before.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/70e48a02
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/70e48a02
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/70e48a02

Branch: refs/heads/field-ode
Commit: 70e48a02d0cbc862372ce21dca457c50fe2227b3
Parents: 136f644
Author: Luc Maisonobe <lu...@apache.org>
Authored: Sun Nov 15 10:27:10 2015 +0100
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Sun Nov 15 10:27:10 2015 +0100

----------------------------------------------------------------------
 .../ode/FieldFirstOrderDifferentialEquations.java      | 12 ++++++++++++
 .../commons/math3/ode/FieldSecondaryEquations.java     | 13 +++++++++++++
 2 files changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/70e48a02/src/main/java/org/apache/commons/math3/ode/FieldFirstOrderDifferentialEquations.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/FieldFirstOrderDifferentialEquations.java b/src/main/java/org/apache/commons/math3/ode/FieldFirstOrderDifferentialEquations.java
index 63c14a5..887451b 100644
--- a/src/main/java/org/apache/commons/math3/ode/FieldFirstOrderDifferentialEquations.java
+++ b/src/main/java/org/apache/commons/math3/ode/FieldFirstOrderDifferentialEquations.java
@@ -51,6 +51,18 @@ public interface FieldFirstOrderDifferentialEquations<T extends RealFieldElement
      */
     int getDimension();
 
+    /** Initialize equations at the start of an ODE integration.
+     * <p>
+     * This method is called once at the start of the integration. It
+     * may be used by the equations to initialize some internal data
+     * if needed.
+     * </p>
+     * @param t0 value of the independent <I>time</I> variable at integration start
+     * @param y0 array containing the value of the state vector at integration start
+     * @param finalTime target time for the integration
+     */
+    void init(T t0, T[] y0, T finalTime);
+
     /** Get the current time derivative of the state vector.
      * @param t current value of the independent <I>time</I> variable
      * @param y array containing the current value of the state vector

http://git-wip-us.apache.org/repos/asf/commons-math/blob/70e48a02/src/main/java/org/apache/commons/math3/ode/FieldSecondaryEquations.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/FieldSecondaryEquations.java b/src/main/java/org/apache/commons/math3/ode/FieldSecondaryEquations.java
index 073f7cf..32e0abe 100644
--- a/src/main/java/org/apache/commons/math3/ode/FieldSecondaryEquations.java
+++ b/src/main/java/org/apache/commons/math3/ode/FieldSecondaryEquations.java
@@ -47,6 +47,19 @@ public interface FieldSecondaryEquations<T extends RealFieldElement<T>> {
      */
     int getDimension();
 
+    /** Initialize equations at the start of an ODE integration.
+     * <p>
+     * This method is called once at the start of the integration. It
+     * may be used by the equations to initialize some internal data
+     * if needed.
+     * </p>
+     * @param t0 value of the independent <I>time</I> variable at integration start
+     * @param primary0 array containing the value of the primary state vector at integration start
+     * @param secondary0 array containing the value of the secondary state vector at integration start
+     * @param finalTime target time for the integration
+     */
+    void init(T t0, T[] primary0, T[] secondary0, T finalTime);
+
     /** Compute the derivatives related to the secondary state parameters.
      * @param t current value of the independent <I>time</I> variable
      * @param primary array containing the current value of the primary state vector