diff --git a/src/engine.c b/src/engine.c index cfc7591760f3fdf4d1272398af5917640f588754..91a518dc589fe3b3ad0651fa8dc47a1783e222ee 100644 --- a/src/engine.c +++ b/src/engine.c @@ -1169,7 +1169,7 @@ void engine_exchange_strays(struct engine *e, size_t offset_parts, e->proxies[k].nr_sparts_out = 0; } - /* Put the parts and gparts into the corresponding proxies. */ + /* Put the parts into the corresponding proxies. */ for (size_t k = 0; k < *Npart; k++) { /* Get the target node and proxy ID. */ const int node_id = e->s->cells_top[ind_part[k]].nodeID; @@ -1195,22 +1195,8 @@ void engine_exchange_strays(struct engine *e, size_t offset_parts, proxy_parts_load(&e->proxies[pid], &s->parts[offset_parts + k], &s->xparts[offset_parts + k], 1); } - for (size_t k = 0; k < *Ngpart; k++) { - const int node_id = e->s->cells_top[ind_gpart[k]].nodeID; - if (node_id < 0 || node_id >= e->nr_nodes) - error("Bad node ID %i.", node_id); - const int pid = e->proxy_ind[node_id]; - if (pid < 0) - error( - "Do not have a proxy for the requested nodeID %i for part with " - "id=%lli, x=[%e,%e,%e].", - node_id, s->gparts[offset_gparts + k].id_or_neg_offset, - s->gparts[offset_gparts + k].x[0], s->gparts[offset_gparts + k].x[1], - s->gparts[offset_gparts + k].x[2]); - /* Load the gpart into the proxy */ - proxy_gparts_load(&e->proxies[pid], &s->gparts[offset_gparts + k], 1); - } + /* Put the sparts into the corresponding proxies. */ for (size_t k = 0; k < *Nspart; k++) { const int node_id = e->s->cells_top[ind_spart[k]].nodeID; if (node_id < 0 || node_id >= e->nr_nodes) @@ -1234,6 +1220,24 @@ void engine_exchange_strays(struct engine *e, size_t offset_parts, proxy_sparts_load(&e->proxies[pid], &s->sparts[offset_sparts + k], 1); } + /* Put the gparts into the corresponding proxies. */ + for (size_t k = 0; k < *Ngpart; k++) { + const int node_id = e->s->cells_top[ind_gpart[k]].nodeID; + if (node_id < 0 || node_id >= e->nr_nodes) + error("Bad node ID %i.", node_id); + const int pid = e->proxy_ind[node_id]; + if (pid < 0) + error( + "Do not have a proxy for the requested nodeID %i for part with " + "id=%lli, x=[%e,%e,%e].", + node_id, s->gparts[offset_gparts + k].id_or_neg_offset, + s->gparts[offset_gparts + k].x[0], s->gparts[offset_gparts + k].x[1], + s->gparts[offset_gparts + k].x[2]); + + /* Load the gpart into the proxy */ + proxy_gparts_load(&e->proxies[pid], &s->gparts[offset_gparts + k], 1); + } + /* Launch the proxies. */ MPI_Request reqs_in[4 * engine_maxproxies]; MPI_Request reqs_out[4 * engine_maxproxies]; diff --git a/src/part.c b/src/part.c index 9c6a9258534ea6a105f58e10e13e86aebd65fae8..ecc5ca977ae0716b395cdd61af97382e6603186e 100644 --- a/src/part.c +++ b/src/part.c @@ -138,12 +138,12 @@ void part_verify_links(struct part *parts, struct gpart *gparts, /* Check that the particles are at the same place */ if (gparts[k].x[0] != part->x[0] || gparts[k].x[1] != part->x[1] || gparts[k].x[2] != part->x[2]) - error("Linked particles are not at the same position !\n" - "gp->x=[%e %e %e] p->x=[%e %e %e] diff=[%e %e %e]", - gparts[k].x[0], gparts[k].x[1], gparts[k].x[2], - part->x[0], part->x[1], part->x[2], - gparts[k].x[0] - part->x[0], gparts[k].x[1] - part->x[1], - gparts[k].x[2] - part->x[2]); + error( + "Linked particles are not at the same position !\n" + "gp->x=[%e %e %e] p->x=[%e %e %e] diff=[%e %e %e]", + gparts[k].x[0], gparts[k].x[1], gparts[k].x[2], part->x[0], + part->x[1], part->x[2], gparts[k].x[0] - part->x[0], + gparts[k].x[1] - part->x[1], gparts[k].x[2] - part->x[2]); /* Check that the particles are at the same time */ if (gparts[k].time_bin != part->time_bin) @@ -154,7 +154,7 @@ void part_verify_links(struct part *parts, struct gpart *gparts, /* Check that it is linked */ if (gparts[k].id_or_neg_offset > 0) - error("Gas gpart not linked to anything !"); + error("Star gpart not linked to anything !"); /* Find its link */ const struct spart *spart = &sparts[-gparts[k].id_or_neg_offset]; @@ -165,12 +165,12 @@ void part_verify_links(struct part *parts, struct gpart *gparts, /* Check that the particles are at the same place */ if (gparts[k].x[0] != spart->x[0] || gparts[k].x[1] != spart->x[1] || gparts[k].x[2] != spart->x[2]) - error("Linked particles are not at the same position !\n" - "gp->x=[%e %e %e] p->x=[%e %e %e] diff=[%e %e %e]", - gparts[k].x[0], gparts[k].x[1], gparts[k].x[2], - spart->x[0], spart->x[1], spart->x[2], - gparts[k].x[0] - spart->x[0], gparts[k].x[1] - spart->x[1], - gparts[k].x[2] - spart->x[2]); + error( + "Linked particles are not at the same position !\n" + "gp->x=[%e %e %e] sp->x=[%e %e %e] diff=[%e %e %e]", + gparts[k].x[0], gparts[k].x[1], gparts[k].x[2], spart->x[0], + spart->x[1], spart->x[2], gparts[k].x[0] - spart->x[0], + gparts[k].x[1] - spart->x[1], gparts[k].x[2] - spart->x[2]); /* Check that the particles are at the same time */ if (gparts[k].time_bin != spart->time_bin) @@ -224,7 +224,7 @@ void part_verify_links(struct part *parts, struct gpart *gparts, } } - if(verbose) message("All links OK"); + if (verbose) message("All links OK"); } #ifdef WITH_MPI diff --git a/src/space.c b/src/space.c index 4fd15e8acd477129b1943fbe8ce4720445e268b3..1ac92b3c2a81a4dfacef1930d5ba2b9114b704b1 100644 --- a/src/space.c +++ b/src/space.c @@ -1416,22 +1416,24 @@ void space_sparts_sort_mapper(void *map_data, int num_elements, } } -/* #ifdef SWIFT_DEBUG_CHECKS */ -/* /\* Verify space_sort_struct. *\/ */ -/* for (int k = i; k <= jj; k++) */ -/* if (ind[k] > pivot) { */ -/* message("sorting failed at k=%i, ind[k]=%i, pivot=%i, i=%li, j=%li.", */ -/* k, ind[k], pivot, i, j); */ -/* error("Partition failed (<=pivot)."); */ -/* } */ -/* for (int k = jj + 1; k <= j; k++) */ -/* if (ind[k] <= pivot) { */ -/* message("sorting failed at k=%i, ind[k]=%i, pivot=%i, i=%li, j=%li.", */ -/* k, ind[k], pivot, i, j); */ -/* error("Partition failed (>pivot)."); */ -/* } */ -/* #endif */ -//MATTHIEU --> Check what happens here when Nspart == 0 + /* #ifdef SWIFT_DEBUG_CHECKS */ + /* /\* Verify space_sort_struct. *\/ */ + /* for (int k = i; k <= jj; k++) */ + /* if (ind[k] > pivot) { */ + /* message("sorting failed at k=%i, ind[k]=%i, pivot=%i, i=%li, + * j=%li.", */ + /* k, ind[k], pivot, i, j); */ + /* error("Partition failed (<=pivot)."); */ + /* } */ + /* for (int k = jj + 1; k <= j; k++) */ + /* if (ind[k] <= pivot) { */ + /* message("sorting failed at k=%i, ind[k]=%i, pivot=%i, i=%li, + * j=%li.", */ + /* k, ind[k], pivot, i, j); */ + /* error("Partition failed (>pivot)."); */ + /* } */ + /* #endif */ + // MATTHIEU --> Check what happens here when Nspart == 0 /* Split-off largest interval. */ if (jj - i > j - jj + 1) {