From 1af9ba62c8704f02a2bee608e0e0024aafdbe6d3 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Sat, 27 Oct 2018 17:38:28 +0200 Subject: [PATCH] Use the list of non-empty top-level cells in the long-range gravity task. --- src/runner_doiact_grav.h | 7 ++++--- src/space.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/runner_doiact_grav.h b/src/runner_doiact_grav.h index ebd08a662c..56bb4ca348 100644 --- a/src/runner_doiact_grav.h +++ b/src/runner_doiact_grav.h @@ -1718,7 +1718,8 @@ static INLINE void runner_do_grav_long_range(struct runner *r, struct cell *ci, /* Recover the list of top-level cells */ struct cell *cells = e->s->cells_top; - const int nr_cells = e->s->nr_cells; + int *cells_with_gparts = e->s->cells_with_gparts_top; + const int nr_cells_with_gparts = e->s->nr_cells_with_gparts; /* Anything to do here? */ if (!cell_is_active_gravity(ci, e)) return; @@ -1744,10 +1745,10 @@ static INLINE void runner_do_grav_long_range(struct runner *r, struct cell *ci, /* Loop over all the top-level cells and go for a M-M interaction if * well-separated */ - for (int n = 0; n < nr_cells; ++n) { + for (int n = 0; n < nr_cells_with_gparts; ++n) { /* Handle on the top-level cell and it's gravity business*/ - struct cell *cj = &cells[n]; + const struct cell *cj = &cells[cells_with_gparts[n]]; const struct gravity_tensors *const multi_j = cj->grav.multipole; /* Avoid self contributions */ diff --git a/src/space.c b/src/space.c index 073cf44aae..ddb4c2af6f 100644 --- a/src/space.c +++ b/src/space.c @@ -2590,7 +2590,7 @@ void space_list_cells_with_gparts(struct space *s) { } if (s->e->verbose) - message("Have %d top-level cells with tasks (total=%d)", + message("Have %d top-level cells with gparts (total=%d)", s->nr_cells_with_gparts, s->nr_cells); if (s->e->verbose) -- GitLab