Skip to content

Commit 7c92d22

Browse files
fix: support CheckInit in linearization_function
1 parent 0c84697 commit 7c92d22

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/linearization.jl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ function (linfun::LinearizationFunction)(u, p, t)
170170
if u !== nothing # Handle systems without unknowns
171171
linfun.num_states == length(u) ||
172172
error("Number of unknown variables ($(linfun.num_states)) does not match the number of input unknowns ($(length(u)))")
173-
integ_cache = linfun.caches
174-
integ = MockIntegrator{true}(u, p, t, integ_cache)
173+
integ_cache = (linfun.caches,)
174+
integ = MockIntegrator{true}(u, p, t, integ_cache, nothing)
175175
u, p, success = SciMLBase.get_initial_values(
176176
linfun.prob, integ, fun, linfun.initializealg, Val(true);
177177
linfun.initialize_kwargs...)
@@ -218,7 +218,7 @@ Mock `DEIntegrator` to allow using `CheckInit` without having to create a new in
218218
219219
$(TYPEDFIELDS)
220220
"""
221-
struct MockIntegrator{iip, U, P, T, C} <: SciMLBase.DEIntegrator{Nothing, iip, U, T}
221+
struct MockIntegrator{iip, U, P, T, C, O} <: SciMLBase.DEIntegrator{Nothing, iip, U, T}
222222
"""
223223
The state vector.
224224
"""
@@ -235,10 +235,14 @@ struct MockIntegrator{iip, U, P, T, C} <: SciMLBase.DEIntegrator{Nothing, iip, U
235235
The integrator cache.
236236
"""
237237
cache::C
238+
"""
239+
Integrator "options" for `CheckInit`.
240+
"""
241+
opts::O
238242
end
239243

240-
function MockIntegrator{iip}(u::U, p::P, t::T, cache::C) where {iip, U, P, T, C}
241-
return MockIntegrator{iip, U, P, T, C}(u, p, t, cache)
244+
function MockIntegrator{iip}(u::U, p::P, t::T, cache::C, opts::O) where {iip, U, P, T, C, O}
245+
return MockIntegrator{iip, U, P, T, C, O}(u, p, t, cache, opts)
242246
end
243247

244248
SymbolicIndexingInterface.state_values(integ::MockIntegrator) = integ.u

0 commit comments

Comments
 (0)