Skip to content

Commit c70e716

Browse files
committed
format update
1 parent a98f4be commit c70e716

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

src/spatial_reaction_systems/lattice_jump_systems.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ function DiffEqBase.DiscreteProblem(lrs::LatticeReactionSystem, u0_in, tspan,
1919
# vert_ps values are vectors. Here, index (i) is a parameter's value in vertex i.
2020
# edge_ps values are sparse matrices. Here, index (i,j) is a parameter's value in the edge from vertex i to vertex j.
2121
# Uniform vertex/edge parameters store only a single value (a length 1 vector, or size 1x1 sparse matrix).
22-
vert_ps, edge_ps = lattice_process_p(p_in, vertex_parameters(lrs), edge_parameters(lrs),
23-
lrs)
22+
vert_ps, edge_ps = lattice_process_p(p_in, vertex_parameters(lrs),
23+
edge_parameters(lrs), lrs)
2424

2525
# Returns a DiscreteProblem (which basically just stores the processed input).
2626
return DiscreteProblem(u0, tspan, [vert_ps; edge_ps], args...; kwargs...)
2727
end
2828

2929
# Builds a spatial JumpProblem from a DiscreteProblem containing a `LatticeReactionSystem`.
30-
function JumpProcesses.JumpProblem(lrs::LatticeReactionSystem, dprob, aggregator,args...;
31-
combinatoric_ratelaws = get_combinatoric_ratelaws(reactionsystem(lrs)),
30+
function JumpProcesses.JumpProblem(lrs::LatticeReactionSystem, dprob, aggregator, args...;
31+
combinatoric_ratelaws = get_combinatoric_ratelaws(reactionsystem(lrs)),
3232
name = nameof(reactionsystem(lrs)), kwargs...)
3333
# Error checks.
3434
if !isnothing(dprob.f.sys)

src/spatial_reaction_systems/lattice_reaction_systems.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ struct LatticeReactionSystem{Q, R, S, T} <: MT.AbstractTimeDependentSystem
4848
edge_iterator::T
4949

5050
function LatticeReactionSystem(rs::ReactionSystem{Q}, spatial_reactions::Vector{R},
51-
lattice::S, num_verts::Int64, num_edges::Int64, edge_iterator::T) where {Q, R, S, T}
51+
lattice::S, num_verts::Int64, num_edges::Int64,
52+
edge_iterator::T) where {Q, R, S, T}
5253
# Error checks.
5354
if !(R <: AbstractSpatialReaction)
5455
throw(ArgumentError("The second argument must be a vector of AbstractSpatialReaction subtypes."))
@@ -121,7 +122,7 @@ end
121122

122123
# Creates a LatticeReactionSystem from a CartesianGrid lattice (cartesian grid) or a Boolean Array
123124
# lattice (masked grid). These two are quite similar, so much code can be reused in a single interface.
124-
function LatticeReactionSystem(rs, srs, lattice::GridLattice{N, T};
125+
function LatticeReactionSystem(rs, srs, lattice::GridLattice{N, T};
125126
diagonal_connections = false) where {N, T}
126127
# Error checks.
127128
(N > 3) && error("Grids of higher dimension than 3 is currently not supported.")
@@ -144,7 +145,7 @@ function LatticeReactionSystem(rs, srs, lattice::GridLattice{N, T};
144145
edge_iterator = Vector{Pair{Int64, Int64}}(undef, num_edges)
145146
for (flat_idx, grid_idx) in enumerate(flat_to_grid_idx)
146147
for neighbour_grid_idx in get_neighbours(lattice, grid_idx, g_size;
147-
diagonal_connections)
148+
diagonal_connections)
148149
cur_vert += 1
149150
edge_iterator[cur_vert] = flat_idx => grid_to_flat_idx[neighbour_grid_idx...]
150151
end
@@ -270,7 +271,7 @@ edge_iterator(lrs::LatticeReactionSystem) = getfield(lrs, :edge_iterator)
270271
271272
Returns `true` if all spatial reactions in `lrs` are `TransportReaction`s.
272273
"""
273-
function is_transport_system(lrs::LatticeReactionSystem)
274+
function is_transport_system(lrs::LatticeReactionSystem)
274275
return all(sr -> sr isa TransportReaction, spatial_reactions(lrs))
275276
end
276277

@@ -296,7 +297,7 @@ has_masked_lattice(lrs::LatticeReactionSystem) = lattice(lrs) isa Array{Bool, N}
296297
297298
Returns `true` if `lrs` was created using a cartesian or masked grid lattice. Otherwise, returns `false`.
298299
"""
299-
function has_grid_lattice(lrs::LatticeReactionSystem)
300+
function has_grid_lattice(lrs::LatticeReactionSystem)
300301
return has_cartesian_lattice(lrs) || has_masked_lattice(lrs)
301302
end
302303

@@ -445,7 +446,7 @@ function make_edge_p_values(lrs::LatticeReactionSystem, make_edge_p_value::Funct
445446
# If not, then the sparse matrix simply becomes empty in that position.
446447
values[e[1], e[2]] = eps()
447448

448-
values[e[1], e[2]] = make_edge_p_value(flat_to_grid_idx[e[1]],
449+
values[e[1], e[2]] = make_edge_p_value(flat_to_grid_idx[e[1]],
449450
flat_to_grid_idx[e[2]])
450451
end
451452

src/spatial_reaction_systems/spatial_ODE_systems.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct LatticeTransportODEFunction{P, Q, R, S, T}
6666

6767
function LatticeTransportODEFunction(ofunc::P, ps::Vector{<:Pair},
6868
lrs::LatticeReactionSystem, sparse::Bool,
69-
jac_transport::Union{Nothing, Matrix{S}, SparseMatrixCSC{S, Int64}},
69+
jac_transport::Union{Nothing, Matrix{S}, SparseMatrixCSC{S, Int64}},
7070
transport_rates::Vector{Pair{Int64, SparseMatrixCSC{S, Int64}}}) where {P, S}
7171
# Computes `LatticeTransportODEFunction` functor fields.
7272
heterogeneous_vert_p_idxs = make_heterogeneous_vert_p_idxs(ps, lrs)
@@ -75,9 +75,9 @@ struct LatticeTransportODEFunction{P, Q, R, S, T}
7575
lrs)
7676

7777
# Creates and returns the `LatticeTransportODEFunction` functor.
78-
new{P, typeof(mtk_ps), typeof(p_setters), S, typeof(jac_transport)}(ofunc,
78+
new{P, typeof(mtk_ps), typeof(p_setters), S, typeof(jac_transport)}(ofunc,
7979
num_verts(lrs), num_species(lrs), heterogeneous_vert_p_idxs, mtk_ps, p_setters,
80-
transport_rates, t_rate_idx_types, leaving_rates, Catalyst.edge_iterator(lrs),
80+
transport_rates, t_rate_idx_types, leaving_rates, Catalyst.edge_iterator(lrs),
8181
jac_transport, sparse, lrs)
8282
end
8383
end
@@ -88,7 +88,7 @@ end
8888
function make_heterogeneous_vert_p_idxs(ps, lrs)
8989
p_dict = Dict(ps)
9090
return findall((p_dict[p] isa Vector) && (length(p_dict[p]) > 1)
91-
for p in parameters(lrs))
91+
for p in parameters(lrs))
9292
end
9393

9494
# Creates the MTKParameters structure and `p_setters` vector (which are used to manage
@@ -110,7 +110,7 @@ function make_t_types_and_leaving_rates(transport_rates, lrs)
110110
for (s_idx, tr_pair) in enumerate(transport_rates)
111111
for e in Catalyst.edge_iterator(lrs)
112112
# Updates the exit rate for species s_idx from vertex e.src.
113-
leaving_rates[s_idx, e[1]] += get_transport_rate(tr_pair[2], e,
113+
leaving_rates[s_idx, e[1]] += get_transport_rate(tr_pair[2], e,
114114
t_rate_idx_types[s_idx])
115115
end
116116
end
@@ -196,8 +196,8 @@ function DiffEqBase.ODEProblem(lrs::LatticeReactionSystem, u0_in, tspan,
196196
# edge_ps values are sparse matrices. Here, index (i,j) is a parameter's value in the edge from vertex i to vertex j.
197197
# Uniform vertex/edge parameters store only a single value (a length 1 vector, or size 1x1 sparse matrix).
198198
# In the `ODEProblem` vert_ps and edge_ps are merged (but for building the ODEFunction, they are separate).
199-
vert_ps, edge_ps = lattice_process_p(p_in, vertex_parameters(lrs), edge_parameters(lrs),
200-
lrs)
199+
vert_ps, edge_ps = lattice_process_p(p_in, vertex_parameters(lrs),
200+
edge_parameters(lrs), lrs)
201201

202202
# Creates the ODEFunction.
203203
ofun = build_odefunction(lrs, vert_ps, edge_ps, jac, sparse, name, include_zero_odes,
@@ -347,7 +347,7 @@ function rebuild_lat_internals!(lt_ofun::LatticeTransportODEFunction, ps_new,
347347
# Recreates the new parameters on the requisite form.
348348
ps_new = [(length(p) == 1) ? p[1] : p for p in deepcopy(ps_new)]
349349
ps_new = [p => p_val for (p, p_val) in zip(parameters(lrs), deepcopy(ps_new))]
350-
vert_ps, edge_ps = lattice_process_p(ps_new, vertex_parameters(lrs),
350+
vert_ps, edge_ps = lattice_process_p(ps_new, vertex_parameters(lrs),
351351
edge_parameters(lrs), lrs)
352352
ps_new = [vert_ps; edge_ps]
353353

0 commit comments

Comments
 (0)