Skip to content

Commit 0795917

Browse files
committed
up
1 parent d5d8873 commit 0795917

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/spatial_reaction_systems/spatial_ODE_systems.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,16 @@ function DiffEqBase.ODEProblem(lrs::LatticeReactionSystem, u0_in, tspan,
7373
jac = true, sparse = jac, kwargs...)
7474
is_transport_system(lrs) || error("Currently lattice ODE simulations are only supported when all spatial reactions are TransportReactions.")
7575

76-
# Converts potential symmaps to varmaps.
76+
# Converts potential symmaps to varmaps (parameter conversion is more involved since the vertex and edge parameters may be given in a tuple, or in a common vector).
7777
u0_in = symmap_to_varmap(lrs, u0_in)
78-
p_in = (p_in isa Tuple{<:Any,<:Any}) ? (symmap_to_varmap(lrs, p_in[1]),symmap_to_varmap(lrs, p_in[2])) : symmap_to_varmap(lrs, p_in) # Parameters can be given in Tuple form (where the first element is the vertex parameters and the second the edge parameters). In this case, we have to covert each element separately.
78+
p_in = (p_in isa Tuple{<:Any,<:Any}) ? (symmap_to_varmap(lrs, p_in[1]),symmap_to_varmap(lrs, p_in[2])) : symmap_to_varmap(lrs, p_in)
7979

8080
# Converts u0 and p to their internal forms.
8181
# u0 is [spec 1 at vert 1, spec 2 at vert 1, ..., spec 1 at vert 2, ...].
8282
u0 = lattice_process_u0(u0_in, species(lrs), lrs.num_verts)
83-
vert_ps, edge_ps = lattice_process_p(p_in, vertex_parameters(lrs), edge_parameters(lrs), lrs) # Both vert_ps and edge_ps becomes vectors of vectors. Each have 1 element for each parameter. These elements are length 1 vectors (if the parameter is uniform), or length num_verts/nE, with unique values for each vertex/edge (for vert_ps/edge_ps, respectively).
83+
# Both vert_ps and edge_ps becomes vectors of vectors. Each have 1 element for each parameter.
84+
# These elements are length 1 vectors (if the parameter is uniform), or length num_verts/nE, with unique values for each vertex/edge (for vert_ps/edge_ps, respectively).
85+
vert_ps, edge_ps = lattice_process_p(p_in, vertex_parameters(lrs), edge_parameters(lrs), lrs)
8486

8587
# Creates ODEProblem.
8688
ofun = build_odefunction(lrs, vert_ps, edge_ps, jac, sparse) # Builds the ODEFunction.

0 commit comments

Comments
 (0)