Repository: commons-math
Updated Branches:
refs/heads/field-ode 87664da98 -> e269953c4
Reduced coupling between integrators and step interpolators.
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/d1d22013
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/d1d22013
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/d1d22013
Branch: refs/heads/field-ode
Commit: d1d220138af07a2e1e7dc7b9b0a4d22b5a8b249d
Parents: 87664da
Author: Luc Maisonobe
Authored: Tue Dec 1 13:30:05 2015 +0100
Committer: Luc Maisonobe
Committed: Tue Dec 1 13:30:05 2015 +0100
----------------------------------------------------------------------
.../ClassicalRungeKuttaFieldIntegrator.java | 2 +-
...lassicalRungeKuttaFieldStepInterpolator.java | 11 ++-
.../DormandPrince54FieldIntegrator.java | 2 +-
.../DormandPrince54FieldStepInterpolator.java | 21 +++--
.../DormandPrince853FieldIntegrator.java | 2 +-
.../DormandPrince853FieldStepInterpolator.java | 63 +++++++-------
.../ode/nonstiff/EulerFieldIntegrator.java | 2 +-
.../nonstiff/EulerFieldStepInterpolator.java | 15 ++--
.../math3/ode/nonstiff/GillFieldIntegrator.java | 2 +-
.../ode/nonstiff/GillFieldStepInterpolator.java | 11 ++-
.../nonstiff/HighamHall54FieldIntegrator.java | 2 +-
.../HighamHall54FieldStepInterpolator.java | 15 ++--
.../ode/nonstiff/LutherFieldIntegrator.java | 2 +-
.../nonstiff/LutherFieldStepInterpolator.java | 17 ++--
.../ode/nonstiff/MidpointFieldIntegrator.java | 2 +-
.../nonstiff/MidpointFieldStepInterpolator.java | 11 ++-
.../RungeKuttaFieldStepInterpolator.java | 41 ++++-----
.../nonstiff/ThreeEighthesFieldIntegrator.java | 2 +-
.../ThreeEighthesFieldStepInterpolator.java | 9 +-
.../sampling/AbstractFieldStepInterpolator.java | 89 +-------------------
20 files changed, 109 insertions(+), 212 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java
index 064b56d..e5116e8 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java
@@ -101,7 +101,7 @@ public class ClassicalRungeKuttaFieldIntegrator>
@Override
protected ClassicalRungeKuttaFieldStepInterpolator
createInterpolator(final boolean forward, final FieldEquationsMapper mapper) {
- return new ClassicalRungeKuttaFieldStepInterpolator(this, forward, mapper);
+ return new ClassicalRungeKuttaFieldStepInterpolator(getField(), forward, mapper);
}
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldStepInterpolator.java
index fc56870..74c220d 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldStepInterpolator.java
@@ -17,8 +17,8 @@
package org.apache.commons.math3.ode.nonstiff;
+import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.ode.AbstractFieldIntegrator;
import org.apache.commons.math3.ode.FieldEquationsMapper;
import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
@@ -60,14 +60,13 @@ class ClassicalRungeKuttaFieldStepInterpolator>
extends RungeKuttaFieldStepInterpolator {
/** Simple constructor.
- * @param rkIntegrator integrator being used
+ * @param field field to which the time and state vector elements belong
* @param forward integration direction indicator
* @param mapper equations mapper for the all equations
*/
- ClassicalRungeKuttaFieldStepInterpolator(final AbstractFieldIntegrator rkIntegrator,
- final boolean forward,
+ ClassicalRungeKuttaFieldStepInterpolator(final Field field, final boolean forward,
final FieldEquationsMapper mapper) {
- super(rkIntegrator, forward, mapper);
+ super(field, forward, mapper);
}
/** Copy constructor.
@@ -92,7 +91,7 @@ class ClassicalRungeKuttaFieldStepInterpolator>
final T time, final T theta,
final T oneMinusThetaH) {
- final T one = time.getField().getOne();
+ final T one = getField().getOne();
final T oneMinusTheta = one.subtract(theta);
final T oneMinus2Theta = one.subtract(theta.multiply(2));
final T coeffDot1 = oneMinusTheta.multiply(oneMinus2Theta);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java
index 09bbc4a..2b01bdb 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java
@@ -190,7 +190,7 @@ public class DormandPrince54FieldIntegrator>
@Override
protected DormandPrince54FieldStepInterpolator
createInterpolator(final boolean forward, final FieldEquationsMapper mapper) {
- return new DormandPrince54FieldStepInterpolator(this, forward, mapper);
+ return new DormandPrince54FieldStepInterpolator(getField(), forward, mapper);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolator.java
index 23ba0e9..ca7e6c7 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolator.java
@@ -17,8 +17,8 @@
package org.apache.commons.math3.ode.nonstiff;
+import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.ode.AbstractFieldIntegrator;
import org.apache.commons.math3.ode.FieldEquationsMapper;
import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
@@ -73,15 +73,14 @@ class DormandPrince54FieldStepInterpolator>
private final T d6;
/** Simple constructor.
- * @param rkIntegrator integrator being used
+ * @param field field to which the time and state vector elements belong
* @param forward integration direction indicator
* @param mapper equations mapper for the all equations
*/
- DormandPrince54FieldStepInterpolator(final AbstractFieldIntegrator rkIntegrator,
- final boolean forward,
+ DormandPrince54FieldStepInterpolator(final Field field, final boolean forward,
final FieldEquationsMapper mapper) {
- super(rkIntegrator, forward, mapper);
- final T one = rkIntegrator.getField().getOne();
+ super(field, forward, mapper);
+ final T one = field.getOne();
a70 = one.multiply( 35.0).divide( 384.0);
a72 = one.multiply( 500.0).divide(1113.0);
a73 = one.multiply( 125.0).divide( 192.0);
@@ -131,7 +130,7 @@ class DormandPrince54FieldStepInterpolator>
final T oneMinusThetaH) {
// interpolate
- final T one = theta.getField().getOne();
+ final T one = getField().getOne();
final T eta = one.subtract(theta);
final T twoTheta = theta.multiply(2);
final T dot2 = one.subtract(twoTheta);
@@ -148,7 +147,7 @@ class DormandPrince54FieldStepInterpolator>
subtract(f2.multiply(a70.subtract(1))).
add(f3.multiply(a70.multiply(2).subtract(1))).
add(f4.multiply(d0));
- final T coeff1 = theta.getField().getZero();
+ final T coeff1 = getField().getZero();
final T coeff2 = f1.multiply(a72).
subtract(f2.multiply(a72)).
add(f3.multiply(a72.multiply(2))).
@@ -170,7 +169,7 @@ class DormandPrince54FieldStepInterpolator>
subtract(dot2.multiply(a70.subtract(1))).
add(dot3.multiply(a70.multiply(2).subtract(1))).
add(dot4.multiply(d0));
- final T coeffDot1 = theta.getField().getZero();
+ final T coeffDot1 = getField().getZero();
final T coeffDot2 = a72.
subtract(dot2.multiply(a72)).
add(dot3.multiply(a72.multiply(2))).
@@ -201,7 +200,7 @@ class DormandPrince54FieldStepInterpolator>
subtract(f2.multiply(a70.subtract(1))).
add(f3.multiply(a70.multiply(2).subtract(1))).
add(f4.multiply(d0));
- final T coeff1 = theta.getField().getZero();
+ final T coeff1 = getField().getZero();
final T coeff2 = f1.multiply(a72).
subtract(f2.multiply(a72)).
add(f3.multiply(a72.multiply(2))).
@@ -223,7 +222,7 @@ class DormandPrince54FieldStepInterpolator>
subtract(dot2.multiply(a70.subtract(1))).
add(dot3.multiply(a70.multiply(2).subtract(1))).
add(dot4.multiply(d0));
- final T coeffDot1 = theta.getField().getZero();
+ final T coeffDot1 = getField().getZero();
final T coeffDot2 = a72.
subtract(dot2.multiply(a72)).
add(dot3.multiply(a72.multiply(2))).
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java
index 569cba4..86b3844 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java
@@ -396,7 +396,7 @@ public class DormandPrince853FieldIntegrator>
@Override
protected DormandPrince853FieldStepInterpolator
createInterpolator(final boolean forward, final FieldEquationsMapper mapper) {
- return new DormandPrince853FieldStepInterpolator(this, forward, mapper);
+ return new DormandPrince853FieldStepInterpolator(getField(), forward, mapper);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
index 7c1cdf5..182d8a6 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
@@ -17,9 +17,9 @@
package org.apache.commons.math3.ode.nonstiff;
+import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.ode.AbstractFieldIntegrator;
import org.apache.commons.math3.ode.FieldEquationsMapper;
import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
import org.apache.commons.math3.util.MathArrays;
@@ -43,24 +43,23 @@ class DormandPrince853FieldStepInterpolator>
private final T[][] d;
/** Simple constructor.
- * @param rkIntegrator integrator being used
+ * @param field field to which the time and state vector elements belong
* @param forward integration direction indicator
* @param mapper equations mapper for the all equations
*/
- DormandPrince853FieldStepInterpolator(final AbstractFieldIntegrator rkIntegrator,
- final boolean forward,
+ DormandPrince853FieldStepInterpolator(final Field field, final boolean forward,
final FieldEquationsMapper mapper) {
- super(rkIntegrator, forward, mapper);
+ super(field, forward, mapper);
// interpolation weights
- d = MathArrays.buildArray(integrator.getField(), 4, 16);
+ d = MathArrays.buildArray(getField(), 4, 16);
// this row is the same as the b array
d[0][ 0] = fraction(104257, 1929240);
- d[0][ 1] = integrator.getField().getZero();
- d[0][ 2] = integrator.getField().getZero();
- d[0][ 3] = integrator.getField().getZero();
- d[0][ 4] = integrator.getField().getZero();
+ d[0][ 1] = getField().getZero();
+ d[0][ 2] = getField().getZero();
+ d[0][ 3] = getField().getZero();
+ d[0][ 4] = getField().getZero();
d[0][ 5] = fraction( 3399327.0, 763840.0);
d[0][ 6] = fraction( 66578432.0, 35198415.0);
d[0][ 7] = fraction( -1674902723.0, 288716400.0);
@@ -68,10 +67,10 @@ class DormandPrince853FieldStepInterpolator>
d[0][ 9] = fraction( -734375.0, 4826304.0);
d[0][10] = fraction( 171414593.0, 851261400.0);
d[0][11] = fraction( 137909.0, 3084480.0);
- d[0][12] = integrator.getField().getZero();
- d[0][13] = integrator.getField().getZero();
- d[0][14] = integrator.getField().getZero();
- d[0][15] = integrator.getField().getZero();
+ d[0][12] = getField().getZero();
+ d[0][13] = getField().getZero();
+ d[0][14] = getField().getZero();
+ d[0][15] = getField().getZero();
d[1][ 0] = d[0][ 0].negate().add(1);
d[1][ 1] = d[0][ 1].negate();
@@ -108,10 +107,10 @@ class DormandPrince853FieldStepInterpolator>
d[2][15] = d[0][15].multiply(2); // really 0
d[3][ 0] = fraction( -17751989329.0, 2106076560.0);
- d[3][ 1] = integrator.getField().getZero();
- d[3][ 2] = integrator.getField().getZero();
- d[3][ 3] = integrator.getField().getZero();
- d[3][ 4] = integrator.getField().getZero();
+ d[3][ 1] = getField().getZero();
+ d[3][ 2] = getField().getZero();
+ d[3][ 3] = getField().getZero();
+ d[3][ 4] = getField().getZero();
d[3][ 5] = fraction( 4272954039.0, 7539864640.0);
d[3][ 6] = fraction( -118476319744.0, 38604839385.0);
d[3][ 7] = fraction( 755123450731.0, 316657731600.0);
@@ -125,10 +124,10 @@ class DormandPrince853FieldStepInterpolator>
d[3][15] = fraction( -1944542619.0, 438351368.0);
d[4][ 0] = fraction( 32941697297.0, 3159114840.0);
- d[4][ 1] = integrator.getField().getZero();
- d[4][ 2] = integrator.getField().getZero();
- d[4][ 3] = integrator.getField().getZero();
- d[4][ 4] = integrator.getField().getZero();
+ d[4][ 1] = getField().getZero();
+ d[4][ 2] = getField().getZero();
+ d[4][ 3] = getField().getZero();
+ d[4][ 4] = getField().getZero();
d[4][ 5] = fraction( 456696183123.0, 1884966160.0);
d[4][ 6] = fraction( 19132610714624.0, 115814518155.0);
d[4][ 7] = fraction( -177904688592943.0, 474986597400.0);
@@ -142,10 +141,10 @@ class DormandPrince853FieldStepInterpolator>
d[4][15] = fraction( 15700361463.0, 438351368.0);
d[5][ 0] = fraction( 12627015655.0, 631822968.0);
- d[5][ 1] = integrator.getField().getZero();
- d[5][ 2] = integrator.getField().getZero();
- d[5][ 3] = integrator.getField().getZero();
- d[5][ 4] = integrator.getField().getZero();
+ d[5][ 1] = getField().getZero();
+ d[5][ 2] = getField().getZero();
+ d[5][ 3] = getField().getZero();
+ d[5][ 4] = getField().getZero();
d[5][ 5] = fraction( -72955222965.0, 188496616.0);
d[5][ 6] = fraction( -13145744952320.0, 69488710893.0);
d[5][ 7] = fraction( 30084216194513.0, 56998391688.0);
@@ -159,10 +158,10 @@ class DormandPrince853FieldStepInterpolator>
d[5][15] = fraction( 5256837225.0, 438351368.0);
d[6][ 0] = fraction( -450944925.0, 17550638.0);
- d[6][ 1] = integrator.getField().getZero();
- d[6][ 2] = integrator.getField().getZero();
- d[6][ 3] = integrator.getField().getZero();
- d[6][ 4] = integrator.getField().getZero();
+ d[6][ 1] = getField().getZero();
+ d[6][ 2] = getField().getZero();
+ d[6][ 3] = getField().getZero();
+ d[6][ 4] = getField().getZero();
d[6][ 5] = fraction( -14532122925.0, 94248308.0);
d[6][ 6] = fraction( -595876966400.0, 2573655959.0);
d[6][ 7] = fraction( 188748653015.0, 527762886.0);
@@ -186,7 +185,7 @@ class DormandPrince853FieldStepInterpolator>
super(interpolator);
- d = MathArrays.buildArray(integrator.getField(), 4, -1);
+ d = MathArrays.buildArray(getField(), 4, -1);
for (int i = 0; i < d.length; ++i) {
d[i] = interpolator.d[i].clone();
}
@@ -199,7 +198,7 @@ class DormandPrince853FieldStepInterpolator>
* @return p/q computed in the instance field
*/
private T fraction(final double p, final double q) {
- return integrator.getField().getOne().multiply(p).divide(q);
+ return getField().getOne().multiply(p).divide(q);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java
index 4c58e09..798c0e9 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java
@@ -86,7 +86,7 @@ public class EulerFieldIntegrator> extends RungeKu
@Override
protected EulerFieldStepInterpolator
createInterpolator(final boolean forward, final FieldEquationsMapper mapper) {
- return new EulerFieldStepInterpolator(this, forward, mapper);
+ return new EulerFieldStepInterpolator(getField(), forward, mapper);
}
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java
index 9bff5f2..e822166 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java
@@ -17,8 +17,8 @@
package org.apache.commons.math3.ode.nonstiff;
+import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.ode.AbstractFieldIntegrator;
import org.apache.commons.math3.ode.FieldEquationsMapper;
import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
@@ -50,14 +50,13 @@ class EulerFieldStepInterpolator>
extends RungeKuttaFieldStepInterpolator {
/** Simple constructor.
- * @param rkIntegrator integrator being used
+ * @param field field to which the time and state vector elements belong
* @param forward integration direction indicator
* @param mapper equations mapper for the all equations
*/
- EulerFieldStepInterpolator(final AbstractFieldIntegrator rkIntegrator,
- final boolean forward,
+ EulerFieldStepInterpolator(final Field field, final boolean forward,
final FieldEquationsMapper mapper) {
- super(rkIntegrator, forward, mapper);
+ super(field, forward, mapper);
}
/** Copy constructor.
@@ -83,12 +82,12 @@ class EulerFieldStepInterpolator>
final T oneMinusThetaH) {
final T[] interpolatedState;
final T[] interpolatedDerivatives;
- if ((getGlobalPreviousState() != null) && (theta.getReal() <= 0.5)) {
+ if (getGlobalPreviousState() != null && theta.getReal() <= 0.5) {
interpolatedState = previousStateLinearCombination(theta.multiply(h));
- interpolatedDerivatives = derivativeLinearCombination(time.getField().getOne());
+ interpolatedDerivatives = derivativeLinearCombination(getField().getOne());
} else {
interpolatedState = currentStateLinearCombination(oneMinusThetaH.negate());
- interpolatedDerivatives = derivativeLinearCombination(time.getField().getOne());
+ interpolatedDerivatives = derivativeLinearCombination(getField().getOne());
}
return new FieldODEStateAndDerivative(time, interpolatedState, interpolatedDerivatives);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegrator.java
index 659eee8..53d6872 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegrator.java
@@ -111,7 +111,7 @@ public class GillFieldIntegrator>
@Override
protected GillFieldStepInterpolator
createInterpolator(final boolean forward, final FieldEquationsMapper mapper) {
- return new GillFieldStepInterpolator(this, forward, mapper);
+ return new GillFieldStepInterpolator(getField(), forward, mapper);
}
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldStepInterpolator.java
index 8990dc5..b9fe15a 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldStepInterpolator.java
@@ -17,8 +17,8 @@
package org.apache.commons.math3.ode.nonstiff;
+import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.ode.AbstractFieldIntegrator;
import org.apache.commons.math3.ode.FieldEquationsMapper;
import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
import org.apache.commons.math3.util.FastMath;
@@ -66,14 +66,13 @@ class GillFieldStepInterpolator>
private static final double ONE_PLUS_INV_SQRT_2 = 1 + FastMath.sqrt(0.5);
/** Simple constructor.
- * @param rkIntegrator integrator being used
+ * @param field field to which the time and state vector elements belong
* @param forward integration direction indicator
* @param mapper equations mapper for the all equations
*/
- GillFieldStepInterpolator(final AbstractFieldIntegrator rkIntegrator,
- final boolean forward,
+ GillFieldStepInterpolator(final Field field, final boolean forward,
final FieldEquationsMapper mapper) {
- super(rkIntegrator, forward, mapper);
+ super(field, forward, mapper);
}
/** Copy constructor.
@@ -99,7 +98,7 @@ class GillFieldStepInterpolator>
final T time, final T theta,
final T oneMinusThetaH) {
- final T one = time.getField().getOne();
+ final T one = getField().getOne();
final T twoTheta = theta.multiply(2);
final T fourTheta2 = twoTheta.multiply(twoTheta);
final T coeffDot1 = theta.multiply(twoTheta.subtract(3)).add(1);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegrator.java
index 8ee90b7..8473892 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegrator.java
@@ -165,7 +165,7 @@ public class HighamHall54FieldIntegrator>
@Override
protected HighamHall54FieldStepInterpolator
createInterpolator(final boolean forward, final FieldEquationsMapper mapper) {
- return new HighamHall54FieldStepInterpolator(this, forward, mapper);
+ return new HighamHall54FieldStepInterpolator(getField(), forward, mapper);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldStepInterpolator.java
index 3f8499c..caf3bc8 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldStepInterpolator.java
@@ -17,8 +17,8 @@
package org.apache.commons.math3.ode.nonstiff;
+import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.ode.AbstractFieldIntegrator;
import org.apache.commons.math3.ode.FieldEquationsMapper;
import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
@@ -36,14 +36,13 @@ class HighamHall54FieldStepInterpolator>
extends RungeKuttaFieldStepInterpolator {
/** Simple constructor.
- * @param rkIntegrator integrator being used
+ * @param field field to which the time and state vector elements belong
* @param forward integration direction indicator
* @param mapper equations mapper for the all equations
*/
- HighamHall54FieldStepInterpolator(final AbstractFieldIntegrator rkIntegrator,
- final boolean forward,
+ HighamHall54FieldStepInterpolator(final Field field, final boolean forward,
final FieldEquationsMapper mapper) {
- super(rkIntegrator, forward, mapper);
+ super(field, forward, mapper);
}
/** Copy constructor.
@@ -70,7 +69,7 @@ class HighamHall54FieldStepInterpolator>
final T oneMinusThetaH) {
final T bDot0 = theta.multiply(theta.multiply(theta.multiply( -10.0 ).add( 16.0 )).add(-15.0 / 2.0)).add(1);
- final T bDot1 = time.getField().getZero();
+ final T bDot1 = getField().getZero();
final T bDot2 = theta.multiply(theta.multiply(theta.multiply( 135.0 / 2.0).add(-729.0 / 8.0)).add(459.0 / 16.0));
final T bDot3 = theta.multiply(theta.multiply(theta.multiply(-120.0 ).add( 152.0 )).add(-44.0 ));
final T bDot4 = theta.multiply(theta.multiply(theta.multiply( 125.0 / 2.0).add(-625.0 / 8.0)).add(375.0 / 16.0));
@@ -81,7 +80,7 @@ class HighamHall54FieldStepInterpolator>
if (getGlobalPreviousState() != null && theta.getReal() <= 0.5) {
final T hTheta = h.multiply(theta);
final T b0 = hTheta.multiply(theta.multiply(theta.multiply(theta.multiply( -5.0 / 2.0).add( 16.0 / 3.0)).add(-15.0 / 4.0)).add(1));
- final T b1 = time.getField().getZero();
+ final T b1 = getField().getZero();
final T b2 = hTheta.multiply(theta.multiply(theta.multiply(theta.multiply(135.0 / 8.0).add(-243.0 / 8.0)).add(459.0 / 32.0)));
final T b3 = hTheta.multiply(theta.multiply(theta.multiply(theta.multiply(-30.0 ).add( 152.0 / 3.0)).add(-22.0 )));
final T b4 = hTheta.multiply(theta.multiply(theta.multiply(theta.multiply(125.0 / 8.0).add(-625.0 / 24.0)).add(375.0 / 32.0)));
@@ -91,7 +90,7 @@ class HighamHall54FieldStepInterpolator>
} else {
final T theta2 = theta.multiply(theta);
final T b0 = h.multiply( theta.multiply(theta.multiply(theta.multiply(theta.multiply(-5.0 / 2.0).add( 16.0 / 3.0)).add( -15.0 / 4.0)).add( 1.0 )).add( -1.0 / 12.0));
- final T b1 = time.getField().getZero();
+ final T b1 = getField().getZero();
final T b2 = h.multiply(theta2.multiply(theta.multiply(theta.multiply( 135.0 / 8.0 ).add(-243.0 / 8.0)).add(459.0 / 32.0)).add( -27.0 / 32.0));
final T b3 = h.multiply(theta2.multiply(theta.multiply(theta.multiply( -30.0 ).add( 152.0 / 3.0)).add(-22.0 )).add( 4.0 / 3.0));
final T b4 = h.multiply(theta2.multiply(theta.multiply(theta.multiply( 125.0 / 8.0 ).add(-625.0 / 24.0)).add(375.0 / 32.0)).add(-125.0 / 96.0));
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegrator.java
index c36e5dd..6180982 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegrator.java
@@ -138,7 +138,7 @@ public class LutherFieldIntegrator>
@Override
protected LutherFieldStepInterpolator
createInterpolator(final boolean forward, final FieldEquationsMapper mapper) {
- return new LutherFieldStepInterpolator(this, forward, mapper);
+ return new LutherFieldStepInterpolator(getField(), forward, mapper);
}
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldStepInterpolator.java
index 6f643d5..57d6dfa 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldStepInterpolator.java
@@ -17,8 +17,8 @@
package org.apache.commons.math3.ode.nonstiff;
+import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.ode.AbstractFieldIntegrator;
import org.apache.commons.math3.ode.FieldEquationsMapper;
import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
@@ -81,15 +81,14 @@ class LutherFieldStepInterpolator>
private final T d6c;
/** Simple constructor.
- * @param rkIntegrator integrator being used
+ * @param field field to which the time and state vector elements belong
* @param forward integration direction indicator
* @param mapper equations mapper for the all equations
*/
- LutherFieldStepInterpolator(final AbstractFieldIntegrator rkIntegrator,
- final boolean forward,
+ LutherFieldStepInterpolator(final Field field, final boolean forward,
final FieldEquationsMapper mapper) {
- super(rkIntegrator, forward, mapper);
- final T q = rkIntegrator.getField().getOne().multiply(21).sqrt();
+ super(field, forward, mapper);
+ final T q = field.getOne().multiply(21).sqrt();
c5a = q.multiply( -49).add( -49);
c5b = q.multiply( 287).add( 392);
c5c = q.multiply( -357).add( -637);
@@ -188,7 +187,7 @@ class LutherFieldStepInterpolator>
// At the end, we get the b_i as polynomials in theta.
final T coeffDot1 = theta.multiply(theta.multiply(theta.multiply(theta.multiply( 21 ).add( -47 )).add( 36 )).add( -54 / 5.0)).add(1);
- final T coeffDot2 = theta.getField().getZero();
+ final T coeffDot2 = getField().getZero();
final T coeffDot3 = theta.multiply(theta.multiply(theta.multiply(theta.multiply( 112 ).add(-608 / 3.0)).add( 320 / 3.0 )).add(-208 / 15.0));
final T coeffDot4 = theta.multiply(theta.multiply(theta.multiply(theta.multiply( -567 / 5.0).add( 972 / 5.0)).add( -486 / 5.0 )).add( 324 / 25.0));
final T coeffDot5 = theta.multiply(theta.multiply(theta.multiply(theta.multiply(c5a.divide(5)).add(c5b.divide(15))).add(c5c.divide(30))).add(c5d.divide(150)));
@@ -201,7 +200,7 @@ class LutherFieldStepInterpolator>
final T s = theta.multiply(theta.multiply(h));
final T coeff1 = s.multiply(theta.multiply(theta.multiply(theta.multiply( 21 / 5.0).add( -47 / 4.0)).add( 12 )).add( -27 / 5.0)).add(1);
- final T coeff2 = s.getField().getZero();
+ final T coeff2 = getField().getZero();
final T coeff3 = s.multiply(theta.multiply(theta.multiply(theta.multiply( 112 / 5.0).add(-152 / 3.0)).add( 320 / 9.0 )).add(-104 / 15.0));
final T coeff4 = s.multiply(theta.multiply(theta.multiply(theta.multiply(-567 / 25.0).add( 243 / 5.0)).add( -162 / 5.0 )).add( 162 / 25.0));
final T coeff5 = s.multiply(theta.multiply(theta.multiply(theta.multiply(c5a.divide(25)).add(c5b.divide(60))).add(c5c.divide(90))).add(c5d.divide(300)));
@@ -213,7 +212,7 @@ class LutherFieldStepInterpolator>
final T s = oneMinusThetaH.multiply(theta);
final T coeff1 = s.multiply(theta.multiply(theta.multiply(theta.multiply( -21 / 5.0).add( 151 / 20.0)).add( -89 / 20.0)).add( 19 / 20.0)).add( -1 / 20.0);
- final T coeff2 = s.getField().getZero();
+ final T coeff2 = getField().getZero();
final T coeff3 = s.multiply(theta.multiply(theta.multiply(theta.multiply(-112 / 5.0).add( 424 / 15.0)).add( -328 / 45.0)).add( -16 / 45.0)).add(-16 / 45.0);
final T coeff4 = s.multiply(theta.multiply(theta.multiply(theta.multiply( 567 / 25.0).add( -648 / 25.0)).add( 162 / 25.0)));
final T coeff5 = s.multiply(theta.multiply(theta.multiply(theta.multiply(d5a.divide(25)).add(d5b.divide(300))).add(d5c.divide(900))).add( -49 / 180.0)).add(-49 / 180.0);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegrator.java
index 3cc4c71..d3a1f2f 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegrator.java
@@ -86,7 +86,7 @@ public class MidpointFieldIntegrator> extends Rung
@Override
protected MidpointFieldStepInterpolator
createInterpolator(final boolean forward, final FieldEquationsMapper mapper) {
- return new MidpointFieldStepInterpolator(this, forward, mapper);
+ return new MidpointFieldStepInterpolator(getField(), forward, mapper);
}
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldStepInterpolator.java
index 943533a..bfaf69d 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldStepInterpolator.java
@@ -17,8 +17,8 @@
package org.apache.commons.math3.ode.nonstiff;
+import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.ode.AbstractFieldIntegrator;
import org.apache.commons.math3.ode.FieldEquationsMapper;
import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
@@ -52,14 +52,13 @@ class MidpointFieldStepInterpolator>
extends RungeKuttaFieldStepInterpolator {
/** Simple constructor.
- * @param rkIntegrator integrator being used
+ * @param field field to which the time and state vector elements belong
* @param forward integration direction indicator
* @param mapper equations mapper for the all equations
*/
- MidpointFieldStepInterpolator(final AbstractFieldIntegrator rkIntegrator,
- final boolean forward,
+ MidpointFieldStepInterpolator(Field field, final boolean forward,
final FieldEquationsMapper mapper) {
- super(rkIntegrator, forward, mapper);
+ super(field, forward, mapper);
}
/** Copy constructor.
@@ -86,7 +85,7 @@ class MidpointFieldStepInterpolator>
final T oneMinusThetaH) {
final T coeffDot2 = theta.multiply(2);
- final T coeffDot1 = time.getField().getOne().subtract(coeffDot2);
+ final T coeffDot1 = getField().getOne().subtract(coeffDot2);
final T[] interpolatedState;
final T[] interpolatedDerivatives;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldStepInterpolator.java
index 9a86d82..1befebc 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldStepInterpolator.java
@@ -17,8 +17,8 @@
package org.apache.commons.math3.ode.nonstiff;
+import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.ode.AbstractFieldIntegrator;
import org.apache.commons.math3.ode.FieldEquationsMapper;
import org.apache.commons.math3.ode.sampling.AbstractFieldStepInterpolator;
import org.apache.commons.math3.util.MathArrays;
@@ -36,36 +36,25 @@ import org.apache.commons.math3.util.MathArrays;
abstract class RungeKuttaFieldStepInterpolator>
extends AbstractFieldStepInterpolator {
- /** Reference to the integrator. */
- protected AbstractFieldIntegrator integrator;
+ /** Field to which the time and state vector elements belong. */
+ private final Field field;
/** Slopes at the intermediate points. */
private T[][] yDotK;
/** Simple constructor.
- * @param rkIntegrator integrator being used
+ * @param field field to which the time and state vector elements belong
* @param forward integration direction indicator
* @param mapper equations mapper for the all equations
*/
- protected RungeKuttaFieldStepInterpolator(final AbstractFieldIntegrator rkIntegrator,
- final boolean forward,
+ protected RungeKuttaFieldStepInterpolator(final Field field, final boolean forward,
final FieldEquationsMapper mapper) {
super(forward, mapper);
- this.yDotK = null;
- this.integrator = rkIntegrator;
+ this.field = field;
+ this.yDotK = null;
}
/** Copy constructor.
-
- * The copied interpolator should have been finalized before the
- * copy, otherwise the copy will not be able to perform correctly any
- * interpolation and will throw a {@link NullPointerException}
- * later. Since we don't want this constructor to throw the
- * exceptions finalization may involve and since we don't want this
- * method to modify the state of the copied interpolator,
- * finalization is not done automatically, it
- * remains under user control.
-
* The copy is a deep copy: its arrays are separated from the
* original arrays of the instance.
@@ -75,10 +64,10 @@ abstract class RungeKuttaFieldStepInterpolator>
RungeKuttaFieldStepInterpolator(final RungeKuttaFieldStepInterpolator interpolator) {
super(interpolator);
+ field = interpolator.field;
if (yDotK != null) {
- yDotK = MathArrays.buildArray(interpolator.integrator.getField(),
- interpolator.yDotK.length, -1);
+ yDotK = MathArrays.buildArray(field, interpolator.yDotK.length, -1);
for (int k = 0; k < yDotK.length; ++k) {
yDotK[k] = interpolator.yDotK[k].clone();
}
@@ -87,10 +76,13 @@ abstract class RungeKuttaFieldStepInterpolator>
yDotK = null;
}
- // we cannot keep any reference to the equations in the copy
- // the interpolator should have been finalized before
- integrator = null;
+ }
+ /** Get the field to which the time and state vector elements belong.
+ * @return to which the time and state vector elements belong
+ */
+ protected Field getField() {
+ return field;
}
/** Store the slopes at the intermediate points.
@@ -126,8 +118,7 @@ abstract class RungeKuttaFieldStepInterpolator>
*/
@SuppressWarnings("unchecked")
protected T[] derivativeLinearCombination(final T ... coefficients) {
- return combine(MathArrays.buildArray(integrator.getField(), yDotK[0].length),
- coefficients);
+ return combine(MathArrays.buildArray(field, yDotK[0].length), coefficients);
}
/** Linearly combine arrays.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldIntegrator.java
index e0d5044..d298ff8 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldIntegrator.java
@@ -100,7 +100,7 @@ public class ThreeEighthesFieldIntegrator>
@Override
protected ThreeEighthesFieldStepInterpolator
createInterpolator(final boolean forward, final FieldEquationsMapper mapper) {
- return new ThreeEighthesFieldStepInterpolator(this, forward, mapper);
+ return new ThreeEighthesFieldStepInterpolator(getField(), forward, mapper);
}
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldStepInterpolator.java
index 39cdc1c..cc346fd 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldStepInterpolator.java
@@ -17,8 +17,8 @@
package org.apache.commons.math3.ode.nonstiff;
+import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.ode.AbstractFieldIntegrator;
import org.apache.commons.math3.ode.FieldEquationsMapper;
import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
@@ -62,14 +62,13 @@ class ThreeEighthesFieldStepInterpolator>
extends RungeKuttaFieldStepInterpolator {
/** Simple constructor.
- * @param rkIntegrator integrator being used
+ * @param field field to which the time and state vector elements belong
* @param forward integration direction indicator
* @param mapper equations mapper for the all equations
*/
- ThreeEighthesFieldStepInterpolator(final AbstractFieldIntegrator rkIntegrator,
- final boolean forward,
+ ThreeEighthesFieldStepInterpolator(final Field field, final boolean forward,
final FieldEquationsMapper mapper) {
- super(rkIntegrator, forward, mapper);
+ super(field, forward, mapper);
}
/** Copy constructor.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d1d22013/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 e9d6f29..5acd00b 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
@@ -55,9 +55,6 @@ public abstract class AbstractFieldStepInterpolator softCurrentState;
- /** indicate if the step has been finalized or not. */
- private boolean finalized;
-
/** integration direction. */
private boolean forward;
@@ -75,27 +72,14 @@ public abstract class AbstractFieldStepInterpolatorThe copied interpolator should have been finalized before the
- * copy, otherwise the copy will not be able to perform correctly
- * any derivative computation and will throw a {@link
- * NullPointerException} later. Since we don't want this constructor
- * to throw the exceptions finalization may involve and since we
- * don't want this method to modify the state of the copied
- * interpolator, finalization is not done
- * automatically, it remains under user control.
-
* The copy is a deep copy: its arrays are separated from the
* original arrays of the instance.
-
* @param interpolator interpolator to copy from.
-
*/
protected AbstractFieldStepInterpolator(final AbstractFieldStepInterpolator interpolator) {
@@ -104,7 +88,6 @@ public abstract class AbstractFieldStepInterpolator copy() throws MaxCountExceededException {
- // finalize the step before performing copy
- finalizeStep();
-
// create the new independent instance
return doCopy();
}
- /** Really copy the finalized instance.
- * This method is called by {@link #copy()} after the
- * step has been finalized. It must perform a deep copy
- * to have an new instance completely independent for the
- * original instance.
- * @return a copy of the finalized instance
+ /** Really copy the instance.
+ * @return a copy of the instance
*/
protected abstract FieldStepInterpolator doCopy();
@@ -144,16 +120,11 @@ public abstract class AbstractFieldStepInterpolator state) {
-
globalCurrentState = state;
softCurrentState = globalCurrentState;
if (globalPreviousState != null) {
h = globalCurrentState.getTime().subtract(globalPreviousState.getTime());
}
-
- // the step is not finalized anymore
- finalized = false;
-
}
/** Restrict step range to a limited part of the global step.
@@ -240,60 +211,4 @@ public abstract class AbstractFieldStepInterpolatorSome embedded Runge-Kutta integrators need fewer functions
- * evaluations than their counterpart step interpolators. These
- * interpolators should perform the last evaluations they need by
- * themselves only if they need them. This method triggers these
- * extra evaluations. It can be called directly by the user step
- * handler and it is called automatically if {@link
- * #setInterpolatedTime} is called.
-
- * Once this method has been called, no other
- * evaluation will be performed on this step. If there is a need to
- * have some side effects between the step handler and the
- * differential equations (for example update some data in the
- * equations once the step has been done), it is advised to call
- * this method explicitly from the step handler before these side
- * effects are set up. If the step handler induces no side effect,
- * then this method can safely be ignored, it will be called
- * transparently as needed.
-
- * Warning: since the step interpolator provided
- * to the step handler as a parameter of the {@link
- * StepHandler#handleStep handleStep} is valid only for the duration
- * of the {@link StepHandler#handleStep handleStep} call, one cannot
- * simply store a reference and reuse it later. One should first
- * finalize the instance, then copy this finalized instance into a
- * new object that can be kept.
-
- * This method calls the protected doFinalize
method
- * if it has never been called during this step and set a flag
- * indicating that it has been called once. It is the
- * doFinalize
method which should perform the evaluations.
- * This wrapping prevents from calling doFinalize
several
- * times and hence evaluating the differential equations too often.
- * Therefore, subclasses are not allowed not reimplement it, they
- * should rather reimplement doFinalize
.
-
- * @exception MaxCountExceededException if the number of functions evaluations is exceeded
-
- */
- public final void finalizeStep() throws MaxCountExceededException {
- if (! finalized) {
- doFinalize();
- finalized = true;
- }
- }
-
- /**
- * Really finalize the step.
- * The default implementation of this method does nothing.
- * @exception MaxCountExceededException if the number of functions evaluations is exceeded
- */
- protected void doFinalize() throws MaxCountExceededException {
- }
-
}