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
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ODEInterfaceDiffEq"
uuid = "09606e27-ecf5-54fc-bb29-004bd9f985bf"
authors = ["Chris Rackauckas <accounts@chrisrackauckas.com>"]
version = "5.2.2"
version = "5.2.3"

[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
Expand All @@ -10,9 +10,9 @@ DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
FunctionWrappers = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
ODEInterface = "54ca160b-1b9f-5127-a996-1867f4bc2a2c"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SciMLLogging = "a6db7da4-7206-11f0-1eab-35f2a5dbe1d1"
SciMLStructures = "53ae85a6-f571-4167-b2af-e1d143709226"

[compat]
Compat = "4.15"
Expand All @@ -22,13 +22,13 @@ FunctionWrappers = "1.1.3"
LinearAlgebra = "1"
ModelingToolkit = "9, 10, 11"
NonlinearSolve = "3, 4"
ODEInterface = "0.5.1"
ODEInterface = "0.5.2"
ODEProblemLibrary = "1"
Reexport = "1.2.2"
SafeTestsets = "0.0.1, 0.1"
SciMLBase = "3.1"
SciMLLogging = "1.10.1, 2"
SciMLTesting = "2.1"
SciMLStructures = "1"
SciMLTesting = "2.4"
SymbolicIndexingInterface = "0.3"
Test = "1"
julia = "1.10"
Expand Down
9 changes: 3 additions & 6 deletions src/ODEInterfaceDiffEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@ __precompile__()

module ODEInterfaceDiffEq

using Reexport: @reexport
@reexport using DiffEqBase
using DiffEqBase: DiffEqBase
import DiffEqBase

import Compat
import FunctionWrappers
import ODEInterface
import SciMLBase
import SciMLStructures
using DataStructures: BinaryMaxHeap, BinaryMinHeap, counter
using LinearAlgebra: I
using SciMLBase: CallbackSet, ReturnCode, VectorContinuousCallback, check_keywords,
warn_compat
using SciMLLogging: SciMLLogging, @SciMLMessage
import DiffEqBase: DEVerbosity

import DiffEqBase: solve, initialize!, savevalues!
import DiffEqBase: initialize!, savevalues!

const warnkeywords = (
:save_idxs, :d_discontinuities, :unstable_check, :tstops,
Expand Down
20 changes: 8 additions & 12 deletions src/initialize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,20 @@
# Following the pattern from Sundials.jl:
# https://github.com/SciML/Sundials.jl/blob/master/src/common_interface/initialize.jl

import SciMLBase: OverrideInit, NoInit, CheckInit, has_initialization_data
import DiffEqBase: DefaultInit

# Re-export initialization algorithms (including DefaultInit from DiffEqBase)
export OverrideInit, NoInit, CheckInit, DefaultInit
import SciMLBase: has_initialization_data

# DefaultInit: OverrideInit → CheckInit pattern (matching Sundials v5)
# First run OverrideInit to compute consistent initial conditions,
# then run CheckInit to verify the algebraic constraints are satisfied.
function SciMLBase.initialize_dae!(
integrator::ODEInterfaceIntegrator,
initializealg::DefaultInit
initializealg::DiffEqBase.DefaultInit
)
prob = integrator.sol.prob

# First: OverrideInit to compute consistent initial conditions
if has_initialization_data(prob.f)
SciMLBase.initialize_dae!(integrator, OverrideInit())
SciMLBase.initialize_dae!(integrator, SciMLBase.OverrideInit())

# Check if OverrideInit failed
if integrator.sol.retcode == ReturnCode.InitialFailure
Expand All @@ -28,15 +24,15 @@ function SciMLBase.initialize_dae!(
end

# Then: CheckInit to verify algebraic constraints are satisfied
SciMLBase.initialize_dae!(integrator, CheckInit())
SciMLBase.initialize_dae!(integrator, SciMLBase.CheckInit())

return nothing
end

# NoInit: Do nothing, assume initial conditions are correct
function SciMLBase.initialize_dae!(
integrator::ODEInterfaceIntegrator,
initializealg::NoInit
initializealg::SciMLBase.NoInit
)
# No-op: initial conditions are assumed to be correct
return nothing
Expand All @@ -45,7 +41,7 @@ end
# CheckInit: Verify that initial conditions satisfy the algebraic constraints
function SciMLBase.initialize_dae!(
integrator::ODEInterfaceIntegrator,
initializealg::CheckInit
initializealg::SciMLBase.CheckInit
)
prob = integrator.sol.prob
f = prob.f
Expand Down Expand Up @@ -102,7 +98,7 @@ end
# OverrideInit: Use SciMLBase's initialization system (e.g., from ModelingToolkit)
function SciMLBase.initialize_dae!(
integrator::ODEInterfaceIntegrator,
initializealg::OverrideInit
initializealg::SciMLBase.OverrideInit
)
prob = integrator.sol.prob
f = prob.f
Expand Down Expand Up @@ -152,7 +148,7 @@ function SciMLBase.initialize_dae!(

# Update parameters if they changed (in-place via SciMLStructures)
if p !== integrator.p
SS = SciMLBase.SciMLStructures
SS = SciMLStructures
old_vals, _, _ = SS.canonicalize(SS.Tunable(), integrator.p)
new_vals, _, _ = SS.canonicalize(SS.Tunable(), p)
copyto!(old_vals, new_vals)
Expand Down
10 changes: 8 additions & 2 deletions src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ function SciMLBase.__solve(
) where
{uType, tuptType, isinplace, AlgType <: ODEInterfaceAlgorithm}
tType = eltype(tuptType)
verbose_spec = DiffEqBase._process_verbose_param(verbose)
verbose_spec = if verbose isa SciMLLogging.AbstractVerbosityPreset
DiffEqBase.DEVerbosity(verbose)
elseif verbose isa Bool
throw(ArgumentError("Passing a `Bool` for `verbose` is no longer supported in OrdinaryDiffEq v7. Use `DEVerbosity()` or a preset like `Standard()`, `None()`, etc. from SciMLLogging."))
else
verbose
end

isstiff = alg isa ODEInterfaceImplicitAlgorithm
warned = !isempty(kwargs) && check_keywords(alg, kwargs, warnlist)
Expand Down Expand Up @@ -81,7 +87,7 @@ function SciMLBase.__solve(
prob, alg, ts, _timeseries,
timeseries_errors = timeseries_errors,
calculate_error = false,
stats = DiffEqBase.Stats(0),
stats = SciMLBase.DEStats(0),
retcode = ReturnCode.Default
)

Expand Down
4 changes: 3 additions & 1 deletion test/callbacks.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ODEInterfaceDiffEq, Test
using DiffEqBase, ODEInterfaceDiffEq, Test

callback_f = function (du, u, p, t)
du[1] = u[2]
Expand All @@ -24,3 +24,5 @@ sol = solve(prob, dopri5(), callback = callback, dtmax = 0.5)
@test sol(4.0)[1] > 0
sol = solve(prob, dopri5(), callback = callback, save_everystep = true)
@test sol(4.0)[1] > -1.0e-12

@test_throws ArgumentError solve(prob, dopri5(), verbose = true)
2 changes: 1 addition & 1 deletion test/qa/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Aqua = "0.8"
JET = "0.9,0.10,0.11"
SafeTestsets = "0.0.1, 0.1"
SciMLTesting = "2.1"
SciMLTesting = "2.4"
Test = "1"
julia = "1.10"
44 changes: 2 additions & 42 deletions test/qa/qa.jl
Original file line number Diff line number Diff line change
@@ -1,43 +1,3 @@
using SciMLTesting, ODEInterfaceDiffEq, Test
using JET
using ODEInterfaceDiffEq, SciMLTesting

# all_qualified_accesses_via_owners: names accessed via SciMLBase that SciMLBase does
# not own. SciMLStructures (the SciMLStructures-owned module) and recursive_bottom_eltype
# (RecursiveArrayTools-owned) are both reached through the SciMLBase reexport.
const QUALIFIED_VIA_OWNERS_IGNORE = (
:SciMLStructures, :recursive_bottom_eltype,
)

# all_qualified_accesses_are_public: names still non-public in the registered releases.
# - SciMLBase-owned solver-extension internals (SciMLBase 3.28.1 still private).
# - recursive_bottom_eltype (RecursiveArrayTools-owned) / SciMLStructures
# (SciMLStructures-owned), accessed via the SciMLBase reexport: non-public there.
# - DiffEqBase-owned internals (DiffEqBase 7.6.0 still private).
# - ODEInterface C-wrapper solver entry points and constants (ODEInterface 0.5.1, no
# `public` declarations).
const QUALIFIED_ARE_PUBLIC_IGNORE = (
:OUTPUTFCN_CALL_REASON, :OUTPUTFCN_CALL_STEP, :OUTPUTFCN_DENSE,
:OUTPUTFCN_RET_CONTINUE, :OUTPUTFCN_RET_CONTINUE_XCHANGED, :OUTPUTFCN_WODENSE,
:OptionsODE, :RHS_CALL_INSITU, :SciMLStructures, :Stats, :__solve,
:_process_verbose_param, :calculate_solution_errors!, :ddeabm, :ddebdf, :dop853,
:dopri5, :initialize_dae!, :odex, :radau, :radau5, :recursive_bottom_eltype,
:rodas, :seulex, :solution_new_retcode,
)

const API_DOCS_RENDERED_IGNORE = (
Tuple(names(ODEInterfaceDiffEq.DiffEqBase))...,
:OverrideInit, :NoInit, :CheckInit, :DefaultInit,
)

run_qa(
ODEInterfaceDiffEq;
api_docs_kwargs = (;
rendered = true,
rendered_ignore = API_DOCS_RENDERED_IGNORE,
),
explicit_imports = true,
ei_kwargs = (;
all_qualified_accesses_via_owners = (; ignore = QUALIFIED_VIA_OWNERS_IGNORE),
all_qualified_accesses_are_public = (; ignore = QUALIFIED_ARE_PUBLIC_IGNORE),
),
)
run_qa(ODEInterfaceDiffEq)
Loading