Skip to content

Commit

Permalink
format fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TorkelE committed Apr 10, 2024
1 parent f3666c2 commit 2ba8bcb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/reactionsystem.jl
Expand Up @@ -1481,7 +1481,7 @@ end

# merge constraint components with the ReactionSystem components
# also handles removing BC and constant species
function addconstraints!(eqs, rs::ReactionSystem, ists, ispcs; remove_conserved = false, zero_derivatives = false)
function addconstraints!(eqs, rs::ReactionSystem, ists, ispcs; remove_conserved = false)
# if there are BC species, put them after the independent species
rssts = get_unknowns(rs)
sts = any(isbc, rssts) ? vcat(ists, filter(isbc, rssts)) : ists
Expand Down Expand Up @@ -1573,7 +1573,7 @@ function Base.convert(::Type{<:ODESystem}, rs::ReactionSystem; name = nameof(rs)
ists, ispcs = get_indep_sts(fullrs, remove_conserved)
eqs = assemble_drift(fullrs, ispcs; combinatoric_ratelaws, remove_conserved,
include_zero_odes)
eqs, us, ps, obs, defs = addconstraints!(eqs, fullrs, ists, ispcs; remove_conserved, zero_derivatives=true)
eqs, us, ps, obs, defs = addconstraints!(eqs, fullrs, ists, ispcs; remove_conserved)

ODESystem(eqs, get_iv(fullrs), us, ps;
observed = obs,
Expand Down Expand Up @@ -1748,7 +1748,7 @@ function DiffEqBase.ODEProblem(rs::ReactionSystem, u0, tspan,
check_length = false, name = nameof(rs),
combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
include_zero_odes = true, remove_conserved = false,
checks = false, structural_simplify=false, kwargs...)
checks = false, structural_simplify = false, kwargs...)
u0map = symmap_to_varmap(rs, u0)
pmap = symmap_to_varmap(rs, p)
osys = convert(ODESystem, rs; name, combinatoric_ratelaws, include_zero_odes, checks,
Expand Down Expand Up @@ -1820,7 +1820,7 @@ function DiffEqBase.DiscreteProblem(rs::ReactionSystem, u0, tspan::Tuple,
return DiscreteProblem(jsys, u0map, tspan, pmap, args...; kwargs...)
end

# JumpProblem from AbstractReactionNetwork
# JumpProblem from AbstractReactionNetworkg
function JumpProcesses.JumpProblem(rs::ReactionSystem, prob, aggregator, args...;
name = nameof(rs),
combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
Expand All @@ -1836,7 +1836,7 @@ function DiffEqBase.SteadyStateProblem(rs::ReactionSystem, u0,
check_length = false, name = nameof(rs),
combinatoric_ratelaws = get_combinatoric_ratelaws(rs),
remove_conserved = false, include_zero_odes = true,
checks = false, structural_simplify=false, kwargs...)
checks = false, structural_simplify = false, kwargs...)
u0map = symmap_to_varmap(rs, u0)
pmap = symmap_to_varmap(rs, p)
osys = convert(ODESystem, rs; name, combinatoric_ratelaws, include_zero_odes, checks,
Expand Down
7 changes: 3 additions & 4 deletions test/miscellaneous_tests/events.jl
Expand Up @@ -177,11 +177,9 @@ let

# Checks that errors are produced.
for continuous_events in continuous_events_bad
println(continuous_events)
@test_throws Exception @named rs = ReactionSystem(rxs, t; continuous_events)
end
for discrete_events in discrete_events_bad
println(discrete_events)
@test_throws Exception @named rs = ReactionSystem(rxs, t; discrete_events)
end
end
Expand Down Expand Up @@ -224,15 +222,16 @@ let
Reaction(dY, [Y], nothing, [1], nothing)
]
continuous_events = [
[t - 2.5] => [p ~ p + 0.2]
[X - thres, Y - X] => [X ~ X - 0.5, Z ~ Z + 0.1]
[t ~ 2.5] => [p ~ p + 0.2]
[X ~ thres, Y ~ X] => [X ~ X - 0.5, Z ~ Z + 0.1]
]
discrete_events = [
2.0 => [dX ~ dX + 0.1, dY ~ dY + dY_up]
[1.0, 5.0] => [p ~ p - 0.1]
(Z > Y) => [Z ~ Z - 0.1]
]
rn_prog = ReactionSystem(rxs, t; continuous_events, discrete_events, name=:rn)
rn_prog = complete(rn_prog)

# Tests that approaches yield identical results.
@test isequal(rn_dsl, rn_prog)
Expand Down

0 comments on commit 2ba8bcb

Please sign in to comment.