@@ -8,7 +8,8 @@ import Reexport: @reexport
88import PrecompileTools: @recompile_invalidations , @compile_workload , @setup_workload
99
1010@recompile_invalidations begin
11- using DiffEqBase, LazyArrays, LinearAlgebra, LinearSolve, Printf, SparseArrays,
11+ using DiffEqBase,
12+ LazyArrays, LinearAlgebra, LinearSolve, Printf, SparseArrays,
1213 SparseDiffTools
1314
1415 import ADTypes: AbstractFiniteDifferencesMode
@@ -51,6 +52,39 @@ abstract type AbstractNonlinearSolveCache{iip} end
5152
5253isinplace (:: AbstractNonlinearSolveCache{iip} ) where {iip} = iip
5354
55+ function SciMLBase. reinit! (cache:: AbstractNonlinearSolveCache{iip} , u0 = get_u (cache);
56+ p = cache. p, abstol = cache. abstol, reltol = cache. reltol,
57+ maxiters = cache. maxiters, alias_u0 = false ,
58+ termination_condition = get_termination_mode (cache. tc_cache)) where {iip}
59+ cache. p = p
60+ if iip
61+ recursivecopy! (get_u (cache), u0)
62+ cache. f (cache. fu1, get_u (cache), p)
63+ else
64+ cache. u = __maybe_unaliased (u0, alias_u0)
65+ set_fu! (cache, cache. f (cache. u, p))
66+ end
67+
68+ reset! (cache. trace)
69+ abstol, reltol, tc_cache = init_termination_cache (abstol, reltol, get_fu (cache),
70+ get_u (cache), termination_condition)
71+
72+ cache. abstol = abstol
73+ cache. reltol = reltol
74+ cache. tc_cache = tc_cache
75+ cache. maxiters = maxiters
76+ cache. stats. nf = 1
77+ cache. stats. nsteps = 1
78+ cache. force_stop = false
79+ cache. retcode = ReturnCode. Default
80+
81+ __reinit_internal! (cache)
82+
83+ return cache
84+ end
85+
86+ __reinit_internal! (cache:: AbstractNonlinearSolveCache ) = nothing
87+
5488function Base. show (io:: IO , alg:: AbstractNonlinearSolveAlgorithm )
5589 str = " $(nameof (typeof (alg))) ("
5690 modifiers = String[]
0 commit comments