Skip to content

Commit

Permalink
Merge pull request #277 from SciML/jd/datastructures_patch
Browse files Browse the repository at this point in the history
datastructures patch
  • Loading branch information
jd-lara authored Aug 20, 2020
2 parents 659de1c + 3863810 commit 0e088b5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ os:
- osx
- linux
julia:
- 1.3
- 1.4
- 1.5
- nightly
matrix:
allow_failures:
Expand Down
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Sundials"
uuid = "c3572dad-4567-51f8-b174-8c6c989267f4"
authors = ["Chris Rackauckas <[email protected]>"]
version = "4.2.6"
version = "4.3.0"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Expand All @@ -16,11 +16,11 @@ Sundials_jll = "fb77eaff-e24c-56d4-86b1-d163f2edb164"

[compat]
CEnum = "0.2, 0.3, 0.4"
DataStructures = "0.17.0, 0.18"
DiffEqBase = "6.21"
DataStructures = "0.18"
DiffEqBase = "6.44"
Reexport = "0.2"
Sundials_jll = "5.2"
julia = "1.3"
julia = "1"

[extras]
DiffEqOperators = "9fdde737-9c7f-55bf-ade8-46b3f136cc48"
Expand Down
7 changes: 4 additions & 3 deletions src/common_interface/integrator_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ DiffEqBase.postamble!(integrator::AbstractSundialsIntegrator) = nothing

@inline function DiffEqBase.step!(integrator::AbstractSundialsIntegrator)
if integrator.opts.advance_to_tstop
while integrator.tdir*(integrator.t-DataStructures.top(integrator.opts.tstops)) < -1e6eps()
tstop = DataStructures.top(integrator.opts.tstops)
# The call to first is an overload of Base.first implemented in DataStructures
while integrator.tdir*(integrator.t-first(integrator.opts.tstops)) < -1e6eps()
tstop = first(integrator.opts.tstops)
set_stop_time(integrator,tstop)
integrator.tprev = integrator.t
if !(typeof(integrator.opts.callback.continuous_callbacks)<:Tuple{})
Expand All @@ -174,7 +175,7 @@ DiffEqBase.postamble!(integrator::AbstractSundialsIntegrator) = nothing
integrator.uprev .= integrator.u
end
if !isempty(integrator.opts.tstops)
tstop = DataStructures.top(integrator.opts.tstops)
tstop = first(integrator.opts.tstops)
set_stop_time(integrator,tstop)
solver_step(integrator,tstop)
else
Expand Down
3 changes: 2 additions & 1 deletion src/common_interface/integrator_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ function DiffEqBase.savevalues!(integrator::AbstractSundialsIntegrator,force_sav
saved, savedexactly = false, false
!integrator.opts.save_on && return saved, savedexactly
uType = eltype(integrator.sol.u)
# The call to first is an overload of Base.first implemented in DataStructures
while !isempty(integrator.opts.saveat) &&
integrator.tdir*DataStructures.top(integrator.opts.saveat) < integrator.tdir*integrator.t
integrator.tdir*first(integrator.opts.saveat) < integrator.tdir*integrator.t
saved = true
curt = pop!(integrator.opts.saveat)

Expand Down
7 changes: 4 additions & 3 deletions src/common_interface/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1153,8 +1153,9 @@ function DiffEqBase.solve!(integrator::AbstractSundialsIntegrator)
while !isempty(integrator.opts.tstops)
# Sundials can have floating point issues approaching a tstop if
# there is a modifying event each
while integrator.tdir*(integrator.t-DataStructures.top(integrator.opts.tstops)) < -1e6eps()
tstop = DataStructures.top(integrator.opts.tstops)
# The call to first is an overload of Base.first implemented in DataStructures
while integrator.tdir*(integrator.t-first(integrator.opts.tstops)) < -1e6eps()
tstop = first(integrator.opts.tstops)
set_stop_time(integrator,tstop)
integrator.tprev = integrator.t
if !(typeof(integrator.opts.callback.continuous_callbacks)<:Tuple{})
Expand Down Expand Up @@ -1217,7 +1218,7 @@ end
function handle_tstop!(integrator::AbstractSundialsIntegrator)
tstops = integrator.opts.tstops
if !isempty(tstops)
if integrator.tdir*(integrator.t-DataStructures.top(integrator.opts.tstops)) > -1e6eps()
if integrator.tdir*(integrator.t-first(integrator.opts.tstops)) > -1e6eps()
pop!(tstops)
t = integrator.t
integrator.just_hit_tstop = true
Expand Down

0 comments on commit 0e088b5

Please sign in to comment.