@@ -217,53 +217,26 @@ Create an `ODEFunction` from the [`ODESystem`](@ref). The arguments `dvs` and `p
217
217
are used to set the order of the dependent variable and parameter vectors,
218
218
respectively.
219
219
"""
220
- function DiffEqBase. ODEFunction {iip} (sys:: ODESystem , dvs, ps,
221
- safe = Val{true };
220
+ function DiffEqBase. ODEFunction {iip} (sys:: ODESystem , dvs, ps;
222
221
version = nothing ,
223
222
jac = false , Wfact = false ) where {iip}
224
- _f = eval (generate_function (sys, dvs, ps))
225
- out_f_safe (u,p,t) = ModelingToolkit. fast_invokelatest (_f,typeof (u),u,p,t)
226
- out_f_safe (du,u,p,t) = ModelingToolkit. fast_invokelatest (_f,Nothing,du,u,p,t)
227
- out_f (u,p,t) = _f (u,p,t)
228
- out_f (du,u,p,t) = _f (du,u,p,t)
223
+ _f = generate_function (sys, dvs, ps)
229
224
230
225
if jac
231
- _jac = eval (generate_jacobian (sys, dvs, ps))
232
- jac_f_safe (u,p,t) = ModelingToolkit. fast_invokelatest (_jac,Matrix{eltype (u)},u,p,t)
233
- jac_f_safe (J,u,p,t) = ModelingToolkit. fast_invokelatest (_jac,Nothing,J,u,p,t)
234
- jac_f (u,p,t) = _jac (u,p,t)
235
- jac_f (J,u,p,t) = _jac (J,u,p,t)
226
+ _jac = generate_jacobian (sys, dvs, ps)
236
227
else
237
- jac_f_safe = nothing
238
- jac_f = nothing
228
+ _jac = nothing
239
229
end
240
230
241
231
if Wfact
242
- _Wfact,_Wfact_t = eval .(generate_factorized_W (sys, dvs, ps))
243
- Wfact_f_safe (u,p,gam,t) = ModelingToolkit. fast_invokelatest (_Wfact,Matrix{eltype (u)},u,p,gam,t)
244
- Wfact_f_safe (J,u,p,gam,t) = ModelingToolkit. fast_invokelatest (_Wfact,Nothing,J,u,p,gam,t)
245
- Wfact_f_t_safe (u,p,gam,t) = ModelingToolkit. fast_invokelatest (_Wfact_t,Matrix{eltype (u)},u,p,gam,t)
246
- Wfact_f_t_safe (J,u,p,gam,t) = ModelingToolkit. fast_invokelatest (_Wfact_t,Nothing,J,u,p,gam,t)
247
- Wfact_f (u,p,gam,t) = _Wfact (u,p,gam,t)
248
- Wfact_f (J,u,p,gam,t) = _Wfact (J,u,p,gam,t)
249
- Wfact_f_t (u,p,gam,t) = _Wfact_t (u,p,gam,t)
250
- Wfact_f_t (J,u,p,gam,t) = _Wfact_t (J,u,p,gam,t)
232
+ _Wfact,_Wfact_t = generate_factorized_W (sys, dvs, ps)
251
233
else
252
- Wfact_f_safe = nothing
253
- Wfact_f_t_safe = nothing
254
- Wfact_f = nothing
255
- Wfact_f_t = nothing
234
+ _Wfact,_Wfact_t = nothing ,nothing
256
235
end
257
236
258
- if safe === Val{true }
259
- ODEFunction {iip} (out_f_safe,jac= jac_f_safe,
260
- Wfact = Wfact_f_safe,
261
- Wfact_t = Wfact_f_t_safe)
262
- else
263
- ODEFunction {iip} (out_f,jac= jac_f,
264
- Wfact = Wfact_f,
265
- Wfact_t = Wfact_f_t)
266
- end
237
+ ODEFunction {iip} (_f,jac= _jac,
238
+ Wfact = _Wfact,
239
+ Wfact_t = _Wfact_t)
267
240
end
268
241
269
242
function DiffEqBase. ODEFunction (sys:: ODESystem , args... ; kwargs... )
0 commit comments