Commit b4cbd031 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'no_sort_before_force' into 'master'

Do not clear the sort flag when receiving parts after the ghost.

Implements #304. We only reset the c->sorted flag for the first receive not for the second one. 

See merge request !335
parents 0eaeff6e 6b291256
......@@ -1447,9 +1447,10 @@ void runner_do_end_force(struct runner *r, struct cell *c, int timer) {
*
* @param r The runner thread.
* @param c The cell.
* @param clear_sorts Should we clear the sort flag and hence trigger a sort ?
* @param timer Are we timing this ?
*/
void runner_do_recv_part(struct runner *r, struct cell *c, int timer) {
void runner_do_recv_part(struct runner *r, struct cell *c, int clear_sorts, int timer) {
#ifdef WITH_MPI
......@@ -1466,7 +1467,8 @@ void runner_do_recv_part(struct runner *r, struct cell *c, int timer) {
float h_max = 0.f;
/* Clear this cell's sorted mask. */
c->sorted = 0;
if(clear_sorts)
c->sorted = 0;
/* If this cell is a leaf, collect the particle data. */
if (!c->split) {
......@@ -1493,7 +1495,7 @@ void runner_do_recv_part(struct runner *r, struct cell *c, int timer) {
else {
for (int k = 0; k < 8; k++) {
if (c->progeny[k] != NULL) {
runner_do_recv_part(r, c->progeny[k], 0);
runner_do_recv_part(r, c->progeny[k], clear_sorts, 0);
ti_end_min = min(ti_end_min, c->progeny[k]->ti_end_min);
ti_end_max = max(ti_end_max, c->progeny[k]->ti_end_max);
h_max = max(h_max, c->progeny[k]->h_max);
......@@ -1872,9 +1874,10 @@ void *runner_main(void *data) {
if (t->subtype == task_subtype_tend) {
cell_unpack_ti_ends(ci, t->buff);
free(t->buff);
} else if (t->subtype == task_subtype_xv ||
t->subtype == task_subtype_rho) {
runner_do_recv_part(r, ci, 1);
} else if (t->subtype == task_subtype_xv) {
runner_do_recv_part(r, ci, 1, 1);
} else if (t->subtype == task_subtype_rho) {
runner_do_recv_part(r, ci, 0, 1);
} else if (t->subtype == task_subtype_gpart) {
runner_do_recv_gpart(r, ci, 1);
} else if (t->subtype == task_subtype_spart) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment