diff --git a/src/engine.c b/src/engine.c index 4069875cc4de958ceb0d8689b916acddf6738db6..d2b8b81653f15eeda42c792fecbeb354db93c06b 100644 --- a/src/engine.c +++ b/src/engine.c @@ -1558,7 +1558,7 @@ int engine_marktasks(struct engine *e) { else if (t->type == task_type_kick) { t->skip = (t->ci->ti_end_min > ti_end); t->ci->updated = 0; - t->ci->g_updated = 0; + t->ci->g_updated = 0; } /* Drift? */ @@ -1615,6 +1615,7 @@ void engine_print_task_counts(struct engine *e) { printf(" skipped=%i ]\n", counts[task_type_count]); fflush(stdout); message("nr_parts = %zi.", e->s->nr_parts); + message("nr_gparts = %zi.", e->s->nr_gparts); } /** @@ -1767,7 +1768,7 @@ void engine_collect_kick(struct cell *c) { ti_end_min = min(ti_end_min, cp->ti_end_min); ti_end_max = max(ti_end_max, cp->ti_end_max); updated += cp->updated; - g_updated += cp->g_updated; + g_updated += cp->g_updated; e_kin += cp->e_kin; e_int += cp->e_int; e_pot += cp->e_pot; @@ -2265,6 +2266,28 @@ void engine_split(struct engine *e, struct partition *initial_partition) { for (size_t k = 0; k < s->nr_gparts; k++) if (s->gparts[k].id > 0) s->gparts[k].part->gpart = &s->gparts[k]; + /* Verify that the links are correct */ + /* MATTHIEU: To be commented out once we are happy */ + for (size_t k = 0; k < nr_gparts; ++k) { + + if (s->gparts[k].id > 0) { + + if (s->gparts[k].part->gpart != &s->gparts[k]) error("Linking problem !"); + + if (s->gparts[k].x[0] != s->gparts[k].part->x[0] || + s->gparts[k].x[1] != s->gparts[k].part->x[1] || + s->gparts[k].x[2] != s->gparts[k].part->x[2]) + error("Linked particles are not at the same position !"); + } + } + for (size_t k = 0; k < nr_parts; ++k) { + + if (s->parts[k].gpart != NULL) { + + if (s->parts[k].gpart->part != &s->parts[k]) error("Linking problem !"); + } + } + #else error("SWIFT was not compiled with MPI support."); #endif diff --git a/src/space.c b/src/space.c index 0cce068b5d8a8060b6ca4cde71aeff9dc6b69e8d..53e40022f751cab7fcca4ed8d5424e7f88ed7894 100644 --- a/src/space.c +++ b/src/space.c @@ -499,6 +499,28 @@ void space_rebuild(struct space *s, double cell_max, int verbose) { /* We no longer need the indices as of here. */ free(gind); + /* Verify that the links are correct */ + /* MATTHIEU: To be commented out once we are happy */ + for (size_t k = 0; k < nr_gparts; ++k) { + + if (s->gparts[k].id > 0) { + + if (s->gparts[k].part->gpart != &s->gparts[k]) error("Linking problem !"); + + if (s->gparts[k].x[0] != s->gparts[k].part->x[0] || + s->gparts[k].x[1] != s->gparts[k].part->x[1] || + s->gparts[k].x[2] != s->gparts[k].part->x[2]) + error("Linked particles are not at the same position !"); + } + } + for (size_t k = 0; k < nr_parts; ++k) { + + if (s->parts[k].gpart != NULL) { + + if (s->parts[k].gpart->part != &s->parts[k]) error("Linking problem !"); + } + } + /* Hook the cells up to the parts. */ // tic = getticks(); struct part *finger = s->parts;