Skip to content

Commit 2409dcc

Browse files
committed
save prog
1 parent 56d5f86 commit 2409dcc

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/spatial_reaction_systems/spatial_ODE_systems.jl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct LatticeTransportODEf{S,T}
6868
"""An iterator over all the edges of the lattice."""
6969
edge_iterator::Vector{Pair{Int64, Int64}}
7070

71-
function LatticeTransportODEf(ofunc::S, vert_ps::Vector{Pair{BasicSymbolic{Real},Vector{T}}},
71+
function LatticeTransportODEf(ofunc::S, vert_ps,
7272
transport_rates::Vector{Pair{Int64, SparseMatrixCSC{T, Int64}}},
7373
lrs::LatticeReactionSystem) where {S,T}
7474
# Records which parameters and rates are uniform and which are not.
@@ -82,7 +82,8 @@ struct LatticeTransportODEf{S,T}
8282

8383
# WIP.
8484
nonspatial_osys = complete(convert(ODESystem, reactionsystem(lrs)))
85-
mtk_ps = MT.MTKParameters(nonspatial_osys, [e[1] => e[2][1] for e in vert_ps])
85+
p_init = [p => Dict(vert_ps)[p][1] for p in parameters(nonspatial_osys)]
86+
mtk_ps = MT.MTKParameters(nonspatial_osys, p_init)
8687
p_setters = [MT.setp(nonspatial_osys, p) for p in parameters(nonspatial_osys)]
8788

8889
# Computes the indexes of the vertex parameters in the vector of parameters.
@@ -157,7 +158,7 @@ struct LatticeTransportODEjac{R,S,T}
157158
"""The transport rates. This is a dense or sparse matrix (depending on what type of Jacobian is used)."""
158159
jac_transport::T
159160

160-
function LatticeTransportODEjac(ofunc::R, vert_ps::Vector{Pair{BasicSymbolic{Real},Vector{S}}},
161+
function LatticeTransportODEjac(ofunc::R, vert_ps,
161162
jac_transport::Union{Nothing, SparseMatrixCSC{Float64, Int64}},
162163
lrs::LatticeReactionSystem, sparse::Bool) where {R,S}
163164

@@ -250,23 +251,23 @@ function build_odefunction(lrs::LatticeReactionSystem, vert_ps::Vector{Pair{Basi
250251
ofunc_sparse = ODEFunction(osys; jac = true, sparse = true)
251252
jac_transport = build_jac_prototype(ofunc_sparse.jac_prototype, transport_rates, lrs; set_nonzero = true)
252253
if sparse
253-
f = LatticeTransportODEf(ofunc_sparse, vert_ps, transport_rates, lrs)
254+
f = LatticeTransportODEf(ofunc_sparse, [vert_ps; edge_ps], transport_rates, lrs)
254255
jac_transport = build_jac_prototype(ofunc_sparse.jac_prototype, transport_rates, lrs; set_nonzero = true)
255-
J = LatticeTransportODEjac(ofunc_dense, vert_ps, jac_transport, lrs, true)
256+
J = LatticeTransportODEjac(ofunc_dense, [vert_ps; edge_ps], jac_transport, lrs, true)
256257
jac_prototype = jac_transport
257258
else
258-
f = LatticeTransportODEf(ofunc_dense, vert_ps, transport_rates, lrs)
259-
J = LatticeTransportODEjac(ofunc_dense, vert_ps, jac_transport, lrs, false)
259+
f = LatticeTransportODEf(ofunc_dense, [vert_ps; edge_ps], transport_rates, lrs)
260+
J = LatticeTransportODEjac(ofunc_dense, [vert_ps; edge_ps], jac_transport, lrs, false)
260261
jac_prototype = nothing
261262
end
262263
else
263264
if sparse
264265
ofunc_sparse = ODEFunction(osys; jac = false, sparse = true)
265-
f = LatticeTransportODEf(ofunc_sparse, vert_ps, transport_rates, lrs)
266+
f = LatticeTransportODEf(ofunc_sparse, [vert_ps; edge_ps], transport_rates, lrs)
266267
jac_prototype = build_jac_prototype(ofunc_sparse.jac_prototype, transport_rates, lrs; set_nonzero = false)
267268
else
268269
ofunc_dense = ODEFunction(osys; jac = false, sparse = false)
269-
f = LatticeTransportODEf(ofunc_dense, vert_ps, transport_rates, lrs)
270+
f = LatticeTransportODEf(ofunc_dense, [vert_ps; edge_ps], transport_rates, lrs)
270271
jac_prototype = nothing
271272
end
272273
J = nothing

0 commit comments

Comments
 (0)