Skip to content

Commit 4505591

Browse files
committed
use SciMLMessage
1 parent 96db62c commit 4505591

File tree

8 files changed

+29
-23
lines changed

8 files changed

+29
-23
lines changed

lib/BracketingNonlinearSolve/src/bisection.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ function SciMLBase.__solve(
4545
end
4646

4747
if sign(fl) == sign(fr)
48-
verbose &&
49-
@warn "The interval is not an enclosing interval, opposite signs at the \
50-
boundaries are required."
48+
@SciMLMessage("The interval is not an enclosing interval, opposite signs at the \
49+
boundaries are required.",
50+
nonlinear_verbose[], :non_enclosing_interval, :error_control)
5151
return SciMLBase.build_solution(
5252
prob, alg, left, fl; retcode = ReturnCode.InitialFailure, left, right
5353
)

lib/BracketingNonlinearSolve/src/brent.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ function SciMLBase.__solve(
3333
end
3434

3535
if sign(fl) == sign(fr)
36-
verbose &&
37-
@warn "The interval is not an enclosing interval, opposite signs at the \
38-
boundaries are required."
36+
@SciMLMessage("The interval is not an enclosing interval, opposite signs at the \
37+
boundaries are required.",
38+
nonlinear_verbose[], :non_enclosing_interval, :error_control)
3939
return SciMLBase.build_solution(
4040
prob, alg, left, fl; retcode = ReturnCode.InitialFailure, left, right
4141
)

lib/BracketingNonlinearSolve/src/falsi.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ function SciMLBase.__solve(
3232
end
3333

3434
if sign(fl) == sign(fr)
35-
verbose &&
36-
@warn "The interval is not an enclosing interval, opposite signs at the \
37-
boundaries are required."
35+
@SciMLMessage("The interval is not an enclosing interval, opposite signs at the \
36+
boundaries are required.",
37+
nonlinear_verbose[], :non_enclosing_interval, :error_control)
3838
return SciMLBase.build_solution(
3939
prob, alg, left, fl; retcode = ReturnCode.InitialFailure, left, right
4040
)

lib/BracketingNonlinearSolve/src/itp.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ function SciMLBase.__solve(
8383
end
8484

8585
if sign(fl) == sign(fr)
86-
verbose &&
87-
@warn "The interval is not an enclosing interval, opposite signs at the \
88-
boundaries are required."
86+
@SciMLMessage("The interval is not an enclosing interval, opposite signs at the \
87+
boundaries are required.",
88+
nonlinear_verbose[], :non_enclosing_interval, :error_control)
8989
return SciMLBase.build_solution(
9090
prob, alg, left, fl; retcode = ReturnCode.InitialFailure, left, right
9191
)

lib/BracketingNonlinearSolve/src/ridder.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ function SciMLBase.__solve(
3232
end
3333

3434
if sign(fl) == sign(fr)
35-
verbose &&
36-
@warn "The interval is not an enclosing interval, opposite signs at the \
37-
boundaries are required."
35+
@SciMLMessage("The interval is not an enclosing interval, opposite signs at the \
36+
boundaries are required.",
37+
nonlinear_verbose[], :non_enclosing_interval, :error_control)
3838
return SciMLBase.build_solution(
3939
prob, alg, left, fl; retcode = ReturnCode.InitialFailure, left, right
4040
)

lib/NonlinearSolveBase/src/descent/newton.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ function InternalAPI.init(
3131
abstol = nothing, reltol = nothing,
3232
timer = get_timer_output(), kwargs...
3333
)
34-
#Main.@infiltrate
3534
@bb δu = similar(u)
3635
δus = Utils.unwrap_val(shared) 1 ? nothing : map(2:Utils.unwrap_val(shared)) do i
3736
@bb δu_ = similar(u)

lib/NonlinearSolveBase/src/solve.jl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
function SciMLBase.__solve(
22
prob::AbstractNonlinearProblem, alg::AbstractNonlinearSolveAlgorithm, args...;
3-
kwargs...
3+
verbose = NonlinearVerbosity(), linsolve_kwargs = (;), kwargs...
44
)
5-
#Main.@infiltrate
6-
cache = SciMLBase.__init(prob, alg, args...; kwargs...)
7-
return CommonSolve.solve!(cache)
5+
if !haskey(linsolve_kwargs, :verbose)
6+
linsolve_kwargs = merge(
7+
linsolve_kwargs, (; verbose = verbose.linear_verbosity))
8+
end
9+
10+
@with non_linear_verbose => verbose begin
11+
cache = SciMLBase.__init(prob, alg, args...; linsolve_kwargs, kwargs...)
12+
sol = CommonSolve.solve!(cache)
13+
end
14+
15+
return sol
816
end
917

1018
function CommonSolve.solve!(cache::AbstractNonlinearSolveCache)

lib/NonlinearSolveBase/src/verbosity.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
using Base.ScopedValues
2-
const non_linear_verbose = ScopedValue(NonlinearVerbosity())
3-
41
mutable struct NonlinearErrorControlVerbosity
52
immutable_u0::Verbosity.Type
63
non_enclosing_interval::Verbosity.Type
4+
non_forward_mode::Verbosity.Type
5+
ad_backend_incompatible::Verbosity.Type
76

87
function NonlinearErrorControlVerbosity()
98
new()

0 commit comments

Comments
 (0)