diff --git a/src/ode_default_alg.jl b/src/ode_default_alg.jl index 272beae3..56a439f5 100644 --- a/src/ode_default_alg.jl +++ b/src/ode_default_alg.jl @@ -18,9 +18,9 @@ function default_algorithm(prob::DiffEqBase.AbstractODEProblem{uType, tType, inp # Bad interaction with ForwardDiff #!(tType <: AbstractFloat) && (:adaptive ∉ keys(o)) && push!(extra_kwargs,:adaptive=>false) - if typeof(prob.f) <: SplitFunction + if prob.f isa SplitFunction alg = KenCarp4(autodiff = false) - elseif typeof(prob.f) <: DynamicalODEFunction + elseif prob.f isa DynamicalODEFunction if tol_level == :low_tol || tol_level == :med_tol alg = Tsit5() else diff --git a/test/default_dae_alg_test.jl b/test/default_dae_alg_test.jl index a0bdb76b..1e38436f 100644 --- a/test/default_dae_alg_test.jl +++ b/test/default_dae_alg_test.jl @@ -13,4 +13,4 @@ prob_dae_resrob = DAEProblem(f, du0, u0, (0.0, 100000.0)) prob = prob_dae_resrob sol = solve(prob) -@test typeof(sol.alg) <: DifferentialEquations.Sundials.IDA +@test sol.alg isa DifferentialEquations.Sundials.IDA diff --git a/test/default_dde_alg_test.jl b/test/default_dde_alg_test.jl index de1bdf33..05379786 100644 --- a/test/default_dde_alg_test.jl +++ b/test/default_dde_alg_test.jl @@ -10,6 +10,6 @@ prob = DDEProblem(f, 1.0, h, (0.0, 10.0), constant_lags = lags) sol = solve(prob) -@test typeof(sol.alg) <: CompositeAlgorithm -@test typeof(sol.alg.algs[1]) <: Tsit5 -@test typeof(sol.alg.algs[2]) <: Rosenbrock23 +@test sol.alg isa CompositeAlgorithm +@test sol.alg.algs[1] isa Tsit5 +@test sol.alg.algs[2] isa Rosenbrock23 diff --git a/test/default_discrete_alg_test.jl b/test/default_discrete_alg_test.jl index d5b9d7ba..df7f0b84 100644 --- a/test/default_discrete_alg_test.jl +++ b/test/default_discrete_alg_test.jl @@ -2,4 +2,4 @@ using DifferentialEquations, Test prob = DiscreteProblem(zeros(2), (0.0, 1.0)) sol = solve(prob) -@test typeof(sol.alg) <: FunctionMap +@test sol.alg isa FunctionMap diff --git a/test/default_ode_alg_test.jl b/test/default_ode_alg_test.jl index b35c2256..e034c378 100644 --- a/test/default_ode_alg_test.jl +++ b/test/default_ode_alg_test.jl @@ -9,31 +9,31 @@ alg, kwargs = default_algorithm(prob_ode_2Dlinear; dt = 1 // 2^(4)) integ = init(prob_ode_2Dlinear; dt = 1 // 2^(4)) sol = solve(prob_ode_2Dlinear; dt = 1 // 2^(4)) -@test typeof(sol.alg.algs[1]) <: Tsit5 -@test typeof(sol.alg.algs[2]) <: Rosenbrock23 +@test sol.alg.algs[1] isa Tsit5 +@test sol.alg.algs[2] isa Rosenbrock23 sol = solve(prob_ode_2Dlinear; reltol = 1e-1) -@test typeof(sol.alg.algs[1]) <: Tsit5 -@test typeof(sol.alg.algs[2]) <: Rosenbrock23 +@test sol.alg.algs[1] isa Tsit5 +@test sol.alg.algs[2] isa Rosenbrock23 sol = solve(prob_ode_2Dlinear; reltol = 1e-7) -@test typeof(sol.alg.algs[1]) <: Vern7 -@test typeof(sol.alg.algs[2]) <: Rodas5P +@test sol.alg.algs[1] isa Vern7 +@test sol.alg.algs[2] isa Rodas5P sol = solve(prob_ode_2Dlinear; reltol = 1e-10) -@test typeof(sol.alg.algs[1]) <: Vern7 -@test typeof(sol.alg.algs[2]) <: Rodas5P +@test sol.alg.algs[1] isa Vern7 +@test sol.alg.algs[2] isa Rodas5P sol = solve(prob_ode_2Dlinear; alg_hints = [:stiff]) -@test typeof(sol.alg) <: Rodas5P +@test sol.alg isa Rodas5P sol = solve(prob_ode_2Dlinear; alg_hints = [:stiff], reltol = 1e-1) -@test typeof(sol.alg) <: Rosenbrock23 +@test sol.alg isa Rosenbrock23 const linear_bigα = parse(BigFloat, "1.01") f = (du, u, p, t) -> begin @@ -46,18 +46,18 @@ prob_ode_bigfloat2Dlinear = ODEProblem(f, map(BigFloat, rand(4, 2)) .* ones(4, 2 (0.0, 1.0)) sol = solve(prob_ode_bigfloat2Dlinear; dt = 1 // 2^(4)) -@test typeof(sol.alg.algs[1]) <: Vern7 -@test typeof(sol.alg.algs[2]) <: Rodas5P +@test sol.alg.algs[1] isa Vern7 +@test sol.alg.algs[2] isa Rodas5P default_algorithm(prob_ode_bigfloat2Dlinear; alg_hints = [:stiff]) sol = solve(prob_ode_bigfloat2Dlinear; alg_hints = [:stiff]) -@test typeof(sol.alg) <: Rodas5P +@test sol.alg isa Rodas5P sol = solve(prob_ode_bigfloat2Dlinear, nothing; alg_hints = [:stiff]) -@test typeof(sol.alg) <: Rodas5P +@test sol.alg isa Rodas5P struct FooAlg end @@ -73,21 +73,21 @@ prob = ODEProblem(f, rand(4, 2) .* ones(4, 2) / 2, (0.0, 1.0)) sol = solve(prob; alg_hints = [:stiff]) -@test typeof(sol.alg) <: Rodas5P +@test sol.alg isa Rodas5P sol = solve(prob; alg_hints = [:stiff], reltol = 1e-1) -@test typeof(sol.alg) <: Rosenbrock23 +@test sol.alg isa Rosenbrock23 sol = solve(prob; alg_hints = [:stiff], callback = CallbackSet()) -@test typeof(sol.alg) <: Rodas5P +@test sol.alg isa Rodas5P prob = ODEProblem(f, rand(4, 2) .* ones(4, 2) / 2, (0.0, 1.0)) alg, kwargs = default_algorithm(prob; alg_hints = [:stiff]) -@test typeof(alg) <: Rodas5P +@test alg isa Rodas5P m = 1.0 ω = 1.0 @@ -104,4 +104,4 @@ tspan = (0.0, 10.0) prob = SecondOrderODEProblem(mass_system!, v0, u0, tspan) sol = solve(prob) -@test typeof(sol.alg) <: Tsit5 +@test sol.alg isa Tsit5 diff --git a/test/default_rode_alg_test.jl b/test/default_rode_alg_test.jl index 850e8e12..09a8f462 100644 --- a/test/default_rode_alg_test.jl +++ b/test/default_rode_alg_test.jl @@ -6,4 +6,4 @@ tspan = (0.0, 1.0) prob = RODEProblem(f, u0, tspan) sol = solve(prob, dt = 1 / 100) -@test typeof(sol.alg) <: RandomEM +@test sol.alg isa RandomEM diff --git a/test/default_sde_alg_test.jl b/test/default_sde_alg_test.jl index d2ff247c..8296222c 100644 --- a/test/default_sde_alg_test.jl +++ b/test/default_sde_alg_test.jl @@ -12,14 +12,14 @@ Random.seed!(100) prob = prob_sde_additive sol = solve(prob, dt = 1 / 2^(3)) -@test typeof(sol.alg) <: SOSRI +@test sol.alg isa SOSRI sol = solve(prob, dt = 1 / 2^(3), alg_hints = [:additive]) -@test typeof(sol.alg) <: SOSRA +@test sol.alg isa SOSRA sol = solve(prob, dt = 1 / 2^(3), alg_hints = [:Stratonovich]) @test StochasticDiffEq.alg_interpretation(sol.alg) == :Stratonovich -@test typeof(sol.alg) <: RKMil +@test sol.alg isa RKMil f = (du, u, p, t) -> du .= 1.01u g = function (du, u, p, t) @@ -35,13 +35,13 @@ end prob = SDEProblem(f, g, ones(2), (0.0, 1.0), noise_rate_prototype = zeros(2, 4)) sol = solve(prob, dt = 1 / 2^(3)) -@test typeof(sol.alg) <: LambaEM +@test sol.alg isa LambaEM sol = solve(prob, dt = 1 / 2^(3), alg_hints = [:stiff]) -@test typeof(sol.alg) <: ISSEM +@test sol.alg isa ISSEM sol = solve(prob, dt = 1 / 2^(3), alg_hints = [:additive]) -@test typeof(sol.alg) <: SOSRA +@test sol.alg isa SOSRA sol = solve(prob, dt = 1 / 2^(3), alg_hints = [:Stratonovich]) -@test typeof(sol.alg) <: LambaEulerHeun +@test sol.alg isa LambaEulerHeun