use of org.orekit.propagation.events.handlers.FieldEventHandler.Action in project Orekit by CS-SI.
the class FieldEventState method doEvent.
/**
* Notify the user's listener of the event. The event occurs wholly within this method
* call including a call to {@link FieldEventDetector#resetState(FieldSpacecraftState)}
* if necessary.
*
* @param state the state at the time of the event. This must be at the same time as
* the current value of {@link #getEventDate()}.
* @return the user's requested action and the new state if the action is {@link
* org.orekit.propagation.events.handlers.FieldEventHandler.Action#RESET_STATE}. Otherwise
* the new state is {@code state}. The stop time indicates what time propagation should
* stop if the action is {@link org.orekit.propagation.events.handlers.FieldEventHandler.Action#STOP}.
* This guarantees the integration will stop on or after the root, so that integration
* may be restarted safely.
* @exception OrekitException if the event detector throws one
*/
public EventOccurrence<T> doEvent(final FieldSpacecraftState<T> state) throws OrekitException {
// check event is pending and is at the same time
check(pendingEvent);
check(state.getDate().equals(this.pendingEventTime));
final FieldEventHandler.Action action = detector.eventOccurred(state, increasing == forward);
final FieldSpacecraftState<T> newState;
if (action == FieldEventHandler.Action.RESET_STATE) {
newState = detector.resetState(state);
} else {
newState = state;
}
// clear pending event
pendingEvent = false;
pendingEventTime = null;
// setup for next search
earliestTimeConsidered = afterEvent;
t0 = afterEvent;
g0 = afterG;
g0Positive = increasing;
// check g0Positive set correctly
check(g0.getReal() == 0.0 || g0Positive == (g0.getReal() > 0));
return new EventOccurrence<T>(action, newState, stopTime);
}
Aggregations