Skip to content

Commit 79c9bab

Browse files
committed
Oops
1 parent 99673b4 commit 79c9bab

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/systems/abstractsystem.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,16 @@ end
243243
const EMPTY_TGRAD = Vector{Num}(undef, 0)
244244
const EMPTY_JAC = Matrix{Num}(undef, 0, 0)
245245
function invalidate_cache!(sys::AbstractSystem)
246-
if isdefined(sys, :tgrad)
247-
sys.tgrad[] = EMPTY_TGRAD
248-
elseif isdefined(sys, :jac)
249-
sys.jac[] = EMPTY_JAC
250-
elseif isdefined(sys, :ctrl_jac)
251-
sys.jac[] = EMPTY_JAC
252-
elseif isdefined(sys, :Wfact)
253-
sys.jac[] = EMPTY_JAC
254-
elseif isdefined(sys, :Wfact_t)
255-
sys.jac[] = EMPTY_JAC
246+
if has_tgrad(sys)
247+
get_tgrad(sys)[] = EMPTY_TGRAD
248+
elseif has_jac(sys)
249+
get_jac(sys)[] = EMPTY_JAC
250+
elseif has_ctrl_jac(sys)
251+
get_ctrl_jac(sys)[] = EMPTY_JAC
252+
elseif has_Wfact(sys)
253+
get_Wfact(sys)[] = EMPTY_JAC
254+
elseif has_Wfact_t(sys)
255+
get_Wfact_t(sys)[] = EMPTY_JAC
256256
end
257257
return sys
258258
end

0 commit comments

Comments
 (0)