Skip to content

Commit

Permalink
Update to match the OrdinaryDiffEq interpolation change (#279)
Browse files Browse the repository at this point in the history
* Update to match the OrdinaryDiffEq interpolation change

* Update utils.jl

* Update solve.jl

* Update src/utils.jl

* Update CI.yml
  • Loading branch information
ChrisRackauckas authored Jan 9, 2024
1 parent 917c348 commit 6485a14
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 34 deletions.
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
continue-on-error: ${{ matrix.version == 'nightly' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1'
Expand Down
21 changes: 7 additions & 14 deletions src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
30 changes: 10 additions & 20 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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, (), ();
Expand Down

0 comments on commit 6485a14

Please sign in to comment.