use of org.orekit.propagation.events.handlers.RecordAndContinue in project Orekit by CS-SI.
the class CloseEventsAbstractTest method testFastSwitching.
/**
* test the g function switching with a period shorter than the tolerance. We don't
* need to find any of the events, but we do need to not crash. And we need to
* preserve the alternating increasing / decreasing sequence.
*/
@Test
public void testFastSwitching() throws OrekitException {
// setup
// step size of 10 to land in between two events we would otherwise miss
Propagator propagator = getPropagator(10);
RecordAndContinue<EventDetector> handler = new RecordAndContinue<>();
TimeDetector detector1 = new TimeDetector(9.9, 10.1, 12).withHandler(handler).withMaxCheck(10).withThreshold(0.2);
propagator.addEventDetector(detector1);
// action
propagator.propagate(epoch.shiftedBy(20));
// verify
// finds one or three events. Not 2.
List<Event<EventDetector>> events1 = handler.getEvents();
Assert.assertEquals(1, events1.size());
Assert.assertEquals(9.9, events1.get(0).getState().getDate().durationFrom(epoch), 0.1);
Assert.assertEquals(true, events1.get(0).isIncreasing());
}
Aggregations