2020function cat_problems (prob:: DiffEqBase.AbstractODEProblem ,
2121 prob_control:: DiffEqBase.AbstractODEProblem )
2222 l = length (prob. u0) # add l_c = length(prob_control.u0)
23+
24+ _f = SciMLBase. unwrapped_f (prob. f)
25+ _f_control = SciMLBase. unwrapped_f (prob_control. f)
26+
2327 new_f = function (du, u, p, t)
24- prob . f (@view (du[1 : l]), u. u, p, t)
25- prob_control . f (@view (du[(l + 1 ): (2 * l)]), u. u_control, p, t)
28+ _f (@view (du[1 : l]), u. u, p, t)
29+ _f_control (@view (du[(l + 1 ): (2 * l)]), u. u_control, p, t)
2630 end
2731 u0_coupled = CoupledArray (prob. u0, prob_control. u0, true )
2832 ODEProblem (new_f, u0_coupled, prob. tspan, prob. p)
@@ -33,9 +37,13 @@ function cat_problems(prob::DiscreteProblem, prob_control::DiffEqBase.AbstractOD
3337 if ! (typeof (prob. f) <: typeof (DiffEqBase. DISCRETE_INPLACE_DEFAULT))
3438 @warn (" Coupling to DiscreteProblem with nontrivial f. Note that, unless scale_by_time=true, the meaning of f will change when using an ODE/SDE/DDE/DAE solver." )
3539 end
40+
41+ _f = SciMLBase. unwrapped_f (prob. f)
42+ _f_control = SciMLBase. unwrapped_f (prob_control. f)
43+
3644 new_f = function (du, u, p, t)
37- prob . f (@view (du[1 : l]), u. u, p, t)
38- prob_control . f (@view (du[(l + 1 ): (2 * l)]), u. u_control, p, t)
45+ _f (@view (du[1 : l]), u. u, p, t)
46+ _f_control (@view (du[(l + 1 ): (2 * l)]), u. u_control, p, t)
3947 end
4048 u0_coupled = CoupledArray (prob. u0, prob_control. u0, true )
4149 ODEProblem (new_f, u0_coupled, prob. tspan, prob. p)
5967function cat_problems (prob:: DiffEqBase.AbstractSDEProblem ,
6068 prob_control:: DiffEqBase.AbstractODEProblem )
6169 l = length (prob. u0)
70+
71+ _f = SciMLBase. unwrapped_f (prob. f)
72+ _f_control = SciMLBase. unwrapped_f (prob_control. f)
73+
6274 new_f = function (du, u, p, t)
63- prob . f (@view (du[1 : l]), u. u, p, t)
64- prob_control . f (@view (du[(l + 1 ): (2 * l)]), u. u_control, p, t)
75+ _f (@view (du[1 : l]), u. u, p, t)
76+ _f_control (@view (du[(l + 1 ): (2 * l)]), u. u_control, p, t)
6577 end
6678 new_g = function (du, u, p, t)
6779 prob. g (@view (du[1 : l]), u. u, p, t)
0 commit comments