Repository: commons-math Updated Branches: refs/heads/field-ode 0820cd68d -> 1e71453fa
Step interpolator only needs the mapper, not the full equations. Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/1e71453f Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/1e71453f Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/1e71453f Branch: refs/heads/field-ode Commit: 1e71453fa1fb6f453dd55ed37f41dc0b624d7d6b Parents: 0820cd6 Author: Luc Maisonobe <l...@apache.org> Authored: Sun Nov 15 10:34:51 2015 +0100 Committer: Luc Maisonobe <l...@apache.org> Committed: Sun Nov 15 10:34:51 2015 +0100 ---------------------------------------------------------------------- .../sampling/AbstractFieldStepInterpolator.java | 34 ++++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-math/blob/1e71453f/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 e2425f3..aa95034 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 @@ -19,7 +19,7 @@ package org.apache.commons.math3.ode.sampling; import org.apache.commons.math3.RealFieldElement; import org.apache.commons.math3.exception.MaxCountExceededException; -import org.apache.commons.math3.ode.FieldExpandableODE; +import org.apache.commons.math3.ode.FieldEquationsMapper; import org.apache.commons.math3.ode.FieldODEStateAndDerivative; /** This abstract class represents an interpolator over the last step @@ -64,8 +64,8 @@ public abstract class AbstractFieldStepInterpolator<T extends RealFieldElement<T /** integration direction. */ private boolean forward; - /** ODE equations with primary and secondary components. */ - private FieldExpandableODE<T> equations; + /** Mapper for ODE equations primary and secondary components. */ + private FieldEquationsMapper<T> mapper; /** Simple constructor. * This constructor builds an instance that is not usable yet, the @@ -87,17 +87,17 @@ public abstract class AbstractFieldStepInterpolator<T extends RealFieldElement<T currentState = null; finalized = false; forward = true; - equations = null; + 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 equations primary and secondary equations set + * @param mapper mapper for ODE equations primary and secondary components */ protected AbstractFieldStepInterpolator(final T[] y, final boolean forward, - final FieldExpandableODE<T> equations) { + final FieldEquationsMapper<T> mapper) { globalPreviousState = null; globalCurrentState = null; @@ -107,7 +107,7 @@ public abstract class AbstractFieldStepInterpolator<T extends RealFieldElement<T currentState = y; finalized = false; this.forward = forward; - this.equations = equations; + this.mapper = mapper; } @@ -138,23 +138,23 @@ public abstract class AbstractFieldStepInterpolator<T extends RealFieldElement<T if (interpolator.currentState == null) { currentState = null; - equations = null; + mapper = null; } else { currentState = interpolator.currentState.clone(); } finalized = interpolator.finalized; forward = interpolator.forward; - equations = interpolator.equations; + mapper = interpolator.mapper; } /** 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 eqn primary and secondary equations set + * @param equationsMapper mapper for ODE equations primary and secondary components */ - protected void reinitialize(final T[] y, final boolean isForward, final FieldExpandableODE<T> eqn) { + protected void reinitialize(final T[] y, final boolean isForward, final FieldEquationsMapper<T> equationsMapper) { globalPreviousState = null; globalCurrentState = null; @@ -164,7 +164,7 @@ public abstract class AbstractFieldStepInterpolator<T extends RealFieldElement<T currentState = y.clone(); finalized = false; this.forward = isForward; - this.equations = eqn; + this.mapper = equationsMapper; } @@ -272,7 +272,7 @@ public abstract class AbstractFieldStepInterpolator<T extends RealFieldElement<T public FieldODEStateAndDerivative<T> getInterpolatedState(final T time) { final T oneMinusThetaH = globalCurrentState.getTime().subtract(time); final T theta = (h.getReal() == 0) ? h.getField().getZero() : h.subtract(oneMinusThetaH).divide(h); - return computeInterpolatedStateAndDerivatives(equations, theta, oneMinusThetaH); + return computeInterpolatedStateAndDerivatives(mapper, time, theta, oneMinusThetaH); } /** {@inheritDoc} */ @@ -283,7 +283,8 @@ public abstract class AbstractFieldStepInterpolator<T extends RealFieldElement<T /** Compute the state and derivatives at the interpolated time. * This is the main processing method that should be implemented by * the derived classes to perform the interpolation. - * @param eqn ODE equations with primary and secondary components + * @param equationsMapper mapper for ODE equations primary and secondary components + * @param time interpolation time * @param theta normalized interpolation abscissa within the step * (theta is zero at the previous time step and one at the current time step) * @param oneMinusThetaH time gap between the interpolated time and @@ -291,9 +292,8 @@ public abstract class AbstractFieldStepInterpolator<T extends RealFieldElement<T * @return interpolated state and derivatives * @exception MaxCountExceededException if the number of functions evaluations is exceeded */ - protected abstract FieldODEStateAndDerivative<T> computeInterpolatedStateAndDerivatives(FieldExpandableODE<T> eqn, - T theta, - T oneMinusThetaH) + protected abstract FieldODEStateAndDerivative<T> computeInterpolatedStateAndDerivatives(FieldEquationsMapper<T> equationsMapper, + T time, T theta, T oneMinusThetaH) throws MaxCountExceededException; /**