Fixed a bad interaction between step handlers and event handlers in ODE

integrators.

The problem was due to an internal array from the step interpolator that
was changed by the step handlers. These array was expected to contain
the state at event time, but was overridden later on. the solution is
simply to clone the array. Note that the fact the array is reused *is*
documented in the javadoc and is a feature of the interpolators ...

JIRA: MATH-706

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1201105 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2011-11-11 23:39:34 +00:00
parent ea13fac876
commit 3ad3a1fa41
2 changed files with 5 additions and 1 deletions

View File

@ -318,7 +318,7 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator {
// trigger the event
interpolator.setInterpolatedTime(eventT);
final double[] eventY = interpolator.getInterpolatedState();
final double[] eventY = interpolator.getInterpolatedState().clone();
currentEvent.stepAccepted(eventT, eventY);
isLastStep = currentEvent.stop();

View File

@ -52,6 +52,10 @@ The <action> type attribute can be add,update,fix,remove.
If the output is not quite correct, check for invisible trailing spaces!
-->
<release version="3.0" date="TBD" description="TBD">
<action dev="luc" type="fix" due-to="MATH-706" >
Fixed a bad interaction between step handlers and event handlers in
ODE integrators.
</action>
<action dev="luc" type="add" due-to="Jan Kotek" >
Added array constructor and getter for Vector2D and Vector3D.
</action>