Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use vcat rather than append! to combine d_discontinuities and tstops #445

Merged
merged 2 commits into from
Jan 27, 2024
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
6 changes: 3 additions & 3 deletions src/common_interface/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function DiffEqBase.__init(prob::DiffEqBase.AbstractODEProblem{uType, tupType, i

progress && Logging.@logmsg(Logging.LogLevel(-1), progress_name, _id=progress_id, progress=0)

append!(tstops, d_discontinuities)
tstops = vcat(tstops, d_discontinuities)
callbacks_internal = DiffEqBase.CallbackSet(callback)

max_len_cb = DiffEqBase.max_vector_callback_length(callbacks_internal)
Expand Down Expand Up @@ -515,7 +515,7 @@ function DiffEqBase.__init(prob::DiffEqBase.AbstractODEProblem{uType, tupType, i

progress && Logging.@logmsg(Logging.LogLevel(-1), progress_name, _id=progress_id, progress=0)

append!(tstops, d_discontinuities)
tstops = vcat(tstops, d_discontinuities)
callbacks_internal = DiffEqBase.CallbackSet(callback)

max_len_cb = DiffEqBase.max_vector_callback_length(callbacks_internal)
Expand Down Expand Up @@ -1026,7 +1026,7 @@ function DiffEqBase.__init(prob::DiffEqBase.AbstractDAEProblem{uType, duType, tu

progress && Logging.@logmsg(Logging.LogLevel(-1), progress_name, _id=progress_id, progress=0)

append!(tstops, d_discontinuities)
tstops = vcat(tstops, d_discontinuities)
callbacks_internal = DiffEqBase.CallbackSet(callback)

max_len_cb = DiffEqBase.max_vector_callback_length(callbacks_internal)
Expand Down
7 changes: 4 additions & 3 deletions test/common_interface/cvode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ sol = solve(prob, CVODE_Adams(); saveat = saveat, save_everystep = false)

@test sol.t == saveat

sol = solve(prob, CVODE_Adams(); tstops = [0.9])

@test 0.9 ∈ sol.t
for tstops in [0.9, [0.9]]
sol = solve(prob, CVODE_Adams(); tstops)
@test 0.9 ∈ sol.t
end

sol = solve(prob, CVODE_Adams())
sol_idxs = solve(prob, CVODE_Adams(); save_idxs = [1], timeseries_errors = false)
Expand Down
6 changes: 4 additions & 2 deletions test/common_interface/ida.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ sol = solve(prob, IDA(); saveat = saveat, save_everystep = true)
@test sol.t != saveat
@test intersect(sol.t, saveat) == saveat
@info "IDA with tstops"
sol = solve(prob, IDA(); tstops = [0.9])
@test 0.9 ∈ sol.t
for tstops in [0.9, [0.9]]
sol = solve(prob, IDA(); tstops)
@test 0.9 ∈ sol.t
end

sol = solve(prob, IDA(); d_discontinuities = [0.9])
@test 0.9 ∈ sol.t
Expand Down
Loading