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

Add more temporary checks that linked particles are at the same place

parent b623db15
......@@ -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
......
......@@ -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;
......
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