Skip to content
Snippets Groups Projects
Commit a9bfc4a6 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Applied the same checks for already removed particles to the other species.

parent 45c79942
No related branches found
No related tags found
1 merge request!871Fix rare removing particles bug
...@@ -5323,6 +5323,9 @@ void cell_remove_part(const struct engine *e, struct cell *c, struct part *p, ...@@ -5323,6 +5323,9 @@ void cell_remove_part(const struct engine *e, struct cell *c, struct part *p,
if (c->nodeID != e->nodeID) if (c->nodeID != e->nodeID)
error("Can't remove a particle in a foreign cell."); error("Can't remove a particle in a foreign cell.");
/* Don't remove a particle twice */
if (p->time_bin == time_bin_inhibited) return;
/* Mark the particle as inhibited */ /* Mark the particle as inhibited */
p->time_bin = time_bin_inhibited; p->time_bin = time_bin_inhibited;
...@@ -5357,6 +5360,10 @@ void cell_remove_part(const struct engine *e, struct cell *c, struct part *p, ...@@ -5357,6 +5360,10 @@ void cell_remove_part(const struct engine *e, struct cell *c, struct part *p,
void cell_remove_gpart(const struct engine *e, struct cell *c, void cell_remove_gpart(const struct engine *e, struct cell *c,
struct gpart *gp) { struct gpart *gp) {
/* Quick cross-check */
if (c->nodeID != e->nodeID)
error("Can't remove a particle in a foreign cell.");
/* Don't remove a particle twice */ /* Don't remove a particle twice */
if (gp->time_bin == time_bin_inhibited) return; if (gp->time_bin == time_bin_inhibited) return;
...@@ -5388,6 +5395,9 @@ void cell_remove_spart(const struct engine *e, struct cell *c, ...@@ -5388,6 +5395,9 @@ void cell_remove_spart(const struct engine *e, struct cell *c,
if (c->nodeID != e->nodeID) if (c->nodeID != e->nodeID)
error("Can't remove a particle in a foreign cell."); error("Can't remove a particle in a foreign cell.");
/* Don't remove a particle twice */
if (sp->time_bin == time_bin_inhibited) return;
/* Mark the particle as inhibited and stand-alone */ /* Mark the particle as inhibited and stand-alone */
sp->time_bin = time_bin_inhibited; sp->time_bin = time_bin_inhibited;
if (sp->gpart) { if (sp->gpart) {
...@@ -5421,6 +5431,9 @@ void cell_remove_bpart(const struct engine *e, struct cell *c, ...@@ -5421,6 +5431,9 @@ void cell_remove_bpart(const struct engine *e, struct cell *c,
if (c->nodeID != e->nodeID) if (c->nodeID != e->nodeID)
error("Can't remove a particle in a foreign cell."); error("Can't remove a particle in a foreign cell.");
/* Don't remove a particle twice */
if (bp->time_bin == time_bin_inhibited) return;
/* Mark the particle as inhibited and stand-alone */ /* Mark the particle as inhibited and stand-alone */
bp->time_bin = time_bin_inhibited; bp->time_bin = time_bin_inhibited;
if (bp->gpart) { if (bp->gpart) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment