Skip to content

Commit aa4d57a

Browse files
authored
[WIP] Fix loop bounds in selectActualNeighbors (#4809)
The proposed changes: - [x] fix a bug or incorrect behavior in AMReX - [ ] add new capabilities to AMReX - [ ] changes answers in the test suite to more than roundoff level - [ ] are likely to significantly affect the results of downstream AMReX users - [ ] include documentation in the code and/or rst files, if appropriate
1 parent 5102120 commit aa4d57a

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

Src/Particle/AMReX_NeighborParticlesI.H

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,9 +1054,9 @@ selectActualNeighbors (CheckPair const& check_pair, int num_cells)
10541054
int nz = hi.z-lo.z+1;
10551055

10561056
bool isActualNeighbor = false;
1057-
for (int ii = amrex::max(ix-num_cells, 0); ii <= amrex::min(ix+num_cells, nx); ++ii) {
1058-
for (int jj = amrex::max(iy-num_cells, 0); jj <= amrex::min(iy+num_cells, ny); ++jj) {
1059-
for (int kk = amrex::max(iz-num_cells, 0); kk <= amrex::min(iz+num_cells, nz); ++kk) {
1057+
for (int ii = amrex::max(ix-num_cells, 0); ii <= amrex::min(ix+num_cells, nx-1); ++ii) {
1058+
for (int jj = amrex::max(iy-num_cells, 0); jj <= amrex::min(iy+num_cells, ny-1); ++jj) {
1059+
for (int kk = amrex::max(iz-num_cells, 0); kk <= amrex::min(iz+num_cells, nz-1); ++kk) {
10601060
if (isActualNeighbor) { break; }
10611061
int nbr_cell_id = (ii * ny + jj) * nz + kk;
10621062
for (auto p = poffset[nbr_cell_id]; p < poffset[nbr_cell_id+1]; ++p) {

Tests/Particles/NeighborParticles/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
foreach(D IN LISTS AMReX_SPACEDIM)
2-
if (D EQUAL 1)
3-
continue()
4-
endif ()
52

63
set(_sources CheckPair.H Constants.H main.cpp MDParticleContainer.cpp MDParticleContainer.H )
74

0 commit comments

Comments
 (0)