From 663db381c86e805e75b6e4788d4b9751506b26f0 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Fri, 6 Jan 2017 15:45:47 +0000 Subject: [PATCH] More time integration checks --- src/runner.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/runner.c b/src/runner.c index dc1eb9f13c..33f5fab551 100644 --- a/src/runner.c +++ b/src/runner.c @@ -867,6 +867,13 @@ void runner_do_kick1(struct runner *r, struct cell *c, int timer) { const integertime_t ti_begin = get_integer_time_begin(ti_current, p->time_bin); +#ifdef SWIFT_DEBUG_CHECKS + const integertime_t ti_end = + get_integer_time_end(ti_current, p->time_bin); + + if (ti_end - ti_begin != ti_step) error("Particle in wrong time-bin"); +#endif + /* do the kick */ kick_part(p, xp, ti_begin, ti_begin + ti_step / 2, timeBase); } @@ -885,6 +892,13 @@ void runner_do_kick1(struct runner *r, struct cell *c, int timer) { const integertime_t ti_begin = get_integer_time_begin(ti_current, gp->time_bin); +#ifdef SWIFT_DEBUG_CHECKS + const integertime_t ti_end = + get_integer_time_end(ti_current, gp->time_bin); + + if (ti_end - ti_begin != ti_step) error("Particle in wrong time-bin"); +#endif + /* do the kick */ kick_gpart(gp, ti_begin, ti_begin + ti_step / 2, ti_current, timeBase); } @@ -943,6 +957,11 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) { const integertime_t ti_begin = get_integer_time_begin(ti_current, p->time_bin); +#ifdef SWIFT_DEBUG_CHECKS + if (ti_begin + ti_step != ti_current) + error("Particle in wrong time-bin"); +#endif + /* Finish the time-step with a second half-kick */ kick_part(p, xp, ti_begin + ti_step / 2, ti_begin + ti_step, timeBase); @@ -970,6 +989,11 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) { const integertime_t ti_begin = get_integer_time_begin(ti_current, gp->time_bin); +#ifdef SWIFT_DEBUG_CHECKS + if (ti_begin + ti_step != ti_current) + error("Particle in wrong time-bin"); +#endif + /* Finish the time-step with a second half-kick */ kick_gpart(gp, ti_begin + ti_step / 2, ti_begin + ti_step, ti_current, timeBase); -- GitLab