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

Only do multipole-related stuff when running with self-gravity.

parent 38480441
...@@ -193,11 +193,14 @@ void space_rebuild_recycle_rec(struct space *s, struct cell *c, ...@@ -193,11 +193,14 @@ void space_rebuild_recycle_rec(struct space *s, struct cell *c,
c->progeny[k]->next = *cell_rec_begin; c->progeny[k]->next = *cell_rec_begin;
*cell_rec_begin = c->progeny[k]; *cell_rec_begin = c->progeny[k];
c->progeny[k]->multipole->next = *multipole_rec_begin;
*multipole_rec_begin = c->progeny[k]->multipole; if (s->gravity) {
c->progeny[k]->multipole->next = *multipole_rec_begin;
*multipole_rec_begin = c->progeny[k]->multipole;
}
if (*cell_rec_end == NULL) *cell_rec_end = *cell_rec_begin; if (*cell_rec_end == NULL) *cell_rec_end = *cell_rec_begin;
if (*multipole_rec_end == NULL) if (s->gravity && *multipole_rec_end == NULL)
*multipole_rec_end = *multipole_rec_begin; *multipole_rec_end = *multipole_rec_begin;
c->progeny[k]->multipole = NULL; c->progeny[k]->multipole = NULL;
...@@ -937,8 +940,9 @@ void space_rebuild(struct space *s, int verbose) { ...@@ -937,8 +940,9 @@ void space_rebuild(struct space *s, int verbose) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
/* Check that the multipole construction went OK */ /* Check that the multipole construction went OK */
for (int k = 0; k < s->nr_cells; k++) if (s->gravity)
cell_check_multipole(&s->cells_top[k], NULL); for (int k = 0; k < s->nr_cells; k++)
cell_check_multipole(&s->cells_top[k], NULL);
#endif #endif
if (verbose) if (verbose)
...@@ -2154,7 +2158,7 @@ void space_split_recursive(struct space *s, struct cell *c, ...@@ -2154,7 +2158,7 @@ void space_split_recursive(struct space *s, struct cell *c,
} }
/* Construct the multipole and the centre of mass*/ /* Construct the multipole and the centre of mass*/
multipole_P2M(c->multipole, c->gparts, c->gcount); if (s->gravity) multipole_P2M(c->multipole, c->gparts, c->gcount);
} }
/* Set the values for this cell. */ /* Set the values for this cell. */
...@@ -2295,8 +2299,10 @@ void space_recycle_list(struct space *s, struct cell *cell_list_begin, ...@@ -2295,8 +2299,10 @@ void space_recycle_list(struct space *s, struct cell *cell_list_begin,
s->tot_cells -= count; s->tot_cells -= count;
/* Hook the multipoles into the buffer. */ /* Hook the multipoles into the buffer. */
multipole_list_end->next = s->multipoles_sub; if (s->gravity) {
s->multipoles_sub = multipole_list_begin; multipole_list_end->next = s->multipoles_sub;
s->multipoles_sub = multipole_list_begin;
}
/* Unlock the space. */ /* Unlock the space. */
lock_unlock_blind(&s->lock); lock_unlock_blind(&s->lock);
......
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