From e931b01fc0abf75d34b60e19ff62932cf3413de9 Mon Sep 17 00:00:00 2001 From: Andrew Myers Date: Wed, 19 Nov 2025 13:27:31 -0800 Subject: [PATCH 1/2] Fix loop bounds in selectActualNeighbors --- Src/Particle/AMReX_NeighborParticlesI.H | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Src/Particle/AMReX_NeighborParticlesI.H b/Src/Particle/AMReX_NeighborParticlesI.H index aaf3bb54381..2a201a56a6c 100644 --- a/Src/Particle/AMReX_NeighborParticlesI.H +++ b/Src/Particle/AMReX_NeighborParticlesI.H @@ -1062,9 +1062,9 @@ selectActualNeighbors (CheckPair const& check_pair, int num_cells) int nz = hi.z-lo.z+1; bool isActualNeighbor = false; - for (int ii = amrex::max(ix-num_cells, 0); ii <= amrex::min(ix+num_cells, nx); ++ii) { - for (int jj = amrex::max(iy-num_cells, 0); jj <= amrex::min(iy+num_cells, ny); ++jj) { - for (int kk = amrex::max(iz-num_cells, 0); kk <= amrex::min(iz+num_cells, nz); ++kk) { + for (int ii = amrex::max(ix-num_cells, 0); ii <= amrex::min(ix+num_cells, nx-1); ++ii) { + for (int jj = amrex::max(iy-num_cells, 0); jj <= amrex::min(iy+num_cells, ny-1); ++jj) { + for (int kk = amrex::max(iz-num_cells, 0); kk <= amrex::min(iz+num_cells, nz-1); ++kk) { if (isActualNeighbor) { break; } int nbr_cell_id = (ii * ny + jj) * nz + kk; for (auto p = poffset[nbr_cell_id]; p < poffset[nbr_cell_id+1]; ++p) { From 8e12befef0eda44927e1bbf92d2ce07ece27f304 Mon Sep 17 00:00:00 2001 From: Andrew Myers Date: Wed, 19 Nov 2025 13:29:44 -0800 Subject: [PATCH 2/2] turn back on NeighborParticles test for 1D --- Tests/Particles/NeighborParticles/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/Tests/Particles/NeighborParticles/CMakeLists.txt b/Tests/Particles/NeighborParticles/CMakeLists.txt index 2be1cc61c2d..a346b96f7c2 100644 --- a/Tests/Particles/NeighborParticles/CMakeLists.txt +++ b/Tests/Particles/NeighborParticles/CMakeLists.txt @@ -1,7 +1,4 @@ foreach(D IN LISTS AMReX_SPACEDIM) - if (D EQUAL 1) - continue() - endif () set(_sources CheckPair.H Constants.H main.cpp MDParticleContainer.cpp MDParticleContainer.H )