@@ -96,11 +96,6 @@ struct JumpSystem{U <: ArrayPartition} <: AbstractTimeDependentSystem
96
96
"""
97
97
discrete_events:: Vector{SymbolicDiscreteCallback}
98
98
"""
99
- A `Vector{SymbolicContinuousCallback}` that model events.
100
- The integrator will use root finding to guarantee that it steps at each zero crossing.
101
- """
102
- continuous_events:: Vector{SymbolicContinuousCallback}
103
- """
104
99
Topologically sorted parameter dependency equations, where all symbols are parameters and
105
100
the LHS is a single parameter.
106
101
"""
@@ -172,13 +167,14 @@ function JumpSystem(eqs, iv, unknowns, ps;
172
167
iv′ = value (iv)
173
168
us′ = value .(unknowns)
174
169
ps′ = value .(ps)
175
- parameter_dependencies, ps = process_parameter_dependencies (parameter_dependencies, ps′)
170
+ parameter_dependencies, ps′ = process_parameter_dependencies (
171
+ parameter_dependencies, ps′)
176
172
if ! (isempty (default_u0) && isempty (default_p))
177
173
Base. depwarn (
178
174
" `default_u0` and `default_p` are deprecated. Use `defaults` instead." ,
179
175
:JumpSystem , force = true )
180
176
end
181
- defaults = todict (defaults)
177
+ defaults = Dict {Any,Any} ( todict (defaults) )
182
178
var_to_name = Dict ()
183
179
process_variables! (var_to_name, defaults, us′)
184
180
process_variables! (var_to_name, defaults, ps′)
@@ -188,7 +184,14 @@ function JumpSystem(eqs, iv, unknowns, ps;
188
184
if value (v) != = nothing )
189
185
isempty (observed) || collect_var_to_name! (var_to_name, (eq. lhs for eq in observed))
190
186
187
+ sysnames = nameof .(systems)
188
+ if length (unique (sysnames)) != length (sysnames)
189
+ throw (ArgumentError (" System names must be unique." ))
190
+ end
191
+
191
192
# equation processing
193
+ # this and the treatment of continuous events are the only part
194
+ # unique to JumpSystems
192
195
eqs = scalarize .(eqs)
193
196
ap = ArrayPartition (MassActionJump[], ConstantRateJump[], VariableRateJump[])
194
197
for eq in eqs
@@ -203,11 +206,6 @@ function JumpSystem(eqs, iv, unknowns, ps;
203
206
end
204
207
end
205
208
206
- sysnames = nameof .(systems)
207
- if length (unique (sysnames)) != length (sysnames)
208
- throw (ArgumentError (" System names must be unique." ))
209
- end
210
-
211
209
(continuous_events === nothing ) ||
212
210
error (" JumpSystems currently only support discrete events." )
213
211
disc_callbacks = SymbolicDiscreteCallbacks (discrete_events)
@@ -220,17 +218,19 @@ end
220
218
221
219
# #### MTK dispatches for JumpSystems #####
222
220
function collect_vars! (unknowns, parameters, j:: MassActionJump , iv; depth = 0 ,
223
- op = Differential)
221
+ op = Differential)
224
222
for field in (j. scaled_rates, j. reactant_stoch, j. net_stoch)
225
- collect_vars! (unknowns, parameters, field, iv; depth, op)
223
+ for el in field
224
+ collect_vars! (unknowns, parameters, el, iv; depth, op)
225
+ end
226
226
end
227
227
return nothing
228
228
end
229
229
230
230
function collect_vars! (unknowns, parameters, j:: Union{ConstantRateJump,VariableRateJump} ,
231
231
iv; depth = 0 , op = Differential)
232
- collect_vars! (unknowns, parameters, j. condition , iv; depth, op)
233
- for eq in j. affect
232
+ collect_vars! (unknowns, parameters, j. rate , iv; depth, op)
233
+ for eq in j. affect!
234
234
(eq isa Equation) && collect_vars! (unknowns, parameters, eq, iv; depth, op)
235
235
end
236
236
return nothing
0 commit comments