use of org.orekit.propagation.events.handlers.StopOnEvent in project Orekit by CS-SI.
the class PropagatorsParallelizerTest method testStopOnLateEvent.
@Test
public void testStopOnLateEvent() throws OrekitException {
final AbsoluteDate startDate = orbit.getDate();
final AbsoluteDate endDate = startDate.shiftedBy(3600.0);
final AbsoluteDate stopDate = startDate.shiftedBy(900.0);
List<Propagator> propagators = Arrays.asList(buildEcksteinHechler(), buildNumerical());
propagators.get(0).addEventDetector(new DateDetector(stopDate).withHandler(new StopOnEvent<>()));
List<SpacecraftState> results = new PropagatorsParallelizer(propagators, (interpolators, isLast) -> {
}).propagate(startDate, endDate);
Assert.assertEquals(2, results.size());
Assert.assertEquals(0.0, results.get(0).getDate().durationFrom(stopDate), 1.0e-15);
Assert.assertEquals(0.0, results.get(1).getDate().durationFrom(stopDate), 1.0e-15);
}
use of org.orekit.propagation.events.handlers.StopOnEvent in project Orekit by CS-SI.
the class PropagatorsParallelizerTest method testStopOnEarlyEvent.
@Test
public void testStopOnEarlyEvent() throws OrekitException {
final AbsoluteDate startDate = orbit.getDate();
final AbsoluteDate endDate = startDate.shiftedBy(3600.0);
final AbsoluteDate stopDate = startDate.shiftedBy(0.01);
List<Propagator> propagators = Arrays.asList(buildEcksteinHechler(), buildNumerical());
propagators.get(0).addEventDetector(new DateDetector(stopDate).withHandler(new StopOnEvent<>()));
List<SpacecraftState> results = new PropagatorsParallelizer(propagators, (interpolators, isLast) -> {
}).propagate(startDate, endDate);
Assert.assertEquals(2, results.size());
Assert.assertEquals(0.0, results.get(0).getDate().durationFrom(stopDate), 1.0e-15);
Assert.assertEquals(0.0, results.get(1).getDate().durationFrom(stopDate), 1.0e-15);
}
Aggregations