diff --git a/src/engine.c b/src/engine.c index ec0ae697d6c2e2a2482c4a57aa8fc4153233d0e5..c7c5214c3d61533147b7037470ef9088c414ff2a 100644 --- a/src/engine.c +++ b/src/engine.c @@ -212,12 +212,9 @@ void engine_redistribute(struct engine *e) { /* We need to re-link the gpart partners of parts. */ int current_dest = dest[0]; size_t count_this_dest = 0; - size_t count_links = 0; for (size_t k = 0; k < s->nr_parts; ++k) { if (s->parts[k].gpart != NULL) { - ++count_links; - /* As the addresses will be invalidated by the communications, we will */ /* instead store the absolute index from the start of the sub-array */ /* of particles to be sent to a given node. */ @@ -228,16 +225,15 @@ void engine_redistribute(struct engine *e) { count_this_dest = 0; } - if(s->parts[k].gpart->id < 0) - error("Trying to link a partnerless gpart !"); + /* Debug */ + /* if(s->parts[k].gpart->id < 0) */ + /* error("Trying to link a partnerless gpart !"); */ s->parts[k].gpart->id = count_this_dest; count_this_dest++; } } - message("Got %zd gparts with a link (n_parts=%zd n_gparts=%zd)", count_links, s->nr_parts, s->nr_gparts); - /* Get destination of each g-particle */ for (size_t k = 0; k < s->nr_gparts; k++) { @@ -262,13 +258,6 @@ void engine_redistribute(struct engine *e) { /* Sort the gparticles according to their cell index. */ space_gparts_sort(gparts, g_dest, s->nr_gparts, 0, nr_nodes - 1); - count_links = 0; - for(size_t k = 0; k < s->nr_gparts; ++k) { - if(gparts[k].id >= 0) - ++count_links; - } - message("Got %zd gparts with a link (n_parts=%zd n_gparts=%zd)", count_links, s->nr_parts, s->nr_gparts); - /* Get all the counts from all the nodes. */ if (MPI_Allreduce(MPI_IN_PLACE, counts, nr_nodes * nr_nodes, MPI_INT, MPI_SUM, MPI_COMM_WORLD) != MPI_SUCCESS) @@ -324,8 +313,8 @@ void engine_redistribute(struct engine *e) { /* Are we sending any part/xpart ? */ if (counts[ind_send] > 0) { - message("Sending %d part to node %d", counts[ind_send], k); - + /* message("Sending %d part to node %d", counts[ind_send], k); */ + /* If the send is to the same node, just copy */ if (k == nodeID) { memcpy(&parts_new[offset_recv], &s->parts[offset_send], @@ -352,7 +341,7 @@ void engine_redistribute(struct engine *e) { /* Are we sending any gpart ? */ if (g_counts[ind_send] > 0) { - message("Sending %d gpart to node %d", g_counts[ind_send], k); + /* message("Sending %d gpart to node %d", g_counts[ind_send], k); */ /* If the send is to the same node, just copy */ if (k == nodeID) { @@ -444,13 +433,10 @@ void engine_redistribute(struct engine *e) { /* Verify that the links are correct */ /* MATTHIEU: To be commented out once we are happy */ - count_links = 0; for (size_t k = 0; k < nr_gparts; ++k) { if (gparts_new[k].id > 0) { - ++count_links; - if(gparts_new[k].part->gpart != &gparts_new[k]) error("Linking problem !"); @@ -460,19 +446,13 @@ void engine_redistribute(struct engine *e) { error("Linked particles are not at the same position !"); } } - - message("Got %zd gparts with a link (n_parts=%zd n_gparts=%zd)", count_links, nr_parts, nr_gparts); - for (size_t k = 0; k < nr_parts; ++k) { - + if (parts_new[k].gpart != NULL) { if(parts_new[k].gpart->part != &parts_new[k]) - error("Linking problem !"); - - + error("Linking problem !"); } - } /* Set the new part data, free the old. */