From 6485a1488072bdde22e9a2b72bcbc47d1a2f04d2 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Mon, 8 Jan 2024 21:29:57 -0500 Subject: [PATCH] Update to match the OrdinaryDiffEq interpolation change (#279) * Update to match the OrdinaryDiffEq interpolation change * Update utils.jl * Update solve.jl * Update src/utils.jl * Update CI.yml --- .github/workflows/CI.yml | 1 + src/solve.jl | 21 +++++++-------------- src/utils.jl | 30 ++++++++++-------------------- 3 files changed, 18 insertions(+), 34 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 517fe3d..25b6820 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -17,6 +17,7 @@ jobs: continue-on-error: ${{ matrix.version == 'nightly' }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: version: - '1' diff --git a/src/solve.jl b/src/solve.jl index ae779f3..1378570 100644 --- a/src/solve.jl +++ b/src/solve.jl @@ -168,20 +168,13 @@ function DiffEqBase.__init(prob::DiffEqBase.AbstractDDEProblem, stats = DDEStats(0) # create solution - if iscomposite(alg) - id = OrdinaryDiffEq.CompositeInterpolationData(f_with_history, timeseries, ts, ks, - Int[], dense, cache, differential_vars) - sol = DiffEqBase.build_solution(prob, alg.alg, ts, timeseries; - dense = dense, k = ks, interp = id, - alg_choice = id.alg_choice, calculate_error = false, - stats = stats) - else - id = OrdinaryDiffEq.InterpolationData(f_with_history, timeseries, ts, ks, dense, - cache, differential_vars) - sol = DiffEqBase.build_solution(prob, alg.alg, ts, timeseries; - dense = dense, k = ks, interp = id, - calculate_error = false, stats = stats) - end + alg_choice = iscomposite(alg) ? Int[] : nothing + id = OrdinaryDiffEq.InterpolationData(f_with_history, timeseries, ts, ks, + alg_choice, dense, cache, differential_vars, false) + sol = DiffEqBase.build_solution(prob, alg.alg, ts, timeseries; + dense = dense, k = ks, interp = id, + alg_choice = id.alg_choice, calculate_error = false, + stats = stats) # retrieve time stops, time points at which solutions is saved, and discontinuities tstops_internal = OrdinaryDiffEq.initialize_tstops(tType, tstops, d_discontinuities, diff --git a/src/utils.jl b/src/utils.jl index b85b71c..82756bb 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -299,26 +299,16 @@ function build_history_function(prob, alg, rate_prototype, reltol, differential_ Val(isinplace(prob))) # build dense interpolation of history - if iscomposite(alg) - ode_alg_choice = Int[] - ode_id = OrdinaryDiffEq.CompositeInterpolationData(ode_f, ode_timeseries, ode_ts, - ode_ks, - ode_alg_choice, true, ode_cache, - differential_vars) # dense = true - ode_sol = DiffEqBase.build_solution(ode_prob, alg.alg, ode_ts, ode_timeseries; - dense = true, k = ode_ks, interp = ode_id, - alg_choice = ode_alg_choice, - calculate_error = false, - stats = DiffEqBase.Stats(0)) - else - ode_id = OrdinaryDiffEq.InterpolationData(ode_f, ode_timeseries, ode_ts, ode_ks, - true, ode_cache, - differential_vars) # dense = true - ode_sol = DiffEqBase.build_solution(ode_prob, alg.alg, ode_ts, ode_timeseries; - dense = true, k = ode_ks, interp = ode_id, - calculate_error = false, - stats = DiffEqBase.Stats(0)) - end + ode_alg_choice = iscomposite(alg) ? Int[] : nothing + ode_id = OrdinaryDiffEq.InterpolationData(ode_f, ode_timeseries, ode_ts, + ode_ks, + ode_alg_choice, true, ode_cache, + differential_vars, false) + ode_sol = DiffEqBase.build_solution(ode_prob, alg.alg, ode_ts, ode_timeseries; + dense = true, k = ode_ks, interp = ode_id, + alg_choice = ode_alg_choice, + calculate_error = false, + stats = DiffEqBase.Stats(0)) # reserve capacity sizehint!(ode_sol, alg.alg, tspan, (), ();