diff --git a/docs/src/index.md b/docs/src/index.md index b10015e..5fd80ae 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -12,3 +12,32 @@ rodas ddeabm ddebdf ``` + +## Reexported SciML common interface + +`using ODEInterfaceDiffEq` also brings in the parts of the SciML common interface needed +to build a problem, solve it with one of the solvers above, and inspect the result, so +they do not have to be imported separately. These names are owned and documented by +[SciMLBase](https://docs.sciml.ai/SciMLBase/stable/) and +[DiffEqBase](https://docs.sciml.ai/DiffEqDocs/stable/) — `DefaultInit` comes from +DiffEqBase, everything else from SciMLBase: + + - Problems: `ODEProblem`, `EnsembleProblem` + - Functions: `ODEFunction` + - Solutions: `ODESolution`, `EnsembleSolution`, `EnsembleSummary`, `DEStats` + - Ensemble algorithms: `EnsembleSerial`, `EnsembleThreads`, `EnsembleDistributed`, + `EnsembleSplitThreads`, and the `EnsembleAnalysis` module + - Solving: `solve`, `solve!`, `init`, `step!`, `remake` + - Integrator interface: `DEIntegrator`, `savevalues!`, `change_t_via_interpolation!`, + `get_tmp_cache`, `set_proposed_dt!`, `u_modified!`, `terminate!` + - Return status: `ReturnCode`, `successful_retcode` + - Callbacks: `ContinuousCallback`, `DiscreteCallback`, `VectorContinuousCallback`, + `CallbackSet`, `DECallback` + - Initialization algorithms: `DefaultInit`, `NoInit`, `CheckInit`, `OverrideInit` + - `NullParameters` + +The integrator functions listed above are exactly the ones ODEInterfaceDiffEq implements +methods for, and the initialization algorithms are exactly the ones it implements +`initialize_dae!` for. `BrownFullBasicInit` and `ShampineCollocationInit` are +deliberately not reexported, since they have no method here. Anything else from SciMLBase +or DiffEqBase must be imported from that package directly. diff --git a/src/ODEInterfaceDiffEq.jl b/src/ODEInterfaceDiffEq.jl index dd76cda..d2a630a 100644 --- a/src/ODEInterfaceDiffEq.jl +++ b/src/ODEInterfaceDiffEq.jl @@ -11,11 +11,25 @@ module ODEInterfaceDiffEq import SciMLStructures using DataStructures: BinaryMaxHeap, BinaryMinHeap, counter using LinearAlgebra: I - using SciMLBase: CallbackSet, ReturnCode, VectorContinuousCallback, check_keywords, - warn_compat + using SciMLBase: check_keywords, warn_compat using SciMLLogging: SciMLLogging, @SciMLMessage import DiffEqBase: initialize!, savevalues! + # The SciML common interface that ODEInterfaceDiffEq reexports (see the second + # `export` below), so that `using ODEInterfaceDiffEq` on its own is enough to build + # an ODE problem, solve it with one of the ODEInterface solvers, drive the + # integrator from a callback, and inspect the result -- which is exactly what the + # README example does. The integrator functions listed here are the ones this + # package implements methods for. Every name stays owned and documented upstream. + using SciMLBase: CallbackSet, CheckInit, ContinuousCallback, DECallback, DEIntegrator, + DEStats, DiscreteCallback, EnsembleAnalysis, EnsembleDistributed, EnsembleProblem, + EnsembleSerial, EnsembleSolution, EnsembleSplitThreads, EnsembleSummary, + EnsembleThreads, NoInit, NullParameters, ODEFunction, ODEProblem, ODESolution, + OverrideInit, ReturnCode, VectorContinuousCallback, change_t_via_interpolation!, + get_tmp_cache, init, remake, set_proposed_dt!, solve, solve!, step!, + successful_retcode, terminate!, u_modified! + using DiffEqBase: DefaultInit + const warnkeywords = ( :save_idxs, :d_discontinuities, :unstable_check, :tstops, :calck, :progress, :dense, :save_start, @@ -49,4 +63,14 @@ module ODEInterfaceDiffEq export ODEInterfaceAlgorithm, dopri5, dop853, odex, seulex, radau, radau5, rodas, ddeabm, ddebdf + # Reexported SciML common interface; approved via `reexports_allow` in test/qa/qa.jl. + export CallbackSet, CheckInit, ContinuousCallback, DECallback, DEIntegrator, + DEStats, DefaultInit, DiscreteCallback, EnsembleAnalysis, EnsembleDistributed, + EnsembleProblem, EnsembleSerial, EnsembleSolution, EnsembleSplitThreads, + EnsembleSummary, EnsembleThreads, NoInit, NullParameters, ODEFunction, ODEProblem, + ODESolution, OverrideInit, ReturnCode, VectorContinuousCallback, + change_t_via_interpolation!, get_tmp_cache, init, remake, savevalues!, + set_proposed_dt!, solve, solve!, step!, successful_retcode, terminate!, + u_modified! + end # module diff --git a/test/qa/qa.jl b/test/qa/qa.jl index ef209f7..4a70103 100644 --- a/test/qa/qa.jl +++ b/test/qa/qa.jl @@ -1,3 +1,27 @@ -using ODEInterfaceDiffEq, SciMLTesting +using ODEInterfaceDiffEq, SciMLTesting, Test -run_qa(ODEInterfaceDiffEq) +# The SciML common interface ODEInterfaceDiffEq deliberately reexports so that +# `using ODEInterfaceDiffEq` is enough to build and solve an ODE problem, as the README +# example does. Owned and documented upstream; kept in sync with the reexport `export` +# block in src/ODEInterfaceDiffEq.jl. +const REEXPORTS = ( + :CallbackSet, :CheckInit, :ContinuousCallback, :DECallback, :DEIntegrator, + :DEStats, :DefaultInit, :DiscreteCallback, :EnsembleAnalysis, :EnsembleDistributed, + :EnsembleProblem, :EnsembleSerial, :EnsembleSolution, :EnsembleSplitThreads, + :EnsembleSummary, :EnsembleThreads, :NoInit, :NullParameters, :ODEFunction, + :ODEProblem, :ODESolution, :OverrideInit, :ReturnCode, :VectorContinuousCallback, + :change_t_via_interpolation!, :get_tmp_cache, :init, :remake, :savevalues!, + :set_proposed_dt!, :solve, :solve!, :step!, :successful_retcode, :terminate!, + :u_modified!, +) + +run_qa(ODEInterfaceDiffEq; reexports_allow = REEXPORTS) + +@testset "Reexport surface" begin + # Every approved reexport must actually be reachable from `using ODEInterfaceDiffEq`, + # so the allow-list cannot drift into approving names the package no longer provides. + @testset "$name" for name in REEXPORTS + @test name in names(ODEInterfaceDiffEq) + @test isdefined(@__MODULE__, name) + end +end