diff --git a/src/active.h b/src/active.h index a9962de6310ab47e86fcb64ba75e7352ff745b27..38020fde8ed53a638231097643476b7ef72d6d49 100644 --- a/src/active.h +++ b/src/active.h @@ -144,7 +144,7 @@ __attribute__((always_inline)) INLINE static int gpart_is_active( } /** - * @brief Is this s-particle active ? + * @brief Is this s-particle finishing its time-step now ? * * @param sp The #spart. * @param e The #engine containing information about the current time. @@ -159,7 +159,7 @@ __attribute__((always_inline)) INLINE static int spart_is_active( #ifdef SWIFT_DEBUG_CHECKS if (ti_end < ti_current) error( - "s-particle in an impossible time-zone! gp->ti_end=%lld " + "s-particle in an impossible time-zone! sp->ti_end=%lld " "e->ti_current=%lld", ti_end, ti_current); #endif @@ -167,8 +167,6 @@ __attribute__((always_inline)) INLINE static int spart_is_active( return (ti_end == ti_current); } - - /* Are cells / particles active for kick1 tasks ? */ /** @@ -242,4 +240,29 @@ __attribute__((always_inline)) INLINE static int gpart_is_starting( return (ti_beg == ti_current); } + +/** + * @brief Is this s-particle starting its time-step now ? + * + * @param sp The #spart. + * @param e The #engine containing information about the current time. + * @return 1 if the #spart is active, 0 otherwise. + */ +__attribute__((always_inline)) INLINE static int spart_is_starting( + const struct spart *sp, const struct engine *e) { + + const integertime_t ti_current = e->ti_current; + const integertime_t ti_beg = + get_integer_time_begin(ti_current + 1, sp->time_bin); + +#ifdef SWIFT_DEBUG_CHECKS + if (ti_beg > ti_current) + error( + "s-particle in an impossible time-zone! sp->ti_beg=%lld " + "e->ti_current=%lld", + ti_beg, ti_current); +#endif + + return (ti_beg == ti_current); +} #endif /* SWIFT_ACTIVE_H */ diff --git a/src/engine.c b/src/engine.c index cc7a5ded191b92d0e9a5541b7b8a24b564e7db07..a473419e2d87845c001fdb65f4e034b1f46d3849 100644 --- a/src/engine.c +++ b/src/engine.c @@ -3077,7 +3077,6 @@ void engine_step(struct engine *e) { if (e->ti_end_min >= e->ti_nextSnapshot && e->ti_nextSnapshot > 0) e->dump_snapshot = 1; - /* Drift everybody (i.e. what has not yet been drifted) */ /* to the current time */ if (e->dump_snapshot || e->forcerebuild || e->forcerepart != REPART_NONE) diff --git a/src/parallel_io.c b/src/parallel_io.c index 7696e7ac5b22188c9d916a96400940a1c9f7bfad..8f86b6cc6d04ed7a6ace9f155355f88940ec94d6 100644 --- a/src/parallel_io.c +++ b/src/parallel_io.c @@ -431,11 +431,12 @@ void read_ic_parallel(char* fileName, const struct UnitSystem* internal_units, *flag_entropy = flag_entropy_temp[0]; readAttribute(h_grp, "BoxSize", DOUBLE, boxSize); readAttribute(h_grp, "NumPart_Total", LONGLONG, numParticles); - readAttribute(h_grp, "NumPart_Total_HighWord", LONGLONG, numParticles_highWord); + readAttribute(h_grp, "NumPart_Total_HighWord", LONGLONG, + numParticles_highWord); for (int ptype = 0; ptype < NUM_PARTICLE_TYPES; ++ptype) - N_total[ptype] = (numParticles[ptype]) + - (numParticles_highWord[ptype] << 32); + N_total[ptype] = + (numParticles[ptype]) + (numParticles_highWord[ptype] << 32); dim[0] = boxSize[0]; dim[1] = (boxSize[1] < 0) ? boxSize[0] : boxSize[1]; diff --git a/src/runner.c b/src/runner.c index 3adcca2f69f096cd44295d67b2e9eab2c7f0e5ef..bdde7e75a2ead84e5c72a99a3cadb22e57bb92d6 100644 --- a/src/runner.c +++ b/src/runner.c @@ -968,8 +968,7 @@ void runner_do_kick1(struct runner *r, struct cell *c, int timer) { /* do the kick */ kick_spart(sp, ti_begin, ti_begin + ti_step / 2, timeBase); } - } - + } } if (timer) TIMER_TOC(timer_kick1); } @@ -1119,7 +1118,7 @@ void runner_do_timestep(struct runner *r, struct cell *c, int timer) { TIMER_TIC; int updated = 0, g_updated = 0, s_updated = 0; - integertime_t ti_end_min = max_nr_timesteps, ti_end_max = 0, ti_end_max = 0, ti_beg_max = 0; + integertime_t ti_end_min = max_nr_timesteps, ti_end_max = 0, ti_beg_max = 0; /* No children? */ if (!c->split) { diff --git a/src/serial_io.c b/src/serial_io.c index 527e294988873b01578681f82147d0161c27c777..17b3fb2d839a123ca51f3da5f8893fdd1b690ba4 100644 --- a/src/serial_io.c +++ b/src/serial_io.c @@ -483,11 +483,12 @@ void read_ic_serial(char* fileName, const struct UnitSystem* internal_units, *flag_entropy = flag_entropy_temp[0]; readAttribute(h_grp, "BoxSize", DOUBLE, boxSize); readAttribute(h_grp, "NumPart_Total", LONGLONG, numParticles); - readAttribute(h_grp, "NumPart_Total_HighWord", LONGLONG, numParticles_highWord); + readAttribute(h_grp, "NumPart_Total_HighWord", LONGLONG, + numParticles_highWord); for (int ptype = 0; ptype < NUM_PARTICLE_TYPES; ++ptype) - N_total[ptype] = (numParticles[ptype]) + - (numParticles_highWord[ptype] << 32); + N_total[ptype] = + (numParticles[ptype]) + (numParticles_highWord[ptype] << 32); dim[0] = boxSize[0]; dim[1] = (boxSize[1] < 0) ? boxSize[0] : boxSize[1];