Skip to content

Commit b957511

Browse files
Merge pull request #309 from SciML/depwarns
fix depwarns
2 parents 45869f3 + d64b8df commit b957511

File tree

2 files changed

+27
-26
lines changed

2 files changed

+27
-26
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Catalyst"
22
uuid = "479239e8-5488-4da2-87a7-35f2df7eef83"
3-
version = "6.8.0"
3+
version = "6.8.1"
44

55
[deps]
66
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"

src/networkapi.jl

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
Given a [`ReactionSystem`](@ref), return a vector of species `Variable`s.
99
1010
Notes:
11-
- If `network.systems` is not empty, may allocate. Otherwise returns
12-
`network.states`.
11+
- If `ModelingToolkit.get_systems(network)` is not empty, may allocate. Otherwise returns
12+
`ModelingToolkit.ModelingToolkit.get_states(network)`.
1313
"""
1414
function species(network)
15-
isempty(network.systems) ? network.states : states(network)
15+
isempty(ModelingToolkit.get_systems(network)) ? ModelingToolkit.ModelingToolkit.get_states(network) : states(network)
1616
end
1717

1818
"""
@@ -21,11 +21,11 @@ end
2121
Given a [`ReactionSystem`](@ref), return a vector of parameter `Variable`s.
2222
2323
Notes:
24-
- If `network.systems` is not empty, may allocate. Otherwise returns
25-
`network.ps`.
24+
- If `ModelingToolkit.get_systems(network)` is not empty, may allocate. Otherwise returns
25+
`ModelingToolkit.get_ps(network)`.
2626
"""
2727
function params(network)
28-
isempty(network.systems) ? network.ps : parameters(network)
28+
isempty(ModelingToolkit.get_systems(network)) ? ModelingToolkit.get_ps(network) : parameters(network)
2929
end
3030

3131
"""
@@ -34,11 +34,11 @@ end
3434
Given a [`ReactionSystem`](@ref), return a vector of all `Reactions` in the system.
3535
3636
Notes:
37-
- If `network.systems` is not empty, may allocate. Otherwise returns
38-
`network.eqs`.
37+
- If `ModelingToolkit.get_systems(network)` is not empty, may allocate. Otherwise returns
38+
`ModelingToolkit.get_eqs(network)`.
3939
"""
4040
function reactions(network)
41-
isempty(network.systems) ? network.eqs : equations(network)
41+
isempty(ModelingToolkit.get_systems(network)) ? ModelingToolkit.get_eqs(network) : equations(network)
4242
end
4343

4444
"""
@@ -67,8 +67,8 @@ end
6767
Return the number of species within the given [`ReactionSystem`](@ref).
6868
"""
6969
function numspecies(network)
70-
ns = length(network.states)
71-
for sys in network.systems
70+
ns = length(ModelingToolkit.ModelingToolkit.get_states(network))
71+
for sys in ModelingToolkit.get_systems(network)
7272
ns += numspecies(ns)
7373
end
7474
ns
@@ -80,8 +80,8 @@ end
8080
Return the number of reactions within the given [`ReactionSystem`](@ref).
8181
"""
8282
function numreactions(network)
83-
nr = length(network.eqs)
84-
for sys in network.systems
83+
nr = length(ModelingToolkit.get_eqs(network))
84+
for sys in ModelingToolkit.get_systems(network)
8585
nr += numreactions(sys)
8686
end
8787
nr
@@ -93,8 +93,8 @@ end
9393
Return the number of parameters within the given [`ReactionSystem`](@ref).
9494
"""
9595
function numparams(network)
96-
np = length(network.ps)
97-
for sys in network.systems
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:
201201
function (==)(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:
244244
function 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), network.states)
247+
curidx = disablechecks ? nothing : findfirst(S -> isequal(S, s), ModelingToolkit.ModelingToolkit.get_states(network))
248248
if curidx === nothing
249-
push!(network.states, s)
250-
return length(network.states)
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), network.ps)
290+
curidx = disablechecks ? nothing : findfirst(S -> isequal(S, p), ModelingToolkit.get_ps(network))
291291
if curidx === nothing
292-
push!(network.ps, p)
293-
return length(network.ps)
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
"""
325325
function addreaction!(network::ReactionSystem, rx::Reaction)
326-
push!(network.eqs, rx)
327-
length(network.eqs)
326+
push!(ModelingToolkit.get_eqs(network), rx)
327+
length(ModelingToolkit.get_eqs(network))
328328
end
329329

330330

@@ -343,7 +343,8 @@ Notes:
343343
- Does not currently handle pins.
344344
"""
345345
function 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

Comments
 (0)