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

Remove old code for z-index sort #3

Merged
merged 2 commits into from
May 8, 2024
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
23 changes: 0 additions & 23 deletions src/grid_nhs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -350,29 +350,6 @@ end
return floor(Int, i)
end

# Sorting only really makes sense in longer simulations where particles
# end up very unordered.
# WARNING: This is currently unmaintained.
function z_index_sort!(coordinates, system)
(; mass, pressure, neighborhood_search) = system

perm = sortperm(eachparticle(system),
by = (i -> cell_z_index(extract_svector(coordinates, system, i),
neighborhood_search)))

permute!(mass, perm)
permute!(pressure, perm)
Base.permutecols!!(u, perm)

return nothing
end

@inline function cell_z_index(coords, neighborhood_search)
cell = cell_coords(coords, neighborhood_search.search_radius) .+ 1

return cartesian2morton(SVector(cell))
end

# Create a copy of a neighborhood search but with a different search radius
function copy_neighborhood_search(nhs::GridNeighborhoodSearch, search_radius, u)
if nhs.periodic_box === nothing
Expand Down
Loading