Commit 740faaac authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Check that the received particles are at the correct position in time.

parent f0e44d66
...@@ -1232,6 +1232,7 @@ void runner_dorecv_cell(struct runner *r, struct cell *c, int timer) { ...@@ -1232,6 +1232,7 @@ void runner_dorecv_cell(struct runner *r, struct cell *c, int timer) {
const struct gpart *const gparts = c->gparts; const struct gpart *const gparts = c->gparts;
const size_t nr_parts = c->count; const size_t nr_parts = c->count;
const size_t nr_gparts = c->gcount; const size_t nr_gparts = c->gcount;
const int ti_current = r->e->ti_current;
TIMER_TIC; TIMER_TIC;
...@@ -1241,13 +1242,17 @@ void runner_dorecv_cell(struct runner *r, struct cell *c, int timer) { ...@@ -1241,13 +1242,17 @@ void runner_dorecv_cell(struct runner *r, struct cell *c, int timer) {
/* Collect everything... */ /* Collect everything... */
for (size_t k = 0; k < nr_parts; k++) { for (size_t k = 0; k < nr_parts; k++) {
ti_end_min = min(ti_end_min, parts[k].ti_end); const int ti_end = parts[k].ti_end;
ti_end_max = max(ti_end_max, parts[k].ti_end); if(ti_end < ti_current) error("Received invalid particle !");
ti_end_min = min(ti_end_min, ti_end);
ti_end_max = max(ti_end_max, ti_end);
h_max = fmaxf(h_max, parts[k].h); h_max = fmaxf(h_max, parts[k].h);
} }
for (size_t k = 0; k < nr_gparts; k++) { for (size_t k = 0; k < nr_gparts; k++) {
ti_end_min = min(ti_end_min, gparts[k].ti_end); const int ti_end = gparts[k].ti_end;
ti_end_max = max(ti_end_max, gparts[k].ti_end); if(ti_end < ti_current) error("Received invalid particle !");
ti_end_min = min(ti_end_min, ti_end);
ti_end_max = max(ti_end_max, ti_end);
} }
/* ... and store. */ /* ... and store. */
......
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