double minStep = 0;
double maxStep = pb.getFinalTime() - pb.getInitialTime();
double scalAbsoluteTolerance = 1.0e-8;
double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
FirstOrderIntegrator integ =
new HighamHall54Integrator(minStep, maxStep,
scalAbsoluteTolerance, scalRelativeTolerance);
TestProblemHandler handler = new TestProblemHandler(pb, integ);
integ.addStepHandler(handler);
integ.addEventHandler(new EventHandler() {
public int eventOccurred(double t, double[] y, boolean increasing) {
return EventHandler.CONTINUE;
}
public double g(double t, double[] y) throws EventException {
double middle = (pb.getInitialTime() + pb.getFinalTime()) / 2;
double offset = t - middle;
if (offset > 0) {
throw new EventException("Evaluation failed for argument = {0}", t);
}
return offset;
}
public void resetState(double t, double[] y) {
}
private static final long serialVersionUID = 935652725339916361L;
}, Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 1000);
try {
integ.integrate(pb,
pb.getInitialTime(), pb.getInitialState(),
pb.getFinalTime(), new double[pb.getDimension()]);
fail("an exception should have been thrown");
} catch (IntegratorException ie) {
// expected behavior