Skip to content

Commit 7c05c99

Browse files
committed
generate dep graphs
1 parent 9103a67 commit 7c05c99

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/systems/jumps/jumpsystem.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,8 @@ function JumpProcesses.JumpProblem(js::JumpSystem, prob,
449449
error("Use continuous problems such as an ODEProblem or a SDEProblem with VariableRateJumps")
450450
jset = JumpSet(Tuple(vrjs), Tuple(crjs), nothing, majs)
451451

452-
if needs_vartojumps_map(aggregator) || needs_depgraph(aggregator)
452+
if needs_vartojumps_map(aggregator) || needs_depgraph(aggregator) ||
453+
(aggregator isa JumpProcesses.NullAggregator)
453454
jdeps = asgraph(js)
454455
vdeps = variable_dependencies(js)
455456
vtoj = jdeps.badjlist

test/jumpsystem.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,3 +274,23 @@ affect = [X ~ X - 1]
274274

275275
j1 = ConstantRateJump(k, [X ~ X - 1])
276276
@test_nowarn @mtkbuild js1 = JumpSystem([j1], t, [X], [k])
277+
278+
279+
# test correct autosolver is selected
280+
let
281+
@parameters k
282+
@variables X(t)
283+
rate = k
284+
affect = [X ~ X - 1]
285+
j1 = ConstantRateJump(k, [X ~ X - 1])
286+
287+
Nv = [1, JumpProcesses.USE_DIRECT_THRESHOLD + 1, JumpProcesses.USE_RSSA_THRESHOLD + 1]
288+
algtypes = [Direct, RSSA, RSSACR]
289+
for (N, algtype) in zip(Nv, algtypes)
290+
@named jsys = JumpSystem([deepcopy(j1) for _ in 1:N], t, [X], [k])
291+
jsys = complete(jsys)
292+
dprob = DiscreteProblem(jsys, [X => 10], (0.0, 10.0), [k => 1])
293+
jprob = JumpProblem(jsys, dprob)
294+
@test jprob.aggregator isa algtype
295+
end
296+
end

0 commit comments

Comments
 (0)