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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ StaticArrays = "0.10, 0.11, 0.12, 1.0"
StochasticDelayDiffEq = "1.10"
StochasticDiffEq = "6.72.1"
SymbolicIndexingInterface = "0.3.39"
SymbolicUtils = "3.26.1"
SymbolicUtils = "3.30.0"
Symbolics = "6.40"
URIs = "1"
UnPack = "0.1, 1.0"
Expand Down
7 changes: 6 additions & 1 deletion src/systems/problem_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,12 @@ struct SymbolicTstops{F}
end

function (st::SymbolicTstops)(p, tspan)
unique!(sort!(reduce(vcat, st.fn(p, tspan...))))
buffer = reduce(vcat, st.fn(p, tspan...))
if ArrayInterface.ismutable(buffer)
return unique!(sort!(buffer))
else
return unique(sort(buffer))
end
end

function SymbolicTstops(
Expand Down
4 changes: 4 additions & 0 deletions test/odesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,10 @@ end
sol2 = solve(prob2, DImplicitEuler())
expected_tstops = unique!(sort!(vcat(0.0:0.075:10.0, 0.1, 0.2, 0.65, 0.35, 0.45)))
@test all(x -> any(isapprox(x, atol = 1e-6), sol2.t), expected_tstops)

@mtkcompile sys = System([D(x) ~ x + p], t; tstops = [[p]])
prob = ODEProblem(sys, [], (0.0, 1.0))
@test prob.kwargs[:tstops](prob.p, prob.tspan) ≈ [0.15]
end

@testset "Validate input types" begin
Expand Down
Loading