pne_callback_default
- pne_callback_default(k, nx, cx, px, s, opt)
pne_callback_default()
- Default callback function forpnes_master()
.[NX, CX, S] = PNE_CALLBACK_DEFAULT(K, NX, CX, PX, S, OPT) Default callback function used by PNES_MASTER, collects the results and optionally plots the continuation curve. Always registered with priority 0. See PNE_REGISTER_CALLBACKS for details. This callback uses the 'default' field of the callback state (cbs) for its data. Inputs: K - continuation step iteration count CX - current state, corresponding to most recent successful step with the following fields: x_hat - solution vector from predictor x - solution vector from corrector z - normalized tangent vector default_step - default step size default_parm - handle to function implementing parameterization used by default this_step - step size for this step only this_parm - handle to function implementing parameterization used for this step only step - current step size parm - handle to function implementing current parameterization events - event log, struct array, see PNE_DETECT_EVENTS for details cbs - callback state, callback functions may add fields containing any information the function would like to pass from one invokation to the next, taking care not to step on fields being used by other callbacks, such as the 'default' field used by this default callback efv - cell array of event function values NX - next state (corresponding to proposed next step), struct with (same structure as CX and PX) PX - previous state, corresponding to last successful step prior to CX (same structure as CX and NX) S - container struct for various flags, etc., with fields: done - termination flag, 1 => terminate, 0 => continue done_msg - char array with reason for termination warmstart - struct with warm-start state to be passed to subsequent warm-started call to PNES_MASTER rollback - flag to indicate that the current step should be rolled back and retried with a different step size, etc. events - struct array listing events detected for this step, see PNE_DETECT_EVENTS for details results - current value of results struct whose fields are to be included in the OUTPUT struct returned by PNES_MASTER OPT - PNES_MASTER options struct Outputs: (all are updated versions of the corresponding input arguments) CX - update values in this state if S.rollback is true, e.g. 'this_step' or 'this_parm' NX - update values in this state if S.rollback is false, e.g. user callback state ('cbs' field ), etc. S - struct for various flags, etc. done - can request termination by setting to 1 done_msg - can set termination reason here warmstart - information can be added that can be used to start a new warm-started run, e.g. with updated FCN rollback - can request a rollback step, even if it was not indicated by an event function events - msg field for a given event may be updated results - updated results struct whose fields are to be included in the OUTPUT struct returned by PNES_MASTER All callback functions, including this one, are called in three different contexts, distinguished by the value of K, as follows: (1) initial - called with K = 0, after initial corrector step, before 1st continuation step. (2) iterations - called with K > 0, at each iteration, after predictor-corrector step (3) final - called with K < 0, after exiting predictor-corrector loop, same as last iteration call, with negated K and updated PX, CX User Defined PNE Callback Functions: The user can define their own callback functions which take the same form and are called in the same contexts as PNE_CALLBACK_DEFAULT. These are specified via OPT.callbacks which takes the same form as the MY_CBACKS input to PNE_REGISTER_CALLBACKS.
See also
pnes_master()
,pne_register_callbacks()
.