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

Only relink parts and gparts when we actually have parts and gparts

parent b0a9dbfa
......@@ -580,7 +580,7 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset) {
}
/* Re-link the gparts. */
part_relink_gparts(parts, count, parts_offset);
if (count > 0 && gcount > 0) part_relink_gparts(parts, count, parts_offset);
#ifdef SWIFT_DEBUG_CHECKS
/* Verify that _all_ the parts have been assigned to a cell. */
......@@ -675,6 +675,7 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset) {
}
/* Re-link the parts. */
if (count > 0 && gcount > 0)
part_relink_parts(gparts, gcount, parts - parts_offset);
}
......
......@@ -2936,6 +2936,7 @@ void engine_split(struct engine *e, struct partition *initial_partition) {
s->xparts = xparts_new;
/* Re-link the gparts. */
if (s->nr_parts > 0 && s->nr_gparts > 0)
part_relink_gparts(s->parts, s->nr_parts, 0);
/* Re-allocate the local gparts. */
......@@ -2952,6 +2953,7 @@ void engine_split(struct engine *e, struct partition *initial_partition) {
s->gparts = gparts_new;
/* Re-link the parts. */
if (s->nr_parts > 0 && s->nr_gparts > 0)
part_relink_parts(s->gparts, s->nr_gparts, s->parts);
#ifdef SWIFT_DEBUG_CHECKS
......
......@@ -565,7 +565,7 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
space_parts_sort(s, ind, nr_parts, 0, s->nr_cells - 1, verbose);
/* Re-link the gparts. */
part_relink_gparts(s->parts, nr_parts, 0);
if (nr_parts > 0 && nr_gparts > 0) part_relink_gparts(s->parts, nr_parts, 0);
#ifdef SWIFT_DEBUG_CHECKS
/* Verify space_sort_struct. */
......@@ -613,6 +613,7 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
space_gparts_sort(s, gind, nr_gparts, 0, s->nr_cells - 1, verbose);
/* Re-link the parts. */
if (nr_parts > 0 && nr_gparts > 0)
part_relink_parts(s->gparts, nr_gparts, s->parts);
/* We no longer need the indices as of here. */
......
Markdown is supported
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