Skip to content

Commit

Permalink
Update function signatures to include type annotations for callback p…
Browse files Browse the repository at this point in the history
…arameter
  • Loading branch information
warisa-r committed Jul 29, 2024
1 parent 45dfeb4 commit 0c4b2d4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/time_integration/methods_2N.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/time_integration/methods_3Sstar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0c4b2d4

Please sign in to comment.