From 0c4b2d4e894d0d7febb07c6e6192b4e531bd7ca4 Mon Sep 17 00:00:00 2001 From: Warisa Date: Mon, 29 Jul 2024 13:36:36 +0200 Subject: [PATCH] Update function signatures to include type annotations for callback parameter --- src/time_integration/methods_2N.jl | 4 +--- src/time_integration/methods_3Sstar.jl | 4 +--- .../paired_explicit_runge_kutta/methods_PERK2.jl | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/time_integration/methods_2N.jl b/src/time_integration/methods_2N.jl index e5b970c6bda..136fcd43d27 100644 --- a/src/time_integration/methods_2N.jl +++ b/src/time_integration/methods_2N.jl @@ -105,7 +105,7 @@ function Base.getproperty(integrator::SimpleIntegrator2N, field::Symbol) end function init(ode::ODEProblem, alg::SimpleAlgorithm2N; - dt, callback = nothing, kwargs...) + dt, callback::Union{CallbackSet, Nothing} = nothing, kwargs...) u = copy(ode.u0) du = similar(u) u_tmp = similar(u) @@ -124,8 +124,6 @@ function init(ode::ODEProblem, alg::SimpleAlgorithm2N; foreach(callback.discrete_callbacks) do cb cb.initialize(cb, integrator.u, integrator.t, integrator) end - elseif !isnothing(callback) - error("unsupported") end return integrator diff --git a/src/time_integration/methods_3Sstar.jl b/src/time_integration/methods_3Sstar.jl index 6128d1551d8..0620bce95bd 100644 --- a/src/time_integration/methods_3Sstar.jl +++ b/src/time_integration/methods_3Sstar.jl @@ -172,7 +172,7 @@ function Base.getproperty(integrator::SimpleIntegrator3Sstar, field::Symbol) end function init(ode::ODEProblem, alg::SimpleAlgorithm3Sstar; - dt, callback = nothing, kwargs...) + dt, callback::Union{CallbackSet, Nothing} = nothing, kwargs...) u = copy(ode.u0) du = similar(u) u_tmp1 = similar(u) @@ -194,8 +194,6 @@ function init(ode::ODEProblem, alg::SimpleAlgorithm3Sstar; foreach(callback.discrete_callbacks) do cb cb.initialize(cb, integrator.u, integrator.t, integrator) end - elseif !isnothing(callback) - error("unsupported") end return integrator diff --git a/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl b/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl index ddcc1b365be..cd709c3fa90 100644 --- a/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl +++ b/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl @@ -261,7 +261,7 @@ function Base.getproperty(integrator::PairedExplicitRK, field::Symbol) end function init(ode::ODEProblem, alg::PairedExplicitRK2; - dt, callback = nothing, kwargs...) + dt, callback::Union{CallbackSet, Nothing} = nothing, kwargs...) u0 = copy(ode.u0) du = zero(u0) u_tmp = zero(u0) @@ -291,8 +291,6 @@ function init(ode::ODEProblem, alg::PairedExplicitRK2; for cb in callback.discrete_callbacks cb.initialize(cb, integrator.u, integrator.t, integrator) end - elseif !isnothing(callback) - error("unsupported") end return integrator