88Given a [`ReactionSystem`](@ref), return a vector of species `Variable`s.
99
1010Notes:
11- - If `get_systems(network)` is not empty, may allocate. Otherwise returns
12- `get_states(network)`.
11+ - If `ModelingToolkit. get_systems(network)` is not empty, may allocate. Otherwise returns
12+ `ModelingToolkit.ModelingToolkit. get_states(network)`.
1313"""
1414function species (network)
15- isempty (get_systems (network)) ? get_states (network) : states (network)
15+ isempty (ModelingToolkit . get_systems (network)) ? ModelingToolkit . ModelingToolkit . get_states (network) : states (network)
1616end
1717
1818"""
2121Given a [`ReactionSystem`](@ref), return a vector of parameter `Variable`s.
2222
2323Notes:
24- - If `get_systems(network)` is not empty, may allocate. Otherwise returns
25- `get_ps(network)`.
24+ - If `ModelingToolkit. get_systems(network)` is not empty, may allocate. Otherwise returns
25+ `ModelingToolkit. get_ps(network)`.
2626"""
2727function params (network)
28- isempty (get_systems (network)) ? get_ps (network) : parameters (network)
28+ isempty (ModelingToolkit . get_systems (network)) ? ModelingToolkit . get_ps (network) : parameters (network)
2929end
3030
3131"""
3434Given a [`ReactionSystem`](@ref), return a vector of all `Reactions` in the system.
3535
3636Notes:
37- - If `get_systems(network)` is not empty, may allocate. Otherwise returns
38- `get_eqs(network)`.
37+ - If `ModelingToolkit. get_systems(network)` is not empty, may allocate. Otherwise returns
38+ `ModelingToolkit. get_eqs(network)`.
3939"""
4040function reactions (network)
41- isempty (get_systems (network)) ? get_eqs (network) : equations (network)
41+ isempty (ModelingToolkit . get_systems (network)) ? ModelingToolkit . get_eqs (network) : equations (network)
4242end
4343
4444"""
6767Return the number of species within the given [`ReactionSystem`](@ref).
6868"""
6969function numspecies (network)
70- ns = length (get_states (network))
71- for sys in get_systems (network)
70+ ns = length (ModelingToolkit . ModelingToolkit . get_states (network))
71+ for sys in ModelingToolkit . get_systems (network)
7272 ns += numspecies (ns)
7373 end
7474 ns
8080Return the number of reactions within the given [`ReactionSystem`](@ref).
8181"""
8282function numreactions (network)
83- nr = length (get_eqs (network))
84- for sys in get_systems (network)
83+ nr = length (ModelingToolkit . get_eqs (network))
84+ for sys in ModelingToolkit . get_systems (network)
8585 nr += numreactions (sys)
8686 end
8787 nr
9393Return the number of parameters within the given [`ReactionSystem`](@ref).
9494"""
9595function numparams (network)
96- np = length (get_ps (network))
97- for sys in get_systems (network)
96+ np = length (ModelingToolkit . get_ps (network))
97+ for sys in ModelingToolkit . get_systems (network)
9898 np += numparams (ns)
9999 end
100100 np
@@ -201,7 +201,7 @@ Notes:
201201function (== )(rn1:: ReactionSystem , rn2:: ReactionSystem )
202202 issetequal (species (rn1), species (rn2)) || return false
203203 issetequal (params (rn1), params (rn2)) || return false
204- isequal (rn1 . iv, rn2 . iv ) || return false
204+ isequal (ModelingToolkit . independent_variable (rn1), ModelingToolkit . independent_variable (rn2) ) || return false
205205 (numreactions (rn1) == numreactions (rn2)) || return false
206206
207207 # the following fails for some reason, so need to use issubset
@@ -244,10 +244,10 @@ Notes:
244244function addspecies! (network:: ReactionSystem , s:: Symbolic ; disablechecks= false )
245245
246246 # we don't check subsystems since we will add it to the top-level system...
247- curidx = disablechecks ? nothing : findfirst (S -> isequal (S, s), get_states (network))
247+ curidx = disablechecks ? nothing : findfirst (S -> isequal (S, s), ModelingToolkit . ModelingToolkit . get_states (network))
248248 if curidx === nothing
249- push! (get_states (network), s)
250- return length (get_states (network))
249+ push! (ModelingToolkit . ModelingToolkit . get_states (network), s)
250+ return length (ModelingToolkit . ModelingToolkit . get_states (network))
251251 else
252252 return curidx
253253 end
@@ -287,10 +287,10 @@ function addparam!(network::ReactionSystem, p::Symbolic; disablechecks=false)
287287 if istree (p) && ! (operation (p) isa Sym)
288288 error (" If the passed in parameter is an expression, it must correspond to an underlying Variable." )
289289 end
290- curidx = disablechecks ? nothing : findfirst (S -> isequal (S, p), get_ps (network))
290+ curidx = disablechecks ? nothing : findfirst (S -> isequal (S, p), ModelingToolkit . get_ps (network))
291291 if curidx === nothing
292- push! (get_ps (network), p)
293- return length (get_ps (network))
292+ push! (ModelingToolkit . get_ps (network), p)
293+ return length (ModelingToolkit . get_ps (network))
294294 else
295295 return curidx
296296 end
@@ -323,8 +323,8 @@ Notes:
323323 `network` using [`addspecies!`](@ref) and [`addparam!`](@ref).
324324"""
325325function addreaction! (network:: ReactionSystem , rx:: Reaction )
326- push! (get_eqs (network), rx)
327- length (get_eqs (network))
326+ push! (ModelingToolkit . get_eqs (network), rx)
327+ length (ModelingToolkit . get_eqs (network))
328328end
329329
330330
@@ -343,7 +343,8 @@ Notes:
343343- Does not currently handle pins.
344344"""
345345function merge! (network1:: ReactionSystem , network2:: ReactionSystem )
346- isequal (network1. iv, network2. iv) || error (" Reaction networks must have the same independent variable to be mergable." )
346+ isequal (ModelingToolkit. independent_variable (network1),
347+ ModelingToolkit. independent_variable (network2)) || error (" Reaction networks must have the same independent variable to be mergable." )
347348 union! (network1. states, network2. states)
348349 union! (network1. ps, network2. ps)
349350 append! (network1. eqs, network2. eqs)
0 commit comments