|
1 | 1 | @muladd function perform_step!(integrator, cache::TauLeapingConstantCache) |
2 | 2 | @unpack t, dt, uprev, u, W, p, P, c = integrator |
3 | | - tmp = c(uprev, p, t, P.dW, nothing) |
| 3 | + # Handle case where P is Nothing (for pure discrete problems) |
| 4 | + dW = P === nothing ? nothing : P.dW |
| 5 | + tmp = c(uprev, p, t, dW, nothing) |
4 | 6 | integrator.u = uprev .+ tmp |
5 | 7 |
|
6 | | - if integrator.opts.adaptive |
| 8 | + if integrator.opts.adaptive && P !== nothing |
7 | 9 | if integrator.alg isa TauLeaping |
8 | 10 | oldrate = P.cache.currate |
9 | 11 | newrate = P.cache.rate(integrator.u, p, t+dt) |
|
22 | 24 | @muladd function perform_step!(integrator, cache::TauLeapingCache) |
23 | 25 | @unpack t, dt, uprev, u, W, p, P, c = integrator |
24 | 26 | @unpack tmp, newrate, EEstcache = cache |
25 | | - c(tmp, uprev, p, t, P.dW, nothing) |
| 27 | + # Handle case where P is Nothing (for pure discrete problems) |
| 28 | + dW = P === nothing ? nothing : P.dW |
| 29 | + c(tmp, uprev, p, t, dW, nothing) |
26 | 30 | @.. u = uprev + tmp |
27 | 31 |
|
28 | | - if integrator.opts.adaptive |
| 32 | + if integrator.opts.adaptive && P !== nothing |
29 | 33 | if integrator.alg isa TauLeaping |
30 | 34 | oldrate = P.cache.currate |
31 | 35 | P.cache.rate(newrate, u, p, t+dt) |
|
0 commit comments