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
4 changes: 4 additions & 0 deletions src/systems/nonlinear/initializesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,10 @@ function SciMLBase.remake_initialization_data(

oldinitdata = odefn.initialization_data

# We _always_ build initialization now. So if we didn't build it before, don't do
# it now
oldinitdata === nothing && return nothing

if !(eltype(u0) <: Pair) && !(eltype(p) <: Pair)
oldinitdata === nothing && return nothing

Expand Down
15 changes: 15 additions & 0 deletions test/jumpsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -551,3 +551,18 @@ end
sol = solve(jprob, SSAStepper())
@test eltype(sol[X]) === Int64
end

@testset "Issue#3571: `remake(::JumpProblem)`" begin
@variables X(t)
@parameters a b
eq = D(X) ~ a
rate = b * X
affect = [X ~ X - 1]
crj = ConstantRateJump(rate, affect)
@named jsys = JumpSystem([crj, eq], t, [X], [a, b])
jsys = complete(jsys)
oprob = ODEProblem(jsys, [:X => 1.0], (0.0, 10.0), [:a => 1.0, :b => 0.5])
jprob = JumpProblem(jsys, oprob)
jprob2 = remake(jprob; u0 = [:X => 10.0])
@test jprob2[X] ≈ 10.0
end
Loading