Skip to content

Commit c7b00d6

Browse files
Merge pull request #1153 from isaacsas/fix_rxsys_connection_type
move connection_type to ReactionSystems from Reactions
2 parents 9121fb1 + 7152ec8 commit c7b00d6

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/systems/reaction/reactionsystem.jl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,10 @@ struct Reaction{S, T <: Number}
6060
`true` if `rate` represents the full reaction rate law.
6161
"""
6262
only_use_rate::Bool
63-
"""
64-
type: type of the system
65-
"""
66-
connection_type::Any
6763
end
6864

6965
function Reaction(rate, subs, prods, substoich, prodstoich;
7066
netstoich=nothing, only_use_rate=false,
71-
connection_type=nothing,
7267
kwargs...)
7368

7469
(isnothing(prods)&&isnothing(subs)) && error("A reaction requires a non-nothing substrate or product vector.")
@@ -86,7 +81,7 @@ function Reaction(rate, subs, prods, substoich, prodstoich;
8681
subs = value.(subs)
8782
prods = value.(prods)
8883
ns = isnothing(netstoich) ? get_netstoich(subs, prods, substoich, prodstoich) : netstoich
89-
Reaction(value(rate), subs, prods, substoich, prodstoich, ns, only_use_rate, connection_type)
84+
Reaction(value(rate), subs, prods, substoich, prodstoich, ns, only_use_rate)
9085
end
9186

9287

@@ -154,14 +149,19 @@ struct ReactionSystem <: AbstractSystem
154149
parameters are not supplied in `ODEProblem`.
155150
"""
156151
defaults::Dict
152+
"""
153+
type: type of the system
154+
"""
155+
connection_type::Any
156+
157157

158-
function ReactionSystem(eqs, iv, states, ps, observed, name, systems, defaults)
158+
function ReactionSystem(eqs, iv, states, ps, observed, name, systems, defaults, connection_type)
159159
iv′ = value(iv)
160160
states′ = value.(states)
161161
ps′ = value.(ps)
162162
check_variables(states′, iv′)
163163
check_parameters(ps′, iv′)
164-
new(collect(eqs), iv′, states′, ps′, observed, name, systems, defaults)
164+
new(collect(eqs), iv′, states′, ps′, observed, name, systems, defaults, connection_type)
165165
end
166166
end
167167

@@ -171,10 +171,11 @@ function ReactionSystem(eqs, iv, species, params;
171171
name = gensym(:ReactionSystem),
172172
default_u0=Dict(),
173173
default_p=Dict(),
174-
defaults=_merge(Dict(default_u0), Dict(default_p)))
174+
defaults=_merge(Dict(default_u0), Dict(default_p)),
175+
connection_type=nothing)
175176

176177
#isempty(species) && error("ReactionSystems require at least one species.")
177-
ReactionSystem(eqs, iv, species, params, observed, name, systems, defaults)
178+
ReactionSystem(eqs, iv, species, params, observed, name, systems, defaults, connection_type)
178179
end
179180

180181
function ReactionSystem(iv; kwargs...)

0 commit comments

Comments
 (0)