Skip to content

Commit 47a6018

Browse files
Update return codes from symbols to ReturnCode
1 parent 3d56e68 commit 47a6018

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

src/iterator_interface.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
if integrator.opts.advance_to_tstop
33
@inbounds while integrator.tdir * integrator.t < first(integrator.opts.tstops)
44
loopheader!(integrator)
5-
check_error!(integrator) != :Success && return
5+
check_error!(integrator) != ReturnCode.Success && return
66
perform_step!(integrator,integrator.cache)
77
loopfooter!(integrator)
88
end
@@ -12,7 +12,7 @@
1212
@inbounds loopfooter!(integrator)
1313
@inbounds while !integrator.accept_step
1414
loopheader!(integrator)
15-
check_error!(integrator) != :Success && return
15+
check_error!(integrator) != ReturnCode.Success && return
1616
perform_step!(integrator,integrator.cache)
1717
loopfooter!(integrator)
1818
end

src/solve.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ function DiffEqBase.solve!(integrator::SDEIntegrator)
607607
@inbounds while !isempty(integrator.opts.tstops)
608608
while integrator.tdir*integrator.t < first(integrator.opts.tstops)
609609
loopheader!(integrator)
610-
if integrator.do_error_check && check_error!(integrator) != :Success
610+
if integrator.do_error_check && check_error!(integrator) != ReturnCode.Success
611611
return integrator.sol
612612
end
613613
perform_step!(integrator,integrator.cache)
@@ -628,7 +628,7 @@ function DiffEqBase.solve!(integrator::SDEIntegrator)
628628
if integrator.sol.retcode != :Default
629629
return integrator.sol
630630
end
631-
integrator.sol = DiffEqBase.solution_new_retcode(integrator.sol,:Success)
631+
integrator.sol = DiffEqBase.solution_new_retcode(integrator.sol,ReturnCode.Success)
632632
end
633633

634634
# Helpers

test/levy_areas.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ end
2828

2929
for alg LevyArea.ITER_INT_ALGS
3030
@test diag(StochasticDiffEq.get_iterated_I(dt, W.dW, W.dZ, alg, nothing, 1)) == true_diag
31-
end
31+
end
3232
end
3333

3434
# Commutative noise tests
@@ -44,7 +44,7 @@ end
4444

4545
for alg LevyArea.ITER_INT_ALGS
4646
@test diag(StochasticDiffEq.get_iterated_I(dt, W.dW, W.dZ, alg, nothing, 1)) == diag(true_commute)
47-
end
47+
end
4848
end
4949

5050

@@ -90,7 +90,7 @@ function test_compare_sample_mean_and_var(alg, Δ, m, samples=Int(1e6), p=Int(1e
9090
calculate_step!(W,dt,nothing,nothing)
9191
for i in 1:10
9292
accept_step!(W,dt,nothing,nothing)
93-
end
93+
end
9494

9595
xs = [StochasticDiffEq.get_iterated_I(Δ, W.dW, W.dZ, alg, p, 1)[1,2]]
9696
coms = [1//2*W.dW[1]*W.dW[2]]
@@ -100,7 +100,7 @@ function test_compare_sample_mean_and_var(alg, Δ, m, samples=Int(1e6), p=Int(1e
100100
accept_step!(W,Δ,nothing,nothing)
101101
com = 1//2*W.dW[1]*W.dW[2]
102102
x = StochasticDiffEq.get_iterated_I(Δ, W.dW, W.dZ, alg, p, 1)[1,2]
103-
103+
104104
push!(xs,x)
105105
push!(coms,com)
106106
end
@@ -119,7 +119,7 @@ end
119119
Random.seed!(seed)
120120
I = StochasticDiffEq.get_iterated_I(dt, W.dW, W.dZ, alg, 1, 1)
121121
Random.seed!(seed)
122-
A = LevyArea.levyarea(W.dW/√dt, 1, alg)
122+
A = LevyArea.levyarea(W.dW/√dt, 1, alg)
123123
@test dt*A + true_commute == I # because of correction with \mu term
124124
@test diag(A) == diag(zero(A))
125125
@test diag(true_commute) == diag(I)
@@ -131,15 +131,15 @@ end
131131

132132
# test other StatsJ
133133
@time test_compare_sample_mean_and_var(alg, 1.0, 2)
134-
end
134+
end
135135
end
136136

137137
@testset "Simulate non-com. SDEs tests" begin
138138
u₀ = [0.0,0.0,0.0]
139139
f(u,p,t) = [0.0,0.0,0.0]
140140
g(u,p,t) = [1.0 0.0;0.0 1.0;0.0 u[1]]
141141
f!(du,u,p,t) = du .*= false
142-
function g!(du,u,p,t)
142+
function g!(du,u,p,t)
143143
du[1,1] = 1.0
144144
du[2,2] = 1.0
145145
du[3,2] = u[1]
@@ -151,16 +151,16 @@ end
151151
prob! = SDEProblem(f!,g!,u₀,(0.0,1.0); noise_rate_prototype=zeros(3,2))
152152

153153
sol = solve(prob, RKMilGeneral(;ii_approx=IICommutative()), dt=dt, adaptive=false)
154-
@test sol.retcode == :Success
154+
@test sol.retcode == ReturnCode.Success
155155
sol = solve(prob, RKMilGeneral(;ii_approx=IILevyArea()), dt=dt, adaptive=false)
156-
@test sol.retcode == :Success
156+
@test sol.retcode == ReturnCode.Success
157157
sol = solve(prob, RKMilGeneral(ii_approx=Fourier()), dt=dt, adaptive=false)
158-
@test sol.retcode == :Success
158+
@test sol.retcode == ReturnCode.Success
159159

160160
sol = solve(prob!, RKMilGeneral(;ii_approx=IICommutative()), dt=dt, adaptive=false)
161-
@test sol.retcode == :Success
161+
@test sol.retcode == ReturnCode.Success
162162
sol = solve(prob!, RKMilGeneral(;ii_approx=IILevyArea()), dt=dt, adaptive=false)
163-
@test sol.retcode == :Success
163+
@test sol.retcode == ReturnCode.Success
164164
sol = solve(prob!, RKMilGeneral(ii_approx=Fourier()), dt=dt, adaptive=false)
165-
@test sol.retcode == :Success
165+
@test sol.retcode == ReturnCode.Success
166166
end

test/sparsediff_tests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ prob_sp = SDEProblem(sdefun_sp,g,u0,tspan)
4444
prob_std = SDEProblem(f,g,u0,tspan)
4545

4646
sol_sp=solve(prob_sp,SKenCarp(autodiff=false))
47-
@test sol_sp.retcode==:Success#test sparse finitediff
47+
@test sol_sp.retcode== ReturnCode.Success#test sparse finitediff
4848
sol=solve(prob_std,SKenCarp(autodiff=false))
4949
@test sol_sp.u[end]sol.u[end] atol=1e-4
5050
@test length(sol_sp.t)==length(sol.t)

0 commit comments

Comments
 (0)