@@ -68,7 +68,7 @@ struct LatticeTransportODEf{S,T}
68
68
""" An iterator over all the edges of the lattice."""
69
69
edge_iterator:: Vector{Pair{Int64, Int64}}
70
70
71
- function LatticeTransportODEf (ofunc:: S , vert_ps:: Vector{Pair{BasicSymbolic{Real},Vector{T}}} ,
71
+ function LatticeTransportODEf (ofunc:: S , vert_ps,
72
72
transport_rates:: Vector{Pair{Int64, SparseMatrixCSC{T, Int64}}} ,
73
73
lrs:: LatticeReactionSystem ) where {S,T}
74
74
# Records which parameters and rates are uniform and which are not.
@@ -82,7 +82,8 @@ struct LatticeTransportODEf{S,T}
82
82
83
83
# WIP.
84
84
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)
86
87
p_setters = [MT. setp (nonspatial_osys, p) for p in parameters (nonspatial_osys)]
87
88
88
89
# Computes the indexes of the vertex parameters in the vector of parameters.
@@ -157,7 +158,7 @@ struct LatticeTransportODEjac{R,S,T}
157
158
""" The transport rates. This is a dense or sparse matrix (depending on what type of Jacobian is used)."""
158
159
jac_transport:: T
159
160
160
- function LatticeTransportODEjac (ofunc:: R , vert_ps:: Vector{Pair{BasicSymbolic{Real},Vector{S}}} ,
161
+ function LatticeTransportODEjac (ofunc:: R , vert_ps,
161
162
jac_transport:: Union{Nothing, SparseMatrixCSC{Float64, Int64}} ,
162
163
lrs:: LatticeReactionSystem , sparse:: Bool ) where {R,S}
163
164
@@ -250,23 +251,23 @@ function build_odefunction(lrs::LatticeReactionSystem, vert_ps::Vector{Pair{Basi
250
251
ofunc_sparse = ODEFunction (osys; jac = true , sparse = true )
251
252
jac_transport = build_jac_prototype (ofunc_sparse. jac_prototype, transport_rates, lrs; set_nonzero = true )
252
253
if sparse
253
- f = LatticeTransportODEf (ofunc_sparse, vert_ps, transport_rates, lrs)
254
+ f = LatticeTransportODEf (ofunc_sparse, [ vert_ps; edge_ps] , transport_rates, lrs)
254
255
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 )
256
257
jac_prototype = jac_transport
257
258
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 )
260
261
jac_prototype = nothing
261
262
end
262
263
else
263
264
if sparse
264
265
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)
266
267
jac_prototype = build_jac_prototype (ofunc_sparse. jac_prototype, transport_rates, lrs; set_nonzero = false )
267
268
else
268
269
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)
270
271
jac_prototype = nothing
271
272
end
272
273
J = nothing
0 commit comments