Skip to content

Add non-sorting neighbor list option with per-cell particle order buffer#133

Open
AhmedSalih3d wants to merge 9 commits intocodex/refactor-to-avoid-if-statementfrom
codex/optimize-neighborlist-code-performance
Open

Add non-sorting neighbor list option with per-cell particle order buffer#133
AhmedSalih3d wants to merge 9 commits intocodex/refactor-to-avoid-if-statementfrom
codex/optimize-neighborlist-code-performance

Conversation

@AhmedSalih3d
Copy link
Owner

Motivation

  • Provide an alternative neighbor-list rebuild that avoids re-sorting the particle arrays so particle storage remains stable (useful for external references or when reordering is expensive).
  • Allow building a per-cell particle ordering buffer so neighbor iteration can proceed without mutating particle storage.
  • Make the non-sorting path selectable at runtime and thread the ordering through neighbor loops and MDBC to preserve behavior.

Description

  • Added UpdateNeighborsNoSort! to src/SPHNeighborList.jl which builds per-cell ParticleOrder and CellOffsets buffers instead of sorting particles, and exported the new symbol.
  • Threaded optional ParticleOrder into neighbor loops, MDBC handling, and the main simulation loop in src/SPHCellList.jl, including a small ResolveParticleIndex helper to map indices when an order buffer is used.
  • Added ParticleOrder and CellOffsets allocations and a UseSortingNeighborList::Bool switch to SimulationMetaData in src/SimulationMetaDataConfiguration.jl, exposed the new option in SPHExample exports, and documented the switch in README.md.
  • Updated exports and call sites so either the original sorting path (UpdateNeighbors!) or the new no-sort path (UpdateNeighborsNoSort!) is used depending on SimMetaData.UseSortingNeighborList.

Testing

  • No automated tests or CI jobs were executed for this change (none were run).

Codex Task

@AhmedSalih3d AhmedSalih3d force-pushed the codex/optimize-neighborlist-code-performance branch 2 times, most recently from ccb94c4 to 78172ee Compare January 14, 2026 22:27
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