Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring authored Sep 17, 2024
1 parent 70bc058 commit f17e398
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/callbacks_step/amr_dg1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,10 @@ function coarsen!(u_ode::AbstractVector, adaptor, mesh::TreeMesh{1},
# Coarsen elements and store solution directly in new data structure
coarsen_elements!(u, element_id, old_u, old_element_id,
adaptor, equations, dg)
# Increment `element_id` on the coarsened mesh by one and `skip` = 1 in 1D
# because 2 children elements become 1 parent element
element_id += 1
skip = 2 - 1
skip = 1
else
# Copy old element data to new element container
@views u[:, .., element_id] .= old_u[:, .., old_element_id]
Expand Down
4 changes: 2 additions & 2 deletions src/callbacks_step/amr_dg2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function refine!(u_ode::AbstractVector, adaptor, mesh::Union{TreeMesh{2}, P4estM

# Increment `element_id` on the refined mesh with the number
# of children, i.e., 4 in 2D
element_id += 2^2
element_id += 4
else
if mesh isa P4estMesh
# Copy old element data to new element container and remove Jacobian scaling
Expand Down Expand Up @@ -349,7 +349,7 @@ function coarsen!(u_ode::AbstractVector, adaptor,
# Increment `element_id` on the coarsened mesh by one and `skip` = 3 in 2D
# because 4 children elements become 1 parent element
element_id += 1
skip = 2^2 - 1
skip = 3
else
if mesh isa P4estMesh
# Copy old element data to new element container and remove Jacobian scaling
Expand Down
6 changes: 3 additions & 3 deletions src/callbacks_step/amr_dg3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function refine!(u_ode::AbstractVector, adaptor, mesh::Union{TreeMesh{3}, P4estM

# Increment `element_id` on the refined mesh with the number
# of children, i.e., 8 in 3D
element_id += 2^3
element_id += 8
else
if mesh isa P4estMesh
# Copy old element data to new element container and remove Jacobian scaling
Expand All @@ -98,7 +98,7 @@ function refine!(u_ode::AbstractVector, adaptor, mesh::Union{TreeMesh{3}, P4estM
# the counter `element_id` can have two different values at the end.
@assert element_id ==
nelements(dg, cache) +
1||element_id == nelements(dg, cache) + 2^3 "element_id = $element_id, nelements(dg, cache) = $(nelements(dg, cache))"
1||element_id == nelements(dg, cache) + 8 "element_id = $element_id, nelements(dg, cache) = $(nelements(dg, cache))"
end # GC.@preserve old_u_ode old_inverse_jacobian

# Sanity check
Expand Down Expand Up @@ -269,7 +269,7 @@ function coarsen!(u_ode::AbstractVector, adaptor,
# Increment `element_id` on the coarsened mesh by one and `skip` = 7 in 3D
# because 8 children elements become 1 parent element
element_id += 1
skip = 2^3 - 1
skip = 7
else
if mesh isa P4estMesh
# Copy old element data to new element container and remove Jacobian scaling
Expand Down

0 comments on commit f17e398

Please sign in to comment.