Skip to content

Commit

Permalink
Merge pull request #2032 from pepijndevos/pv/progress
Browse files Browse the repository at this point in the history
log progress with configurable ID
  • Loading branch information
ChrisRackauckas authored Oct 6, 2023
2 parents 8451c2e + 5a66c02 commit 4231f9c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/integrators/integrator_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function _postamble!(integrator)
if integrator.opts.progress
@logmsg(LogLevel(-1),
integrator.opts.progress_name,
_id=:OrdinaryDiffEq,
_id=integrator.opts.progress_id,
message=integrator.opts.progress_message(integrator.dt, integrator.u,
integrator.p, integrator.t),
progress="done")
Expand Down Expand Up @@ -270,7 +270,7 @@ function _loopfooter!(integrator)
t1, t2 = integrator.sol.prob.tspan
@logmsg(LogLevel(-1),
integrator.opts.progress_name,
_id=:OrdinaryDiffEq,
_id=integrator.opts.progress_id,
message=integrator.opts.progress_message(integrator.dt, integrator.u,
integrator.p, integrator.t),
progress=(integrator.t - t1) / (t2 - t1))
Expand Down
1 change: 1 addition & 0 deletions src/integrators/type.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ mutable struct DEOptions{absType, relType, QT, tType, Controller, F1, F2, F3, F4
progress_steps::Int
progress_name::String
progress_message::F6
progress_id::Symbol
timeseries_errors::Bool
dense_errors::Bool
dense::Bool
Expand Down
4 changes: 3 additions & 1 deletion src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function DiffEqBase.__init(prob::Union{DiffEqBase.AbstractODEProblem,
progress_steps = 1000,
progress_name = "ODE",
progress_message = ODE_DEFAULT_PROG_MESSAGE,
progress_id = gensym("OrdinaryDiffEq"),
userdata = nothing,
allow_extrapolation = alg_extrapolates(alg),
initialize_integrator = true,
Expand Down Expand Up @@ -99,7 +100,7 @@ function DiffEqBase.__init(prob::Union{DiffEqBase.AbstractODEProblem,
@warn("Dense output is incompatible with saveat. Please use the SavingCallback from the Callback Library to mix the two behaviors.")
end

progress && @logmsg(LogLevel(-1), progress_name, _id=_id = :OrdinaryDiffEq, progress=0)
progress && @logmsg(LogLevel(-1), progress_name, _id=progress_id, progress=0)

tType = eltype(prob.tspan)
tspan = prob.tspan
Expand Down Expand Up @@ -380,6 +381,7 @@ function DiffEqBase.__init(prob::Union{DiffEqBase.AbstractODEProblem,
progress_steps,
progress_name,
progress_message,
progress_id,
timeseries_errors,
dense_errors, dense,
save_on, save_start,
Expand Down

0 comments on commit 4231f9c

Please sign in to comment.