Callbacks
Callbacks are lightweight per-step hooks that fire around the algorithm's core step. They can inspect or mutate integrator state (e.g. reflect a pair that has passed through a collision singularity) without being fused into the algorithm itself.
Abstract interface
WeberElectrodynamics.HamiltonianCallback — Type
HamiltonianCallbackAbstract supertype for per-step callbacks applied by the integrator. Concrete subtypes can override any of:
apply_pre_step!(cb, integrator, dt_step)— invoked before the algorithm's_step_core!advances the state.apply_post_step!(cb, integrator, dt_step)— invoked after the state and history have been updated.
Both default to no-ops. Callbacks are type-stably iterated from a tuple stored on the integrator; there is no per-step allocation for an empty callback set.
WeberElectrodynamics.apply_pre_step! — Function
apply_pre_step!(cb::HamiltonianCallback, integrator, dt_step)Invoked on the integrator's q/p state immediately before _step_core!(integrator, alg, dt_step) for the upcoming macro step. Default implementation is a no-op.
WeberElectrodynamics.apply_post_step! — Function
apply_post_step!(cb::HamiltonianCallback, integrator, dt_step)Invoked after the algorithm's step has completed and history has been recorded. Default implementation is a no-op.
Built-in callbacks
WeberElectrodynamics.CollisionBounce — Type
CollisionBounce(radius)Pre-step callback that reflects the relative coordinate of any pair closer than radius through the origin, preserving COM and momenta (C⁰-continuation of the ℓ = 0 head-on collision; Frauenfelder & Weber 2024). Works best with the unregularized symplectic path; LC regularization can drift the bounce.
See docs/exploratory/CollisionBounceRegularization.md for the full physics motivation and validation.