Skip to content

Commit 9ab6437

Browse files
committed
fix
1 parent 520bf89 commit 9ab6437

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/spatial_reaction_systems/spatial_ODE_systems.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct LatticeTransportODEf{R,S,T}
1313
"""Temporary vector. For parameters which values are identical across the lattice, at some point these have to be converted of a length num_verts vector. To avoid re-allocation they are written to this vector."""
1414
work_vert_ps::Vector{S}
1515
"""For each parameter in vert_ps, its value is a vector with length either num_verts or 1. To know whenever a parameter's value need expanding to the work_vert_ps array, its length needs checking. This check is done once, and the value stored to this array. This field (specifically) is an enumerate over that array."""
16-
enum_v_ps_idx_types::Base.Iterators.Enumerate{BitVector}
16+
enum_v_ps_idx_types::Base.Iterators.Enumerate{Vector{Bool}}
1717
"""A vector of pairs, with a value for each species with transportation. The first value is the species index (in the species(::ReactionSystem) vector), and the second is a vector with its transport rate values. If the transport rate is uniform (across all edges), that value is the only value in the vector. Else, there is one value for each edge in the lattice."""
1818
transport_rates::Vector{Pair{Int64, Vector{S}}}
1919
"""A matrix, NxM, where N is the number of species with transportation and M the number of vertexes. Each value is the total rate at which that species leaves that vertex (e.g. for a species with constant diffusion rate D, in a vertex with n neighbours, this value is n*D)."""
@@ -51,15 +51,15 @@ struct LatticeTransportODEjac{R,S,T}
5151
"""Temporary vector. For parameters which values are identical across the lattice, at some point these have to be converted of a length(num_verts) vector. To avoid re-allocation they are written to this vector."""
5252
work_vert_ps::Vector{S}
5353
"""For each parameter in vert_ps, it either have length num_verts or 1. To know whenever a parameter's value need expanding to the work_vert_ps array, its length needs checking. This check is done once, and the value stored to this array. This field (specifically) is an enumerate over that array."""
54-
enum_v_ps_idx_types::Base.Iterators.Enumerate{BitVector}
54+
enum_v_ps_idx_types::Base.Iterators.Enumerate{Vector{Bool}}
5555
"""Whether the Jacobian is sparse or not."""
5656
sparse::Bool
5757
"""The transport rates. Can be a dense matrix (for non-sparse) or as the "nzval" field if sparse."""
5858
jac_values::T
5959

6060
function LatticeTransportODEjac(ofunc::R, vert_ps::Vector{Vector{S}}, lrs::LatticeReactionSystem, jac_prototype::Union{Nothing, SparseMatrixCSC{Float64, Int64}}, sparse::Bool) where {R,S}
6161
work_vert_ps = zeros(lrs.num_verts)
62-
enum_v_ps_idx_types = enumerate(length.(vert_ps) .== 1) # Creates a Boolean vector whether each vertex parameter need expanding or (an enumerates it, since it always appear in this form).
62+
enum_v_ps_idx_types = enumerate(map(vp -> length(vp) == 1, vert_ps))
6363
jac_values = sparse ? jac_prototype.nzval : Matrix(jac_prototype) # Retrieves the diffusion values (form depending on Jacobian sparsity).
6464
new{R,S,typeof(jac_values)}(ofunc, lrs.num_verts, lrs.num_species, vert_ps, work_vert_ps, enum_v_ps_idx_types, sparse, jac_values)
6565
end
@@ -177,7 +177,7 @@ function (jac_func::LatticeTransportODEjac)(J, u, p, t)
177177
for vert_i in 1:(jac_func.num_verts)
178178
idxs = get_indexes(vert_i, jac_func.num_species)
179179
vert_ps = view_vert_ps_vector!(jac_func.work_vert_ps, p, vert_i, jac_func.enum_v_ps_idx_types)
180-
jac_func.ofunc.jac((@view J[idxs, idxs], (@view u[idxs]), vert_ps, t))
180+
jac_func.ofunc.jac((@view J[idxs, idxs]), (@view u[idxs]), vert_ps, t)
181181
end
182182

183183
# Updates for the spatial reactions (adds the Jacobian values from the diffusion reactions).

0 commit comments

Comments
 (0)