Extension Utils

Index

Warning

In the examples in the documentation below, the methods are not prefixed by the module name even if they are private.

julia> using CTFlows
julia> x = 1
julia> private_fun(x) # throw an error

must be replaced by

julia> using CTFlows
julia> x = 1
julia> CTFlows.private_fun(x)

However, if the method is reexported by another package, then, there is no need of prefixing.

julia> module OptimalControl
           import CTFlows: private_fun
           export private_fun
       end
julia> using OptimalControl
julia> x = 1
julia> private_fun(x)

Documentation

CTFlowsODE.__callbacksMethod
__callbacks(
    callback,
    jumps,
    _rg,
    _t_stops_interne,
    tstops
) -> Tuple{Any, Any}

Constructs the combined callback and stopping times for flow integration.

This internal utility assembles a CallbackSet for the ODE integrator, handling both:

  • discrete jumps in the state or costate (via VectorContinuousCallback), and
  • user-defined callbacks.

Additionally, it merges stopping times into a sorted, unique list used for tstops.

Arguments

  • callback: A user-defined callback (e.g. for logging or monitoring).
  • jumps: A vector of tuples (t, η) representing discrete updates at time t.
  • _rg: An optional index range where the jump η should be applied (e.g. only to p in (x, p)).
  • _t_stops_interne: Internal list of event times (mutable, extended in place).
  • tstops: Additional stopping times from the outer solver context.

Returns

  • cb: A CallbackSet combining jumps and user callback.
  • t_stops_all: Sorted and deduplicated list of all stopping times.

Example

julia> cb, tstops = __callbacks(mycb, [(1.0, [0.0, -1.0])], 3:4, [], [2.0])
source