double minStep = 0;
double maxStep = pb.getFinalTime() - pb.getInitialTime();
double scalAbsoluteTolerance = 1.0e-10;
double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
FirstOrderIntegrator integ = new GraggBulirschStoerIntegrator(minStep, maxStep,
scalAbsoluteTolerance,
scalRelativeTolerance);
TestProblemHandler handler = new TestProblemHandler(pb, integ);
integ.addStepHandler(handler);
EventHandler[] functions = pb.getEventsHandlers();
for (int l = 0; l < functions.length; ++l) {
integ.addEventHandler(functions[l],
Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 1000);
}
assertEquals(functions.length, integ.getEventHandlers().size());
integ.integrate(pb,
pb.getInitialTime(), pb.getInitialState(),
pb.getFinalTime(), new double[pb.getDimension()]);
assertTrue(handler.getMaximalValueError() < 5.0e-8);
assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
assertEquals(12.0, handler.getLastTime(), 1.0e-8 * maxStep);
integ.clearEventHandlers();
assertEquals(0, integ.getEventHandlers().size());
}