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/29 18:10:22 UTC

[2/5] [math] Removed step interpolator prototyping.

Removed step interpolator prototyping.

We can just use a factory method in the integrator for building an
interpolator each time we integrate.

In the long term, we will even recreate it at each step so the
interpolator can be immutable.

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

Branch: refs/heads/field-ode
Commit: 449e071b055b439d30c466dd844b2c3e36dff992
Parents: 9672bdf
Author: Luc Maisonobe <lu...@apache.org>
Authored: Sun Nov 29 18:07:17 2015 +0100
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Sun Nov 29 18:07:17 2015 +0100

----------------------------------------------------------------------
 .../sampling/AbstractFieldStepInterpolator.java | 61 +++-----------------
 1 file changed, 8 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/449e071b/src/main/java/org/apache/commons/math3/ode/sampling/AbstractFieldStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/sampling/AbstractFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/sampling/AbstractFieldStepInterpolator.java
index aa95034..bb3d722 100644
--- a/src/main/java/org/apache/commons/math3/ode/sampling/AbstractFieldStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math3/ode/sampling/AbstractFieldStepInterpolator.java
@@ -68,47 +68,21 @@ public abstract class AbstractFieldStepInterpolator<T extends RealFieldElement<T
     private FieldEquationsMapper<T> mapper;
 
     /** Simple constructor.
-     * This constructor builds an instance that is not usable yet, the
-     * {@link #reinitialize} method should be called before using the
-     * instance in order to initialize the internal arrays. This
-     * constructor is used only in order to delay the initialization in
-     * some cases. As an example, the {@link
-     * org.apache.commons.math3.ode.nonstiff.EmbeddedRungeKuttaIntegrator}
-     * class uses the prototyping design pattern to create the step
-     * interpolators by cloning an uninitialized model and latter
-     * initializing the copy.
-     */
-    protected AbstractFieldStepInterpolator() {
-        globalPreviousState = null;
-        globalCurrentState  = null;
-        softPreviousState   = null;
-        softCurrentState    = null;
-        h                   = null;
-        currentState        = null;
-        finalized           = false;
-        forward             = true;
-        mapper              = null;
-    }
-
-    /** Simple constructor.
-     * @param y reference to the integrator array holding the state at
-     * the end of the step
-     * @param forward integration direction indicator
-     * @param mapper mapper for ODE equations primary and secondary components
+     * @param y reference to the integrator array holding the state at the end of the step
+     * @param isForward integration direction indicator
+     * @param equationsMapper mapper for ODE equations primary and secondary components
      */
-    protected AbstractFieldStepInterpolator(final T[] y, final boolean forward,
-                                            final FieldEquationsMapper<T> mapper) {
-
+    protected AbstractFieldStepInterpolator(final T[] y, final boolean isForward,
+                                            final FieldEquationsMapper<T> equationsMapper) {
         globalPreviousState = null;
         globalCurrentState  = null;
         softPreviousState   = null;
         softCurrentState    = null;
         h                   = null;
-        currentState        = y;
+        currentState        = y.clone();
         finalized           = false;
-        this.forward        = forward;
-        this.mapper         = mapper;
-
+        this.forward        = isForward;
+        this.mapper         = equationsMapper;
     }
 
     /** Copy constructor.
@@ -149,25 +123,6 @@ public abstract class AbstractFieldStepInterpolator<T extends RealFieldElement<T
 
     }
 
-    /** Reinitialize the instance
-     * @param y reference to the integrator array holding the state at the end of the step
-     * @param isForward integration direction indicator
-     * @param equationsMapper mapper for ODE equations primary and secondary components
-     */
-    protected void reinitialize(final T[] y, final boolean isForward, final FieldEquationsMapper<T> equationsMapper) {
-
-        globalPreviousState = null;
-        globalCurrentState  = null;
-        softPreviousState   = null;
-        softCurrentState    = null;
-        h                   = null;
-        currentState        = y.clone();
-        finalized           = false;
-        this.forward        = isForward;
-        this.mapper         = equationsMapper;
-
-    }
-
     /** {@inheritDoc} */
     public FieldStepInterpolator<T> copy() throws MaxCountExceededException {