Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
28 changes: 26 additions & 2 deletions src/ODEInterfaceDiffEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
28 changes: 26 additions & 2 deletions test/qa/qa.jl
Original file line number Diff line number Diff line change
@@ -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
Loading