Skip to content

Commit

Permalink
Extend the API a bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Oct 30, 2023
1 parent 7e3610e commit 9b2890f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DiffEqBase"
uuid = "2b5f629d-d688-5b77-993f-72d75c75574e"
authors = ["Chris Rackauckas <[email protected]>"]
version = "6.135.0"
version = "6.136.0"

[deps]
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
Expand Down
8 changes: 6 additions & 2 deletions src/DiffEqBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,13 @@ export initialize!, finalize!

export SensitivityADPassThrough

export SteadyStateDiffEqTerminationMode, SimpleNonlinearSolveTerminationMode,
NormTerminationMode, RelTerminationMode, RelNormTerminationMode, AbsTerminationMode,
AbsNormTerminationMode, RelSafeTerminationMode, AbsSafeTerminationMode,
RelSafeBestTerminationMode, AbsSafeBestTerminationMode
# Deprecated API
export NLSolveTerminationMode,
NLSolveSafeTerminationOptions, NLSolveTerminationCondition,
NLSolveSafeTerminationResult
NLSolveSafeTerminationOptions, NLSolveTerminationCondition, NLSolveSafeTerminationResult

export KeywordArgError, KeywordArgWarn, KeywordArgSilent

Expand Down
9 changes: 7 additions & 2 deletions src/termination_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ mutable struct NonlinearTerminationModeCache{uType, T,
nsteps::Int
end

get_termination_mode(cache::NonlinearTerminationModeCache) = cache.mode
get_abstol(cache::NonlinearTerminationModeCache) = cache.abstol
get_reltol(cache::NonlinearTerminationModeCache) = cache.reltol

Check warning on line 60 in src/termination_conditions.jl

View check run for this annotation

Codecov / codecov/patch

src/termination_conditions.jl#L58-L60

Added lines #L58 - L60 were not covered by tests

function __update_u!!(cache::NonlinearTerminationModeCache, u)
cache.u === nothing && return
if ArrayInterface.can_setindex(cache.u)
Expand All @@ -73,8 +77,9 @@ function _get_tolerance(::Nothing, ::Type{T}) where {T}
return _get_tolerance(η, T)

Check warning on line 77 in src/termination_conditions.jl

View check run for this annotation

Codecov / codecov/patch

src/termination_conditions.jl#L74-L77

Added lines #L74 - L77 were not covered by tests
end

function SciMLBase.init(u::AbstractArray{T}, mode::AbstractNonlinearTerminationMode;
abstol = nothing, reltol = nothing, kwargs...) where {T}
function SciMLBase.init(u::Union{AbstractArray{T}, T},

Check warning on line 80 in src/termination_conditions.jl

View check run for this annotation

Codecov / codecov/patch

src/termination_conditions.jl#L80

Added line #L80 was not covered by tests
mode::AbstractNonlinearTerminationMode; abstol = nothing, reltol = nothing,
kwargs...) where {T <: Number}
abstol = _get_tolerance(abstol, T)
reltol = _get_tolerance(reltol, T)
best_value = __cvt_real(T, Inf)
Expand Down

0 comments on commit 9b2890f

Please sign in to comment.