Skip to content

Commit bad7955

Browse files
Restore DelayDiffEq extension hooks as public API (#4073)
Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
1 parent e5489fa commit bad7955

7 files changed

Lines changed: 42 additions & 19 deletions

File tree

docs/src/devtools/internals/public_api.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ documented under the API section.
1010
Do not build application code against these hooks. They exist so solver
1111
packages can extend common traits, controllers, interpolation hooks, and
1212
initialization protocols without depending on undocumented implementation
13-
details. Concrete per-algorithm cache types and low-level nonlinear solve
14-
helper functions are not public API; only the abstract cache supertypes a
15-
solver package subtypes are.
13+
details. Concrete per-algorithm caches and low-level nonlinear-solve helpers
14+
remain internal unless listed below; the listed automatic-switch caches and
15+
nonlinear-solver hooks are shared with sibling integrator packages.
1616

1717
## DiffEqBase solver hooks
1818

@@ -99,6 +99,7 @@ OrdinaryDiffEqCore.StochasticDiffEqJumpNewtonDiffusionAdaptiveAlgorithm
9999

100100
```@docs
101101
OrdinaryDiffEqCore.CompositeAlgorithm
102+
OrdinaryDiffEqCore.AutoSwitchCache
102103
OrdinaryDiffEqCore.isautoswitch
103104
OrdinaryDiffEqCore.default_autoswitch
104105
OrdinaryDiffEqCore.unwrap_alg
@@ -193,6 +194,7 @@ extension points.
193194
```@docs
194195
OrdinaryDiffEqCore.AbstractNLSolver
195196
OrdinaryDiffEqCore.AbstractNLSolverAlgorithm
197+
OrdinaryDiffEqCore.AbstractNLSolverCache
196198
OrdinaryDiffEqCore.nlsolve_f
197199
OrdinaryDiffEqCore.get_W
198200
OrdinaryDiffEqCore.set_new_W!
@@ -204,6 +206,12 @@ OrdinaryDiffEqCore.isJcurrent
204206
OrdinaryDiffEqCore.resize_J_W!
205207
OrdinaryDiffEqCore.resize_nlsolver!
206208
OrdinaryDiffEqCore.default_nlsolve
209+
OrdinaryDiffEqNonlinearSolve.nlsolve!
210+
OrdinaryDiffEqNonlinearSolve.nlsolvefail
211+
OrdinaryDiffEqNonlinearSolve.compute_step!
212+
OrdinaryDiffEqNonlinearSolve.initial_η
213+
OrdinaryDiffEqNonlinearSolve.anderson
214+
OrdinaryDiffEqNonlinearSolve.anderson!
207215
```
208216

209217
## Jacobian / W-matrix / differentiation configuration
@@ -249,6 +257,7 @@ OrdinaryDiffEqCore.OrdinaryDiffEqMutableCache
249257
OrdinaryDiffEqCore.StochasticDiffEqCache
250258
OrdinaryDiffEqCore.StochasticDiffEqConstantCache
251259
OrdinaryDiffEqCore.StochasticDiffEqMutableCache
260+
OrdinaryDiffEqCore.DefaultCache
252261
OrdinaryDiffEqCore.@cache
253262
OrdinaryDiffEqCore.alg_cache
254263
OrdinaryDiffEqCore.get_fsalfirstlast
@@ -266,6 +275,9 @@ OrdinaryDiffEqCore._ode_init
266275
OrdinaryDiffEqCore._initialize_dae!
267276
OrdinaryDiffEqCore.find_algebraic_vars_eqs
268277
OrdinaryDiffEqCore.get_differential_vars
278+
OrdinaryDiffEqCore.handle_callback_modifiers!
279+
OrdinaryDiffEqCore.resolve_stage_step_limiters
280+
OrdinaryDiffEqCore.trivial_limiter!
269281
```
270282

271283
## Dense output / interpolation

lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,12 +429,12 @@ include("precompilation_setup.jl")
429429
eval(
430430
Expr(
431431
:public,
432-
:AbstractController, :AbstractControllerCache, :AbstractNLSolver, :AbstractNLSolverAlgorithm, :AbstractThreadingOption,
432+
:AbstractController, :AbstractControllerCache, :AbstractNLSolver, :AbstractNLSolverAlgorithm, :AbstractNLSolverCache, :AbstractThreadingOption,
433433
:accept_step_controller, :alg_adaptive_order, :alg_autodiff, :alg_cache, :alg_difftype, :alg_extrapolates,
434-
:alg_maximum_order, :alg_stability_size, :AutoAlgSwitch, :AutoSwitch, :BaseThreads,
434+
:alg_maximum_order, :alg_stability_size, :AutoAlgSwitch, :AutoSwitch, :AutoSwitchCache, :BaseThreads,
435435
:beta1_default, :beta2_default, Symbol("@cache"), :COEFFICIENT_MULTISTEP, :CommonControllerOptions, :CompositeAlgorithm,
436436
:CompositeController, :constvalue, :Convergence, :current_extrapolant,
437-
:current_interpolant, :DAEAlgorithm, :default_autoswitch, :default_controller, :default_linear_interpolation,
437+
:current_interpolant, :DAEAlgorithm, :default_autoswitch, :DefaultCache, :default_controller, :default_linear_interpolation,
438438
:default_nlsolve, :DEOptions, :DIRK, :Divergence, :dt_required, :DummyController,
439439
:explicit_rk_docstring, :ExponentialAlgorithm, :FastConvergence, :gamma_default, :generic_solver_docstring,
440440
:get_current_adaptive_order, :get_current_alg_autodiff, :get_differential_vars, :get_EEst, :get_failfactor, :get_fsalfirstlast,
@@ -477,7 +477,7 @@ include("precompilation_setup.jl")
477477
# Integrator step / cache / initialization hooks.
478478
:_ode_init, :_determine_initdt, :ode_determine_initdt, :_initialize_dae!,
479479
:find_algebraic_vars_eqs, :postamble!, :apply_step!, :last_step_failed, :reset_alg_dependent_opts!,
480-
:resolve_basic,
480+
:handle_callback_modifiers!, :resolve_basic, :resolve_stage_step_limiters,
481481
# Noise hooks used by the SDE/RODE solver sublibs.
482482
:accept_noise!, :reinit_noise!, :reject_noise!, :save_noise!, :noise_curt,
483483
:is_noise_saveable,
@@ -487,7 +487,7 @@ include("precompilation_setup.jl")
487487
# OrdinaryDiffEqCache trio: every StochasticDiffEq solver cache subtypes one
488488
# of these, so they are a required solver-author extension point.
489489
:StochasticDiffEqCache, :StochasticDiffEqConstantCache,
490-
:StochasticDiffEqMutableCache,
490+
:StochasticDiffEqMutableCache, :trivial_limiter!,
491491
)
492492
)
493493
end

lib/OrdinaryDiffEqCore/src/algorithms.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,11 @@ end
334334

335335
################################################################################
336336

337+
"""
338+
trivial_limiter!(u, integrator, p, t)
339+
340+
No-op stage/step limiter used when no solve-level limiter is supplied.
341+
"""
337342
@inline trivial_limiter!(u, integrator, p, t) = nothing
338343

339344
################################################################################

lib/OrdinaryDiffEqCore/test/qa/qa.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ using SciMLTesting, OrdinaryDiffEqCore, Test
55
const UNANALYZABLE = (OrdinaryDiffEqCore.Predictor,)
66

77
@static if VERSION >= v"1.11.0-DEV.469"
8-
@test Base.ispublic(OrdinaryDiffEqCore, :isdiscretecache)
8+
for name in (
9+
:AbstractNLSolverCache, :AutoSwitchCache, :DefaultCache,
10+
:handle_callback_modifiers!, :isdiscretecache,
11+
:resolve_stage_step_limiters, :trivial_limiter!,
12+
)
13+
@test Base.ispublic(OrdinaryDiffEqCore, name)
14+
end
915
end
1016

1117
run_qa(

lib/OrdinaryDiffEqDefault/test/qa/qa.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ without_local_project_sources(OrdinaryDiffEqDefault) do
5050
# stale because of the unanalyzable enum submodule above.
5151
ignore = (:Tsit5, :Vern7, :Rosenbrock23, :Rodas5P, :FBDF),
5252
),
53-
all_explicit_imports_are_public = (;
54-
# Internal monorepo extension point; `AutoSwitchCache` is not user API.
55-
ignore = (:AutoSwitchCache,),
56-
),
5753
all_qualified_accesses_are_public = (;
5854
# `lorenz`/`lorenz_oop` are OrdinaryDiffEqCore precompile-workload
5955
# test problems (defined in `precompilation_setup.jl`), deliberately

lib/OrdinaryDiffEqNonlinearSolve/src/OrdinaryDiffEqNonlinearSolve.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,16 @@ include("initialize_dae.jl")
7373

7474
export BrownFullBasicInit, ShampineCollocationInit
7575

76-
# Nonlinear-solver algorithms accepted by OrdinaryDiffEq implicit methods. The
77-
# lower-level build/step/Anderson helpers are implementation details, not public API.
76+
# Nonlinear-solver algorithms accepted by OrdinaryDiffEq implicit methods and the
77+
# solver-author hooks extended by sibling integrator packages.
7878
# The `public` keyword is only parseable on Julia >= 1.11.0-DEV.469, so it is
7979
# gated to keep the 1.10 floor parsing.
8080
@static if VERSION >= v"1.11.0-DEV.469"
8181
eval(
8282
Expr(
8383
:public,
84-
:NLNewton, :NLFunctional, :NLAnderson, :HomotopyNonlinearSolveAlg
84+
:NLNewton, :NLFunctional, :NLAnderson, :HomotopyNonlinearSolveAlg,
85+
:nlsolve!, :nlsolvefail, :compute_step!, :initial_η, :anderson, :anderson!
8586
)
8687
)
8788
end

lib/OrdinaryDiffEqNonlinearSolve/test/qa/qa.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
using SciMLTesting, OrdinaryDiffEqNonlinearSolve, Test
22
using Aqua
33

4+
@static if VERSION >= v"1.11.0-DEV.469"
5+
for name in (:anderson, :anderson!, :compute_step!, :initial_η, :nlsolve!, :nlsolvefail)
6+
@test Base.ispublic(OrdinaryDiffEqNonlinearSolve, name)
7+
end
8+
end
9+
410
# Ambiguities are checked below over this package's own methods instead of Aqua's default
511
# `[pkg, Base, Core]` module set; see the `Aqua.test_ambiguities` call.
612
run_qa(
@@ -45,9 +51,6 @@ run_qa(
4551
:AbstractSciMLOperator,
4652
# OrdinaryDiffEqDifferentiation W-operator types (attributed to SciMLOperators).
4753
:WOperator, :StaticWOperator,
48-
# Owner-internal cross-sublibrary hooks with no public wrapper.
49-
# OrdinaryDiffEqCore:
50-
:AbstractNLSolverCache,
5154
# OrdinaryDiffEqDifferentiation:
5255
:build_J_W, :build_jac_config, :build_uf, :dolinsolve,
5356
:is_always_new, :jacobian!, :jacobian2W!, :resize_jac_config!,

0 commit comments

Comments
 (0)