Author: luc Date: Mon Jul 14 08:16:11 2008 New Revision: 676622 URL: http://svn.apache.org/viewvc?rev=676622&view=rev Log: preparing test to work with multistep integrators Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/TestProblemHandler.java Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/TestProblemHandler.java URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/TestProblemHandler.java?rev=676622&r1=676621&r2=676622&view=diff ============================================================================== --- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/TestProblemHandler.java (original) +++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/TestProblemHandler.java Mon Jul 14 08:16:11 2008 @@ -70,7 +70,7 @@ maxValueError = 0; maxTimeError = 0; lastError = 0; - expectedStepStart = problem.getInitialTime(); + expectedStepStart = Double.NaN; } public void handleStep(StepInterpolator interpolator, @@ -78,8 +78,14 @@ throws DerivativeException { double start = integrator.getCurrentStepStart(); - maxTimeError = Math.max(maxTimeError, Math.abs(start - expectedStepStart)); - expectedStepStart = start + integrator.getCurrentSignedStepsize(); + if (Math.abs((start - problem.getInitialTime()) / integrator.getCurrentSignedStepsize()) > 0.001) { + // multistep integrators do not handle the first steps themselves + // so we have to make sure the integrator we look at has really started its work + if (!Double.isNaN(expectedStepStart)) { + maxTimeError = Math.max(maxTimeError, Math.abs(start - expectedStepStart)); + } + expectedStepStart = start + integrator.getCurrentSignedStepsize(); + } double pT = interpolator.getPreviousTime(); double cT = interpolator.getCurrentTime();