From c26a3770770b8d3da7496aecea04c2a8d963beac Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Thu, 23 Nov 2017 17:18:13 +0000 Subject: [PATCH] Properly set the drift time of foreign multipoles when rebuilding. --- src/cell.c | 2 ++ src/cell.h | 3 +++ src/engine.c | 9 +++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/cell.c b/src/cell.c index 3b0570f2ab..11ecce083f 100644 --- a/src/cell.c +++ b/src/cell.c @@ -177,6 +177,7 @@ int cell_pack(struct cell *restrict c, struct pcell *restrict pc) { pc->ti_end_max = c->ti_end_max; pc->ti_old_part = c->ti_old_part; pc->ti_old_gpart = c->ti_old_gpart; + pc->ti_old_multipole = c->ti_old_multipole; pc->count = c->count; pc->gcount = c->gcount; pc->scount = c->scount; @@ -221,6 +222,7 @@ int cell_unpack(struct pcell *restrict pc, struct cell *restrict c, c->ti_end_max = pc->ti_end_max; c->ti_old_part = pc->ti_old_part; c->ti_old_gpart = pc->ti_old_gpart; + c->ti_old_multipole = pc->ti_old_multipole; c->count = pc->count; c->gcount = pc->gcount; c->scount = pc->scount; diff --git a/src/cell.h b/src/cell.h index d6b11cc814..b0b04bc9f7 100644 --- a/src/cell.h +++ b/src/cell.h @@ -95,6 +95,9 @@ struct pcell { /*! Integer time of the last drift of the #gpart in this cell */ integertime_t ti_old_gpart; + /*! Integer time of the last drift of the #multipole in this cell */ + integertime_t ti_old_multipole; + /*! Number of #part in this cell. */ int count; diff --git a/src/engine.c b/src/engine.c index 1c4f53c86a..2d133193d8 100644 --- a/src/engine.c +++ b/src/engine.c @@ -4344,10 +4344,11 @@ void engine_do_drift_all_mapper(void *map_data, int num_elements, /* Drift all the g-particles */ cell_drift_gpart(c, e, 1); - - /* Drift the multipoles */ - if (e->policy & engine_policy_self_gravity) - cell_drift_all_multipoles(c, e); + } + + /* Drift the multipoles */ + if (e->policy & engine_policy_self_gravity) { + cell_drift_all_multipoles(c, e); } } } -- GitLab