Skip to content

Commit 59b0742

Browse files
authored
Clear the boundary particle indices' container before updating it. (AMReX-Codes#2907)
This avoids potential segmentation faults when one grid's particles all move to other grids.
1 parent 103db6e commit 59b0742

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Src/Particle/AMReX_NeighborParticlesI.H

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,11 @@ selectActualNeighbors (CheckPair&& check_pair, int num_cells)
821821

822822
for (int lev = 0; lev < this->numLevels(); ++lev)
823823
{
824+
// clear previous neighbor particle ids
825+
for (auto& keyval: m_boundary_particle_ids[lev]) {
826+
keyval.second.clear();
827+
}
828+
824829
for (MyParIter pti(*this, lev); pti.isValid(); ++pti) {
825830
PairIndex index(pti.index(), pti.LocalTileIndex());
826831

0 commit comments

Comments
 (0)