Skip to content

Commit

Permalink
🐛 Disambiguate :α symbols in :compact generated code.
Browse files Browse the repository at this point in the history
Proper fix once #98 has been adressed.
  • Loading branch information
iago-lito committed Jan 23, 2023
1 parent 40a61d4 commit f8c144a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/inputs/functional_response.jl
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ function (F::LinearResponse)(parms, ::Symbol)

# Basic information made available as variables in the generated code.
S = richness(parms.network)
data = Dict(:S => S, :α => F.α)
data = Dict(:S => S, :α_F => F.α)

# Flatten sparse matrices into plain compact arrays.
cons, res = findnz(parms.network.A)
Expand All @@ -464,7 +464,7 @@ function (F::LinearResponse)(parms, ::Symbol)
# Construct FR values.
# (only one iteration over nonzero (i,j) entries is needed)
for (ij, (i, j)) in enumerate(zip(nonzero_links...))
F[ij] = ω[ij] * α[i] * B[j]
F[ij] = ω[ij] * α_F[i] * B[j]
end
)]

Expand Down
12 changes: 7 additions & 5 deletions src/model/generate_dbdt_compact.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ function generate_dbdt_compact(parms::ModelParameters)
for (k, v) in d
if haskey(data, k) && v != data[k]
throw(
"Error in package source: \n" *
"$(gen) code generator produced data '$(k)': $v " *
"($(typeof(v)))\n" *
"inconsistently with previously generated data '$(k)': $(data[k]) " *
"($(typeof(data[k])))\n",
AssertionError(
"Error in package source: \n" *
"$(gen) code generator produced data '$(k)': $v " *
"($(typeof(v)))\n" *
"inconsistently with previously generated data '$(k)': $(data[k]) " *
"($(typeof(data[k])))\n",
),
)
end
data[k] = v
Expand Down

0 comments on commit f8c144a

Please sign in to comment.