From ac88d4983ac1f9754570bc6f15104cac73227d0d Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Fri, 20 Sep 2024 13:03:46 +0530 Subject: [PATCH] fix: properly namespace array variables passed to subcomponents --- src/ModelingToolkit.jl | 2 +- src/systems/abstractsystem.jl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ModelingToolkit.jl b/src/ModelingToolkit.jl index 13b29831e5..32d52f5479 100644 --- a/src/ModelingToolkit.jl +++ b/src/ModelingToolkit.jl @@ -72,7 +72,7 @@ import Symbolics: rename, get_variables!, _solve, hessian_sparsity, ParallelForm, SerialForm, MultithreadedForm, build_function, rhss, lhss, prettify_expr, gradient, jacobian, hessian, derivative, sparsejacobian, sparsehessian, - substituter, scalarize, getparent, hasderiv, hasdiff + substituter, scalarize, getparent, hasderiv, hasdiff, Arr import DiffEqBase: @add_kwonly export independent_variables, unknowns, parameters, full_parameters, continuous_events, diff --git a/src/systems/abstractsystem.jl b/src/systems/abstractsystem.jl index 9aa4bfc92d..2ff2206d03 100644 --- a/src/systems/abstractsystem.jl +++ b/src/systems/abstractsystem.jl @@ -1112,6 +1112,7 @@ end apply_to_variables(f::F, ex) where {F} = _apply_to_variables(f, ex) apply_to_variables(f::F, ex::Num) where {F} = wrap(_apply_to_variables(f, unwrap(ex))) +apply_to_variables(f::F, ex::Arr) where {F} = wrap(_apply_to_variables(f, unwrap(ex))) function _apply_to_variables(f::F, ex) where {F} if isvariable(ex) return f(ex)