Version: dev

callbacks

Stable function · Simulation

Tier: stable · Kind: function · Topic: Simulation

JuliaTypeScriptPythonRustGo
callbacksoutside profilecallbackscallbacksoutside profile

Julia

callbacks(prob::EsmProblem)
callbacks(prob::EsmProblem)

The problem’s own callback set — the composition of its data-refresh, output-sink and checkpoint callbacks, or nothing when it has none.

Stable API in every simulation-capable binding, for one reason (§2.5.4): a callback argument to solve REPLACES this set entirely — it does not append, merge, or wrap. Silent composition is the more dangerous default (two callbacks both writing output, or both mutating the same buffer, produce a wrong run rather than an error), so a caller who wants to EXTEND reads the set back and composes explicitly:

solve(prob, Tsit5(); callback = CallbackSet(callbacks(prob), my_extra_callback))

Source

TypeScript

Not available in TypeScript. TypeScript is outside the simulation capability profile (Julia, Python, Rust): build an RHS and integrate it; TypeScript and Go are deliberately non-simulating.

Python

callbacks(prob: EsmProblem) -> CallbackSet

The EsmProblem’s callback set (esm-libraries-spec §2.5.4).

Stable API in every simulation-capable binding for one reason: a callback argument to solve REPLACES this set, so without a way to read it back a EsmProblem-level callback would be impossible to extend. Compose explicitly:

solve(prob, callback=callbacks(prob) + my_extra_callback)

Source

Rust

pub fn callbacks(prob: &EsmProblem) -> &CallbackSet

The callbacks declared on prob (§2.5.4).

Stable API in every simulation-capable binding, and for a specific reason: a callback argument to solve REPLACES this set entirely, so without a way to read it back, a EsmProblem-level callback would be impossible to extend. See compose .

Source · Rust docs

Go

Not available in Go. Go is outside the simulation capability profile (Julia, Python, Rust): build an RHS and integrate it; TypeScript and Go are deliberately non-simulating.