From 6534e2b146f5695ac87f6a36a7b945bd378f4c31 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Wed, 12 Jun 2024 16:11:36 +0530 Subject: [PATCH] refactor: use common observed for `NonlinearSystem` --- src/systems/nonlinear/nonlinearsystem.jl | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/systems/nonlinear/nonlinearsystem.jl b/src/systems/nonlinear/nonlinearsystem.jl index dd6243ef00..d1d3f56247 100644 --- a/src/systems/nonlinear/nonlinearsystem.jl +++ b/src/systems/nonlinear/nonlinearsystem.jl @@ -306,18 +306,7 @@ function SciMLBase.NonlinearFunction{iip}(sys::NonlinearSystem, dvs = unknowns(s _jac = nothing end - observedfun = let sys = sys, dict = Dict() - function generated_observed(obsvar, u, p) - obs = get!(dict, value(obsvar)) do - build_explicit_observed_function(sys, obsvar) - end - if p isa MTKParameters - obs(u, p...) - else - obs(u, p) - end - end - end + observedfun = ObservedFunctionCache(sys) NonlinearFunction{iip}(f, sys = sys,