pne_detect_events

pne_detect_events(reg_ev, nefv, cefv, step)

pne_detect_events() - Detect events from event function values.

[ROLLBACK, CRITICAL_EVENTS, NEFV] = ...
    PNE_DETECT_EVENTS(REG_EV, NEFV, CEFV, STEP)

Determines whether any events have been detected based on the
corresponding "current" and "next" event function values. If any events
are detected, the relevant information is returned in CRITICAL_EVENTS,
along with a ROLLBACK flag indicating whether to roll back the proposed
next step.

Inputs:
    REG_EV : struct containing info about registered event fcns
    NEFV : cell array of Next Event Function Values
    CEFV : cell array of Current Event Function Values
    STEP : current step size

Outputs:
    ROLLBACK : flag indicating whether any event has requested a
        rollback step, if ROLLBACK is true, then CRITICAL_EVENTS will
        have length 1
    CRITICAL_EVENTS : struct array containing information about any
        detected events, with fields:
        eidx        : event index, index in REG_EV, 0 if no event detected
        name        : name of event function, empty if none detected
        zero        : 1 if zero has been detected, 0 otherwise
                        (i.e. interval detected or no event detected)
        idx         : index(es) of critical elements in event function
        step_scale  : linearly interpolated estimate of scaling factor
                      for current step size required to reach event zero
        log         : 1 log the event in the results, 0 don't log the event
                      (set to 1 for zero events, 0 otherwise, can be
                        modified by callbacks)
        msg         : event message, set to something generic like
                        'ZERO detected for TARGET_LAM event' or
                        'INTERVAL detected for QLIM(3) event', but intended
                      to be changed/updated by callbacks
    NEFV : cell array of Next Event Function Values
        (possibly updated to be exactly zero to avoid re-detection of
        an interval following a zero detection)