Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix allocs #1695

Merged
merged 7 commits into from
Oct 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions src/solvers/dgmulti/dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -465,24 +465,13 @@ function calc_boundary_flux!(cache, t, boundary_conditions::BoundaryConditionPer
nothing
end

# "lispy tuple programming" instead of for loop for type stability
function calc_boundary_flux!(cache, t, boundary_conditions, mesh,
have_nonconservative_terms, equations, dg::DGMulti)

# peel off first boundary condition
calc_single_boundary_flux!(cache, t, first(boundary_conditions),
first(keys(boundary_conditions)),
mesh, have_nonconservative_terms, equations, dg)

# recurse on the remainder of the boundary conditions
calc_boundary_flux!(cache, t, Base.tail(boundary_conditions),
mesh, have_nonconservative_terms, equations, dg)
end

# terminate recursion
function calc_boundary_flux!(cache, t, boundary_conditions::NamedTuple{(), Tuple{}},
mesh, have_nonconservative_terms, equations, dg::DGMulti)
nothing
for (key, value) in zip(keys(boundary_conditions), boundary_conditions)
calc_single_boundary_flux!(cache, t, value,
key,
mesh, have_nonconservative_terms, equations, dg)
end
end

function calc_single_boundary_flux!(cache, t, boundary_condition, boundary_key, mesh,
Expand Down
Loading