Skip to content

Comments

Replace cell Dict with vector-backed CellLookup for neighbor lists#137

Open
AhmedSalih3d wants to merge 6 commits intocodex/optimize-neighborlist-code-performancefrom
codex/remove-dict-and-replace-with-vectors
Open

Replace cell Dict with vector-backed CellLookup for neighbor lists#137
AhmedSalih3d wants to merge 6 commits intocodex/optimize-neighborlist-code-performancefrom
codex/remove-dict-and-replace-with-vectors

Conversation

@AhmedSalih3d
Copy link
Owner

Motivation

  • Replace the per-cell Dict with contiguous vector-backed lookup arrays to reduce allocations and improve performance and future GPU portability.
  • Update neighbor-list construction and all cell-index lookups to use a stable, allocation-free interface.

Description

  • Added a CellLookup{D} mutable struct and helpers: InitializeCellLookup, ResetCellLookup!, GetCellIndex, SetCellIndex!, and an inline HashCellIndex implementation, plus capacity/resize helpers in src/SPHNeighborList.jl.
  • Replaced Dict{CartesianIndex,Int} usage with CellLookup across neighbor-list code and simulation flow, updating function signatures and call sites in src/SPHNeighborList.jl and src/SPHCellList.jl (e.g. UpdateNeighbors!, BuildNeighborCellLists!, neighbor loops, MDBC handling, and RunSimulation setup).
  • Adjusted probing wrap arithmetic in the hash loop and added a power-of-two sizing strategy with mask-based indexing to keep lookups branch-friendly and allocation-minimal.
  • Commands executed during the change include rg, sed, apply_patch (multiple), git add, and git commit (used to inspect and modify files and record the change).

Testing

  • No automated tests were executed for this change.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant