Commit 913232cb authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Avoid empty cells in the long-range gravity tasks.

parent 6021d143
......@@ -2321,6 +2321,10 @@ void engine_make_self_gravity_tasks(struct engine *e) {
if (periodic)
for (int i = 0; i < s->nr_cells; ++i) {
const struct cell *c = &s->cells_top[i];
/* Skip empty cells */
if (c->gcount == 0) continue;
/* Did we correctly attach the FFT task ghosts? */
if (c->nodeID == engine_rank &&
(c->grav_ghost_in == NULL || c->grav_ghost_out == NULL))
error("Invalid gravity_ghost for local cell");
......
......@@ -1179,6 +1179,9 @@ void runner_do_grav_long_range(struct runner *r, struct cell *ci, int timer) {
/* Avoid self contributions */
if (ci == cj) continue;
/* Skip empty cells */
if (cj->gcount == 0) continue;
/* Get the distance between the CoMs at the last rebuild*/
double dx_r = CoM_rebuild_i[0] - multi_j->CoM_rebuild[0];
double dy_r = CoM_rebuild_i[1] - multi_j->CoM_rebuild[1];
......
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