Closed tkf closed 5 years ago
If we go with :Terminated
return code https://github.com/JuliaDiffEq/SteadyStateDiffEq.jl/pull/8#discussion_r226174375, I guess we can do something like the following.
In DiffEqBase
, define:
function __terminate! end
function terminate!(integrator)
__terminate!(integrator)
integrator.sol = solution_new_retcode(integrator.sol, :Terminated)
end
In OrdinaryDiffEq
, define __terminate!
instead of terminate!
(and similar in Sundials
):
function DiffEqBase.__terminate!(integrator::ODEIntegrator)
integrator.opts.tstops.valtree = typeof(integrator.opts.tstops.valtree)()
end
Also, maybe define a simple function so that it's easy to support compatibility for common cases:
iserror(sol) = !(sol.retcode in (:Success, :Terminated))
Honestly I think the return codes should be enums, so if we redo them we should go all the way there.
Yeees! enum retcode would be really nice.
I'll merge when tests pass. But the retcode changes of adding a terminate and changing to enums is something that should get followup when we have time.
This should get docs
You can limit the solver by
maxiters
but sometimes it's handy to stop it via the simulated timetspan
.