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

When redistributing, the debugging checks need to verify that particles are...

When redistributing, the debugging checks need to verify that particles are sorted in the right node, not in the right cell.
parent e8d94096
Branches
Tags
1 merge request!310Star particles and gparts links over MPI
...@@ -296,20 +296,22 @@ void engine_redistribute(struct engine *e) { ...@@ -296,20 +296,22 @@ void engine_redistribute(struct engine *e) {
const struct part *p = &s->parts[k]; const struct part *p = &s->parts[k];
/* New cell index */ /* New cell index */
const int new_ind = const int new_cid =
cell_getid(s->cdim, p->x[0] * s->iwidth[0], p->x[1] * s->iwidth[1], cell_getid(s->cdim, p->x[0] * s->iwidth[0], p->x[1] * s->iwidth[1],
p->x[2] * s->iwidth[2]); p->x[2] * s->iwidth[2]);
/* New cell of this part */ /* New cell of this part */
const struct cell *c = &s->cells_top[new_ind]; const struct cell *c = &s->cells_top[new_cid];
const int new_node = c->nodeID;
if (dest[k] != new_ind) if (dest[k] != new_node)
error("part's new cell index not matching sorted index."); error("part's new node index not matching sorted index.");
if (p->x[0] < c->loc[0] || p->x[0] > c->loc[0] + c->width[0] || if (p->x[0] < c->loc[0] || p->x[0] > c->loc[0] + c->width[0] ||
p->x[1] < c->loc[1] || p->x[1] > c->loc[1] + c->width[1] || p->x[1] < c->loc[1] || p->x[1] > c->loc[1] + c->width[1] ||
p->x[2] < c->loc[2] || p->x[2] > c->loc[2] + c->width[2]) p->x[2] < c->loc[2] || p->x[2] > c->loc[2] + c->width[2])
error("part not sorted into the right top-level cell!"); error("part not sorted into the right top-level cell!");
} }
#endif #endif
...@@ -375,15 +377,16 @@ void engine_redistribute(struct engine *e) { ...@@ -375,15 +377,16 @@ void engine_redistribute(struct engine *e) {
const struct spart *sp = &s->sparts[k]; const struct spart *sp = &s->sparts[k];
/* New cell index */ /* New cell index */
const int new_sind = const int new_cid =
cell_getid(s->cdim, sp->x[0] * s->iwidth[0], sp->x[1] * s->iwidth[1], cell_getid(s->cdim, sp->x[0] * s->iwidth[0], sp->x[1] * s->iwidth[1],
sp->x[2] * s->iwidth[2]); sp->x[2] * s->iwidth[2]);
/* New cell of this spart */ /* New cell of this spart */
const struct cell *c = &s->cells_top[new_sind]; const struct cell *c = &s->cells_top[new_cid];
const int new_node = c->nodeID;
if (s_dest[k] != new_sind) if (s_dest[k] != new_node)
error("spart's new cell index not matching sorted index."); error("spart's new node index not matching sorted index.");
if (sp->x[0] < c->loc[0] || sp->x[0] > c->loc[0] + c->width[0] || if (sp->x[0] < c->loc[0] || sp->x[0] > c->loc[0] + c->width[0] ||
sp->x[1] < c->loc[1] || sp->x[1] > c->loc[1] + c->width[1] || sp->x[1] < c->loc[1] || sp->x[1] > c->loc[1] + c->width[1] ||
...@@ -454,15 +457,16 @@ void engine_redistribute(struct engine *e) { ...@@ -454,15 +457,16 @@ void engine_redistribute(struct engine *e) {
const struct gpart *gp = &s->gparts[k]; const struct gpart *gp = &s->gparts[k];
/* New cell index */ /* New cell index */
const int new_gind = const int new_cid =
cell_getid(s->cdim, gp->x[0] * s->iwidth[0], gp->x[1] * s->iwidth[1], cell_getid(s->cdim, gp->x[0] * s->iwidth[0], gp->x[1] * s->iwidth[1],
gp->x[2] * s->iwidth[2]); gp->x[2] * s->iwidth[2]);
/* New cell of this gpart */ /* New cell of this gpart */
const struct cell *c = &s->cells_top[new_gind]; const struct cell *c = &s->cells_top[new_cid];
const int new_node = c->nodeID;
if (g_dest[k] != new_gind) if (g_dest[k] != new_node)
error("gpart's new cell index not matching sorted index."); error("gpart's new node index not matching sorted index.");
if (gp->x[0] < c->loc[0] || gp->x[0] > c->loc[0] + c->width[0] || if (gp->x[0] < c->loc[0] || gp->x[0] > c->loc[0] + c->width[0] ||
gp->x[1] < c->loc[1] || gp->x[1] > c->loc[1] + c->width[1] || gp->x[1] < c->loc[1] || gp->x[1] > c->loc[1] + c->width[1] ||
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment