Skip to content

Commit 0cd0037

Browse files
feat: implement initialization for GeneralizedDFSaneCache
1 parent 0377273 commit 0cd0037

File tree

1 file changed

+8
-3
lines changed
  • lib/NonlinearSolveSpectralMethods/src

1 file changed

+8
-3
lines changed

lib/NonlinearSolveSpectralMethods/src/solve.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ end
6868
retcode::ReturnCode.T
6969
force_stop::Bool
7070
kwargs
71+
72+
initializealg
7173
end
7274

7375
function InternalAPI.reinit_self!(
@@ -112,7 +114,7 @@ function SciMLBase.__init(
112114
prob::AbstractNonlinearProblem, alg::GeneralizedDFSane, args...;
113115
stats = NLStats(0, 0, 0, 0, 0), alias_u0 = false, maxiters = 1000,
114116
abstol = nothing, reltol = nothing, termination_condition = nothing,
115-
maxtime = nothing, kwargs...
117+
maxtime = nothing, initializealg = NonlinearSolveBase.NonlinearSolveDefaultInit(), kwargs...
116118
)
117119
timer = get_timer_output()
118120

@@ -145,13 +147,16 @@ function SciMLBase.__init(
145147
σ_n = T(alg.σ_1)
146148
end
147149

148-
return GeneralizedDFSaneCache(
150+
cache = GeneralizedDFSaneCache(
149151
fu, fu_cache, u, u_cache, prob.p, du, alg, prob,
150152
σ_n, T(alg.σ_min), T(alg.σ_max),
151153
linesearch_cache, stats, 0, maxiters, maxtime, timer, 0.0,
152-
tc_cache, trace, ReturnCode.Default, false, kwargs
154+
tc_cache, trace, ReturnCode.Default, false, kwargs, initializealg,
153155
)
154156
end
157+
158+
NonlinearSolveBase.initialize_cache!(cache)
159+
return cache
155160
end
156161

157162
function InternalAPI.step!(

0 commit comments

Comments
 (0)