Declare fix_dt_at_bounds!, handle_tstop!, initialize_tstops, initialize_saveat, initialize_d_discontinuities public - #4081
Merged
Conversation
Declares fix_dt_at_bounds!, handle_tstop!, initialize_tstops, initialize_saveat and initialize_d_discontinuities public in OrdinaryDiffEqCore. These are the hooks packages use to build their own integrator on top of the OrdinaryDiffEqCore machinery; DelayDiffEq and OrdinaryDiffEqOperatorSplitting both call them and add methods to them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Declares five
OrdinaryDiffEqCorebindingspublic(not exported) so that packagesbuilding a custom integrator on top of the OrdinaryDiffEqCore machinery can call and
extend them without tripping strict
ExplicitImports/SciMLTesting non-public checks.Unblocks SciML/OrdinaryDiffEqOperatorSplitting.jl#102, which migrates that package to
SciMLTesting 2.4 strict QA. The alternative — rewriting the caller to dodge these
bindings — is not available here: OperatorSplitting adds methods to two of them for
its own integrator type, which is only possible by naming the generic function.
Bindings
fix_dt_at_bounds!integrator.dtinto[dtmin, dtmax]respectingtdir(src/integrators/integrator_utils.jl:894)src/utils.jl:164) and calls it (src/integrator.jl:536)handle_tstop!tstop, setsjust_hit_tstop, interpolates back for non-dtchangeablealgorithms (src/integrators/integrator_utils.jl:909)src/integrator.jl:419) and calls it in 3 places; DelayDiffEq calls it insrc/solve.jl:584andsrc/integrators/interface.jl:695initialize_tstopsBinaryHeapoftdir-signed tstops from usertstops/d_discontinuities/tspan(src/solve.jl:978)src/integrator.jl:233,:1020) and DelayDiffEq (src/solve.jl:277,src/integrators/interface.jl:436)initialize_saveatsaveatheap from the usersaveatkeyword (src/solve.jl:1030)src/integrator.jl:236) and DelayDiffEq (src/solve.jl:281,src/integrators/interface.jl:440)initialize_d_discontinuitiesd_discontinuitiesheap (src/solve.jl:1075)src/integrator.jl:237) and DelayDiffEq (src/solve.jl:282,src/integrators/interface.jl:441)Why interface, not implementation detail
fix_dt_at_bounds!andhandle_tstop!are generic functions that downstream integratorpackages are expected to extend — a generic function with downstream methods is an
extension point by definition, and both existing custom-integrator consumers in the
ecosystem (DelayDiffEq in this repo, OperatorSplitting out of tree) do exactly that.
handle_tstop!is already documented as part of the main solver loop indocs/src/devtools/contributing/diffeq_internals.md.initialize_*functions are the only supported way to construct the internalheap representations that
DEOptionsrequires.DEOptionsis alreadypublic; a publicstruct whose fields cannot be constructed with public API is not usable.
lib/DelayDiffEq/test/qa/qa_tests.jlalready carries all five (well, four of them, plus alarger set) on its non-public ignore list with the comment "make-public candidates" — this
PR resolves that subset in the owning package rather than in each caller.
Already public — deliberately not touched
stepsize_controller!,step_accept_controller!andstep_reject_controller!were alsoflagged upstream, but they are already declared
publicinlib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl(the controller-author block at the top,and again in the solver-author block). No change needed; declaring them again would be noise.
Style
Matches the file's existing
@static if VERSION >= v"1.11.0-DEV.469"/eval(Expr(:public, ...))pattern, which keeps the Julia 1.10 floor parsing. This repo doesnot use SciMLPublic, so no new dependency was added.
Verification
All five confirmed non-public before the edit and public after. Runic clean. Minor version
bump 4.12.0 -> 4.13.0 so downstream can set a compat bound that guarantees the declarations.
🤖 Generated with Claude Code