Skip to content

Commit 9b2890f

Browse files
committed
Extend the API a bit more
1 parent 7e3610e commit 9b2890f

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DiffEqBase"
22
uuid = "2b5f629d-d688-5b77-993f-72d75c75574e"
33
authors = ["Chris Rackauckas <[email protected]>"]
4-
version = "6.135.0"
4+
version = "6.136.0"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

src/DiffEqBase.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,13 @@ export initialize!, finalize!
171171

172172
export SensitivityADPassThrough
173173

174+
export SteadyStateDiffEqTerminationMode, SimpleNonlinearSolveTerminationMode,
175+
NormTerminationMode, RelTerminationMode, RelNormTerminationMode, AbsTerminationMode,
176+
AbsNormTerminationMode, RelSafeTerminationMode, AbsSafeTerminationMode,
177+
RelSafeBestTerminationMode, AbsSafeBestTerminationMode
178+
# Deprecated API
174179
export NLSolveTerminationMode,
175-
NLSolveSafeTerminationOptions, NLSolveTerminationCondition,
176-
NLSolveSafeTerminationResult
180+
NLSolveSafeTerminationOptions, NLSolveTerminationCondition, NLSolveSafeTerminationResult
177181

178182
export KeywordArgError, KeywordArgWarn, KeywordArgSilent
179183

src/termination_conditions.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ mutable struct NonlinearTerminationModeCache{uType, T,
5555
nsteps::Int
5656
end
5757

58+
get_termination_mode(cache::NonlinearTerminationModeCache) = cache.mode
59+
get_abstol(cache::NonlinearTerminationModeCache) = cache.abstol
60+
get_reltol(cache::NonlinearTerminationModeCache) = cache.reltol
61+
5862
function __update_u!!(cache::NonlinearTerminationModeCache, u)
5963
cache.u === nothing && return
6064
if ArrayInterface.can_setindex(cache.u)
@@ -73,8 +77,9 @@ function _get_tolerance(::Nothing, ::Type{T}) where {T}
7377
return _get_tolerance(η, T)
7478
end
7579

76-
function SciMLBase.init(u::AbstractArray{T}, mode::AbstractNonlinearTerminationMode;
77-
abstol = nothing, reltol = nothing, kwargs...) where {T}
80+
function SciMLBase.init(u::Union{AbstractArray{T}, T},
81+
mode::AbstractNonlinearTerminationMode; abstol = nothing, reltol = nothing,
82+
kwargs...) where {T <: Number}
7883
abstol = _get_tolerance(abstol, T)
7984
reltol = _get_tolerance(reltol, T)
8085
best_value = __cvt_real(T, Inf)

0 commit comments

Comments
 (0)