Fixed state copying after event detection.
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/7a5431ec Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/7a5431ec Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/7a5431ec Branch: refs/heads/master Commit: 7a5431ecb6efd9ae83c3469f040817d01cdef1c3 Parents: 084ab51 Author: Luc Maisonobe <[email protected]> Authored: Wed Jan 6 12:41:25 2016 +0100 Committer: Luc Maisonobe <[email protected]> Committed: Wed Jan 6 12:41:25 2016 +0100 ---------------------------------------------------------------------- .../math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-math/blob/7a5431ec/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java index c8de1ad..1f3e87c 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java @@ -260,7 +260,8 @@ public abstract class EmbeddedRungeKuttaFieldIntegrator<T extends RealFieldEleme while (error.subtract(1.0).getReal() >= 0) { // first stage - yDotK[0] = stepStart.getDerivative(); + y = equations.getMapper().mapState(stepStart); + yDotK[0] = equations.getMapper().mapDerivative(stepStart); if (firstTime) { final T[] scale = MathArrays.buildArray(getField(), mainSetDimension); @@ -331,7 +332,6 @@ public abstract class EmbeddedRungeKuttaFieldIntegrator<T extends RealFieldEleme interpolator.storeState(stateTmp); System.arraycopy(yTmp, 0, y, 0, y0.length); stepStart = acceptStep(interpolator, finalTime); - System.arraycopy(y, 0, yTmp, 0, y.length); if (!isLastStep) {
