Skip to content

Commit

Permalink
Add create_neighborhood_search for NeighborListsNeighborhoodSearch
Browse files Browse the repository at this point in the history
  • Loading branch information
efaulhaber committed Jun 11, 2024
1 parent 17d95b6 commit f369574
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ StaticArrays = "1"
StrideArrays = "0.1"
TimerOutputs = "0.5"
TrixiBase = "0.1"
PointNeighbors = "0.2"
PointNeighbors = "0.2.4"
WriteVTK = "1"
julia = "1.9"
3 changes: 2 additions & 1 deletion src/TrixiParticles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ using StaticArrays: @SMatrix, SMatrix, setindex
using StrideArrays: PtrArray, StaticInt
using TimerOutputs: TimerOutput, TimerOutputs, print_timer, reset_timer!
using TrixiBase: trixi_include
@reexport using PointNeighbors: TrivialNeighborhoodSearch, GridNeighborhoodSearch
@reexport using PointNeighbors: TrivialNeighborhoodSearch, GridNeighborhoodSearch,
NeighborListsNeighborhoodSearch
using PointNeighbors: PointNeighbors, for_particle_neighbor
using WriteVTK: vtk_grid, MeshCell, VTKCellTypes, paraview_collection, vtk_save

Expand Down
15 changes: 15 additions & 0 deletions src/general/semidiscretization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,21 @@ function create_neighborhood_search(system, neighbor, ::Val{GridNeighborhoodSear
return search
end

function create_neighborhood_search(system, neighbor,
::Val{NeighborListsNeighborhoodSearch},
periodic_box_min_corner, periodic_box_max_corner,
threaded_nhs_update)
radius = compact_support(system, neighbor)
search = NeighborListsNeighborhoodSearch{ndims(system)}(radius, nparticles(neighbor),
periodic_box_min_corner=periodic_box_min_corner,
periodic_box_max_corner=periodic_box_max_corner)
# Initialize neighborhood search
PointNeighbors.initialize!(search, initial_coordinates(system),
initial_coordinates(neighbor))

return search
end

@inline function compact_support(system, neighbor)
(; smoothing_kernel, smoothing_length) = system
return compact_support(smoothing_kernel, smoothing_length)
Expand Down

0 comments on commit f369574

Please sign in to comment.