diff --git a/src/runner.c b/src/runner.c index 6d48af01184dc782d7ddca56e6d35a93d4b11eaf..f3a4025e743d3f0034376a8fef65e4238451fc85 100644 --- a/src/runner.c +++ b/src/runner.c @@ -97,8 +97,16 @@ /* Import the gravity loop functions. */ #include "runner_doiact_grav.h" -/* Import the stars loop functions. */ +/* Import the stars density loop functions. */ +#define FUNCTION density +#include "runner_doiact_stars.h" +#undef FUNCTION + +/* Import the stars feedback loop functions. */ +#define FUNCTION feedback #include "runner_doiact_stars.h" +#undef FUNCTION + /** * @brief Perform source terms diff --git a/src/runner_doiact.h b/src/runner_doiact.h index 53cf51ed400f82d0e195e38dd08fcc5af16f1ad7..dbbe3e03e0ec77a07dfd6dd7f00142cb37177db4 100644 --- a/src/runner_doiact.h +++ b/src/runner_doiact.h @@ -20,9 +20,8 @@ /* Before including this file, define FUNCTION, which is the name of the interaction function. This creates the interaction functions - runner_dopair_FUNCTION, runner_dopair_FUNCTION_naive, runner_doself_FUNCTION, - and runner_dosub_FUNCTION calling the pairwise interaction function - runner_iact_FUNCTION. */ + runner_dopair_FUNCTION and runner_doself_FUNCTION calling the pairwise + interaction function runner_iact_FUNCTION. */ #define PASTE(x, y) x##_##y diff --git a/src/runner_doiact_stars.h b/src/runner_doiact_stars.h index 3a920ab553f3e604619dfc4b6efe506e83e9ef52..edffce1365af0fe9634d2defca3080f5147de6d3 100644 --- a/src/runner_doiact_stars.h +++ b/src/runner_doiact_stars.h @@ -17,10 +17,55 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************/ -#ifndef SWIFT_RUNNER_DOIACT_STARS_H -#define SWIFT_RUNNER_DOIACT_STARS_H -#include "swift.h" +/* Before including this file, define FUNCTION, which is the + name of the interaction function. This creates the interaction functions + runner_dopair_FUNCTION, runner_dopair_FUNCTION_naive, runner_doself_FUNCTION, + and runner_dosub_FUNCTION calling the pairwise interaction function + runner_iact_FUNCTION. */ + + +#define PASTE(x, y) x##_##y + +#define _DOSELF_STARS(f) PASTE(runner_doself_stars, f) +#define DOSELF_STARS _DOSELF_STARS(FUNCTION) + +#define _DO_NONSYM_PAIR_STARS(f) PASTE(runner_do_nonsym_pair_stars, f) +#define DO_NONSYM_PAIR_STARS _DO_NONSYM_PAIR_STARS(FUNCTION) + +#define _DOPAIR_STARS(f) PASTE(runner_dopair_stars, f) +#define DOPAIR_STARS _DOPAIR_STARS(FUNCTION) + +#define _DOPAIR_SUBSET_STARS(f) PASTE(runner_dopair_subset_stars, f) +#define DOPAIR_SUBSET_STARS _DOPAIR_SUBSET_STARS(FUNCTION) + +#define _DOSELF_SUBSET_STARS(f) PASTE(runner_doself_subset_stars, f) +#define DOSELF_SUBSET_STARS _DOSELF_SUBSET_STARS(FUNCTION) + +#define _DOSELF_SUBSET_BRANCH_STARS(f) PASTE(runner_doself_subset_branch_stars, f) +#define DOSELF_SUBSET_BRANCH_STARS _DOSELF_SUBSET_BRANCH_STARS(FUNCTION) + +#define _DOPAIR_SUBSET_BRANCH_STARS(f) PASTE(runner_dopair_subset_branch_stars, f) +#define DOPAIR_SUBSET_BRANCH_STARS _DOPAIR_SUBSET_BRANCH_STARS(FUNCTION) + +#define _DOSUB_SUBSET_STARS(f) PASTE(runner_dosub_subset_stars, f) +#define DOSUB_SUBSET_STARS _DOSUB_SUBSET_STARS(FUNCTION) + +#define _DOSELF_BRANCH_STARS(f) PASTE(runner_doself_branch_stars, f) +#define DOSELF_BRANCH_STARS _DOSELF_BRANCH_STARS(FUNCTION) + +#define _DOPAIR_BRANCH_STARS(f) PASTE(runner_dopair_branch_stars, f) +#define DOPAIR_BRANCH_STARS _DOPAIR_BRANCH_STARS(FUNCTION) + +#define _DOSUB_PAIR_STARS(f) PASTE(runner_dosub_pair_stars, f) +#define DOSUB_PAIR_STARS _DOSUB_PAIR_STARS(FUNCTION) + +#define _DOSUB_SELF_STARS(f) PASTE(runner_dosub_self_stars, f) +#define DOSUB_SELF_STARS _DOSUB_SELF_STARS(FUNCTION) + +#define _IACT_STARS(f) PASTE(runner_iact_nonsym_stars, f) +#define IACT_STARS _IACT_STARS(FUNCTION) + /** * @brief Calculate the number density of #part around the #spart @@ -29,12 +74,10 @@ * @param c cell * @param timer 1 if the time is to be recorded. */ -void runner_doself_stars_density(struct runner *r, struct cell *c, int timer) { +void DOSELF_STARS(struct runner *r, struct cell *c, int timer) { const struct engine *e = r->e; const struct cosmology *cosmo = e->cosmology; - TIMER_TIC; - /* Anything to do here? */ if (!cell_is_active_stars(c, e)) return; if (c->hydro.count == 0 && c->stars.count == 0) return; @@ -80,12 +123,11 @@ void runner_doself_stars_density(struct runner *r, struct cell *c, int timer) { #endif if (r2 > 0.f && r2 < hig2) { - runner_iact_nonsym_stars_density(r2, dx, hi, hj, si, pj, a, H); + IACT_STARS(r2, dx, hi, hj, si, pj, a, H); } } /* loop over the parts in ci. */ } /* loop over the sparts in ci. */ - TIMER_TOC(timer_doself_stars_density); } /** @@ -95,8 +137,9 @@ void runner_doself_stars_density(struct runner *r, struct cell *c, int timer) { * @param ci The first #cell * @param cj The second #cell */ -void runner_dosubpair_stars_density(struct runner *r, struct cell *restrict ci, - struct cell *restrict cj) { +void DO_NONSYM_PAIR_STARS( + struct runner *r, struct cell *restrict ci, + struct cell *restrict cj) { const struct engine *e = r->e; const struct cosmology *cosmo = e->cosmology; @@ -154,23 +197,20 @@ void runner_dosubpair_stars_density(struct runner *r, struct cell *restrict ci, #endif if (r2 < hig2) - runner_iact_nonsym_stars_density(r2, dx, hi, hj, si, pj, a, H); + IACT_STARS(r2, dx, hi, hj, si, pj, a, H); } /* loop over the parts in cj. */ } /* loop over the parts in ci. */ } -void runner_dopair_stars_density(struct runner *r, struct cell *restrict ci, - struct cell *restrict cj, int timer) { - - TIMER_TIC; +void DOPAIR_STARS(struct runner *r, struct cell *restrict ci, + struct cell *restrict cj, int timer) { if (ci->stars.count != 0 && cj->hydro.count != 0) - runner_dosubpair_stars_density(r, ci, cj); + DO_NONSYM_PAIR_STARS(r, ci, cj); if (cj->stars.count != 0 && ci->hydro.count != 0) - runner_dosubpair_stars_density(r, cj, ci); + DO_NONSYM_PAIR_STARS(r, cj, ci); - if (timer) TIMER_TOC(timer_dopair_stars_density); } /** @@ -187,18 +227,15 @@ void runner_dopair_stars_density(struct runner *r, struct cell *restrict ci, * @param cj The second #cell. * @param shift The shift vector to apply to the particles in ci. */ -void runner_dopair_subset_stars_density(struct runner *r, - struct cell *restrict ci, - struct spart *restrict sparts_i, - int *restrict ind, int scount, - struct cell *restrict cj, - const double *shift) { +void DOPAIR_SUBSET_STARS( + struct runner *r, struct cell *restrict ci, + struct spart *restrict sparts_i, int *restrict ind, + int scount, struct cell *restrict cj, + const double *shift) { const struct engine *e = r->e; const struct cosmology *cosmo = e->cosmology; - TIMER_TIC; - const int count_j = cj->hydro.count; struct part *restrict parts_j = cj->hydro.parts; @@ -242,12 +279,11 @@ void runner_dopair_subset_stars_density(struct runner *r, #endif /* Hit or miss? */ if (r2 < hig2) { - runner_iact_nonsym_stars_density(r2, dx, hi, pj->h, spi, pj, a, H); + IACT_STARS(r2, dx, hi, pj->h, spi, pj, a, H); } } /* loop over the parts in cj. */ } /* loop over the parts in ci. */ - TIMER_TOC(timer_dopair_subset_stars_density); } /** @@ -260,16 +296,13 @@ void runner_dopair_subset_stars_density(struct runner *r, * @param ind The list of indices of particles in @c ci to interact with. * @param scount The number of particles in @c ind. */ -void runner_doself_subset_stars_density(struct runner *r, - struct cell *restrict ci, - struct spart *restrict sparts, - int *restrict ind, int scount) { +void DOSELF_SUBSET_STARS(struct runner *r, struct cell *restrict ci, + struct spart *restrict sparts, + int *restrict ind, int scount) { const struct engine *e = r->e; const struct cosmology *cosmo = e->cosmology; - TIMER_TIC; - /* Cosmological terms */ const float a = cosmo->a; const float H = cosmo->H; @@ -315,36 +348,34 @@ void runner_doself_subset_stars_density(struct runner *r, /* Hit or miss? */ if (r2 > 0.f && r2 < hig2) { - runner_iact_nonsym_stars_density(r2, dx, hi, hj, spi, pj, a, H); + IACT_STARS(r2, dx, hi, hj, spi, pj, a, H); } } /* loop over the parts in cj. */ } /* loop over the parts in ci. */ - TIMER_TOC(timer_doself_subset_stars_density); } /** -* @brief Determine which version of DOSELF_SUBSET needs to be called depending -* on the optimisation level. - +* @brief Determine which version of DOSELF_SUBSET_STARS needs to be called +* depending on the optimisation level. +* * @param r The #runner. * @param ci The first #cell. * @param sparts The #spart to interact. * @param ind The list of indices of particles in @c ci to interact with. * @param scount The number of particles in @c ind. */ -void runner_doself_subset_branch_stars_density(struct runner *r, - struct cell *restrict ci, - struct spart *restrict sparts, - int *restrict ind, int scount) { +void DOSELF_SUBSET_BRANCH_STARS( + struct runner *r, struct cell *restrict ci, + struct spart *restrict sparts, int *restrict ind, int scount) { - runner_doself_subset_stars_density(r, ci, sparts, ind, scount); + DOSELF_SUBSET_STARS(r, ci, sparts, ind, scount); } /** - * @brief Determine which version of DOPAIR_SUBSET needs to be called depending + * @brief Determine which version of DOPAIR_SUBSET_STARS needs to be called depending * on the - * orientation of the cells or whether DOPAIR_SUBSET needs to be called at all. + * orientation of the cells or whether DOPAIR_SUBSET_STARS needs to be called at all. * * @param r The #runner. * @param ci The first #cell. @@ -353,11 +384,10 @@ void runner_doself_subset_branch_stars_density(struct runner *r, * @param scount The number of particles in @c ind. * @param cj The second #cell. */ -void runner_dopair_subset_branch_stars_density(struct runner *r, - struct cell *restrict ci, - struct spart *restrict sparts_i, - int *restrict ind, int scount, - struct cell *restrict cj) { +void DOPAIR_SUBSET_BRANCH_STARS( + struct runner *r, struct cell *restrict ci, + struct spart *restrict sparts_i, int *restrict ind, + int scount, struct cell *restrict cj) { const struct engine *e = r->e; @@ -370,19 +400,17 @@ void runner_dopair_subset_branch_stars_density(struct runner *r, shift[k] = -e->s->dim[k]; } - runner_dopair_subset_stars_density(r, ci, sparts_i, ind, scount, cj, shift); + DOPAIR_SUBSET_STARS(r, ci, sparts_i, ind, scount, cj, shift); } -void runner_dosub_subset_stars_density(struct runner *r, struct cell *ci, - struct spart *sparts, int *ind, - int scount, struct cell *cj, int sid, - int gettimer) { +void DOSUB_SUBSET_STARS(struct runner *r, struct cell *ci, + struct spart *sparts, int *ind, + int scount, struct cell *cj, int sid, + int gettimer) { const struct engine *e = r->e; struct space *s = e->s; - TIMER_TIC; - /* Should we even bother? */ if (!cell_is_active_stars(ci, e) && (cj == NULL || !cell_is_active_stars(cj, e))) @@ -410,18 +438,17 @@ void runner_dosub_subset_stars_density(struct runner *r, struct cell *ci, if (cell_can_recurse_in_self_stars_task(ci)) { /* Loop over all progeny. */ - runner_dosub_subset_stars_density(r, sub, sparts, ind, scount, NULL, -1, - 0); + DOSUB_SUBSET_STARS(r, sub, sparts, ind, scount, NULL, -1, 0); for (int j = 0; j < 8; j++) if (ci->progeny[j] != sub && ci->progeny[j] != NULL) - runner_dosub_subset_stars_density(r, sub, sparts, ind, scount, + DOSUB_SUBSET_STARS(r, sub, sparts, ind, scount, ci->progeny[j], -1, 0); } /* Otherwise, compute self-interaction. */ else - runner_doself_subset_branch_stars_density(r, ci, sparts, ind, scount); + DOSELF_SUBSET_BRANCH_STARS(r, ci, sparts, ind, scount); } /* self-interaction. */ /* Otherwise, it's a pair interaction. */ @@ -441,496 +468,496 @@ void runner_dosub_subset_stars_density(struct runner *r, struct cell *ci, /* Regular sub-cell interactions of a single cell. */ case 0: /* ( 1 , 1 , 1 ) */ if (ci->progeny[7] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[7], -1, 0); break; case 1: /* ( 1 , 1 , 0 ) */ if (ci->progeny[6] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[6], -1, 0); if (ci->progeny[6] == sub && cj->progeny[1] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount, cj->progeny[1], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[1] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount, ci->progeny[6], -1, 0); if (ci->progeny[7] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[7], -1, 0); if (ci->progeny[7] == sub && cj->progeny[1] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[1], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[1] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount, ci->progeny[7], -1, 0); break; case 2: /* ( 1 , 1 , -1 ) */ if (ci->progeny[6] == sub && cj->progeny[1] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount, cj->progeny[1], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[1] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount, ci->progeny[6], -1, 0); break; case 3: /* ( 1 , 0 , 1 ) */ if (ci->progeny[5] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[5], -1, 0); if (ci->progeny[5] == sub && cj->progeny[2] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount, cj->progeny[2], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[2] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount, ci->progeny[5], -1, 0); if (ci->progeny[7] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[7], -1, 0); if (ci->progeny[7] == sub && cj->progeny[2] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[2], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[2] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount, ci->progeny[7], -1, 0); break; case 4: /* ( 1 , 0 , 0 ) */ if (ci->progeny[4] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[4] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[4], -1, 0); if (ci->progeny[4] == sub && cj->progeny[1] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount, cj->progeny[1], -1, 0); if (ci->progeny[4] != NULL && cj->progeny[1] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount, ci->progeny[4], -1, 0); if (ci->progeny[4] == sub && cj->progeny[2] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount, cj->progeny[2], -1, 0); if (ci->progeny[4] != NULL && cj->progeny[2] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount, ci->progeny[4], -1, 0); if (ci->progeny[4] == sub && cj->progeny[3] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount, cj->progeny[3], -1, 0); if (ci->progeny[4] != NULL && cj->progeny[3] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount, ci->progeny[4], -1, 0); if (ci->progeny[5] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[5], -1, 0); if (ci->progeny[5] == sub && cj->progeny[1] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount, cj->progeny[1], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[1] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount, ci->progeny[5], -1, 0); if (ci->progeny[5] == sub && cj->progeny[2] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount, cj->progeny[2], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[2] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount, ci->progeny[5], -1, 0); if (ci->progeny[5] == sub && cj->progeny[3] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount, cj->progeny[3], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[3] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount, ci->progeny[5], -1, 0); if (ci->progeny[6] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[6], -1, 0); if (ci->progeny[6] == sub && cj->progeny[1] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount, cj->progeny[1], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[1] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount, ci->progeny[6], -1, 0); if (ci->progeny[6] == sub && cj->progeny[2] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount, cj->progeny[2], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[2] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount, ci->progeny[6], -1, 0); if (ci->progeny[6] == sub && cj->progeny[3] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount, cj->progeny[3], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[3] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount, ci->progeny[6], -1, 0); if (ci->progeny[7] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[7], -1, 0); if (ci->progeny[7] == sub && cj->progeny[1] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[1], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[1] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount, ci->progeny[7], -1, 0); if (ci->progeny[7] == sub && cj->progeny[2] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[2], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[2] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount, ci->progeny[7], -1, 0); if (ci->progeny[7] == sub && cj->progeny[3] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[3], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[3] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount, ci->progeny[7], -1, 0); break; case 5: /* ( 1 , 0 , -1 ) */ if (ci->progeny[4] == sub && cj->progeny[1] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount, cj->progeny[1], -1, 0); if (ci->progeny[4] != NULL && cj->progeny[1] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount, ci->progeny[4], -1, 0); if (ci->progeny[4] == sub && cj->progeny[3] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount, cj->progeny[3], -1, 0); if (ci->progeny[4] != NULL && cj->progeny[3] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount, ci->progeny[4], -1, 0); if (ci->progeny[6] == sub && cj->progeny[1] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount, cj->progeny[1], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[1] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount, ci->progeny[6], -1, 0); if (ci->progeny[6] == sub && cj->progeny[3] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount, cj->progeny[3], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[3] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount, ci->progeny[6], -1, 0); break; case 6: /* ( 1 , -1 , 1 ) */ if (ci->progeny[5] == sub && cj->progeny[2] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount, cj->progeny[2], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[2] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount, ci->progeny[5], -1, 0); break; case 7: /* ( 1 , -1 , 0 ) */ if (ci->progeny[4] == sub && cj->progeny[2] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount, cj->progeny[2], -1, 0); if (ci->progeny[4] != NULL && cj->progeny[2] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount, ci->progeny[4], -1, 0); if (ci->progeny[4] == sub && cj->progeny[3] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount, cj->progeny[3], -1, 0); if (ci->progeny[4] != NULL && cj->progeny[3] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount, ci->progeny[4], -1, 0); if (ci->progeny[5] == sub && cj->progeny[2] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount, cj->progeny[2], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[2] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount, ci->progeny[5], -1, 0); if (ci->progeny[5] == sub && cj->progeny[3] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount, cj->progeny[3], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[3] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount, ci->progeny[5], -1, 0); break; case 8: /* ( 1 , -1 , -1 ) */ if (ci->progeny[4] == sub && cj->progeny[3] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount, cj->progeny[3], -1, 0); if (ci->progeny[4] != NULL && cj->progeny[3] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount, ci->progeny[4], -1, 0); break; case 9: /* ( 0 , 1 , 1 ) */ if (ci->progeny[3] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[3], -1, 0); if (ci->progeny[3] == sub && cj->progeny[4] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount, cj->progeny[4], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[4] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount, ci->progeny[3], -1, 0); if (ci->progeny[7] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[7], -1, 0); if (ci->progeny[7] == sub && cj->progeny[4] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[4], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[4] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount, ci->progeny[7], -1, 0); break; case 10: /* ( 0 , 1 , 0 ) */ if (ci->progeny[2] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[2] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[2], -1, 0); if (ci->progeny[2] == sub && cj->progeny[1] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount, cj->progeny[1], -1, 0); if (ci->progeny[2] != NULL && cj->progeny[1] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount, ci->progeny[2], -1, 0); if (ci->progeny[2] == sub && cj->progeny[4] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount, cj->progeny[4], -1, 0); if (ci->progeny[2] != NULL && cj->progeny[4] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount, ci->progeny[2], -1, 0); if (ci->progeny[2] == sub && cj->progeny[5] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount, cj->progeny[5], -1, 0); if (ci->progeny[2] != NULL && cj->progeny[5] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount, ci->progeny[2], -1, 0); if (ci->progeny[3] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[3], -1, 0); if (ci->progeny[3] == sub && cj->progeny[1] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount, cj->progeny[1], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[1] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount, ci->progeny[3], -1, 0); if (ci->progeny[3] == sub && cj->progeny[4] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount, cj->progeny[4], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[4] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount, ci->progeny[3], -1, 0); if (ci->progeny[3] == sub && cj->progeny[5] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount, cj->progeny[5], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[5] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount, ci->progeny[3], -1, 0); if (ci->progeny[6] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[6], -1, 0); if (ci->progeny[6] == sub && cj->progeny[1] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount, cj->progeny[1], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[1] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount, ci->progeny[6], -1, 0); if (ci->progeny[6] == sub && cj->progeny[4] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount, cj->progeny[4], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[4] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount, ci->progeny[6], -1, 0); if (ci->progeny[6] == sub && cj->progeny[5] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount, cj->progeny[5], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[5] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount, ci->progeny[6], -1, 0); if (ci->progeny[7] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[7], -1, 0); if (ci->progeny[7] == sub && cj->progeny[1] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[1], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[1] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount, ci->progeny[7], -1, 0); if (ci->progeny[7] == sub && cj->progeny[4] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[4], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[4] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount, ci->progeny[7], -1, 0); if (ci->progeny[7] == sub && cj->progeny[5] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[5], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[5] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount, ci->progeny[7], -1, 0); break; case 11: /* ( 0 , 1 , -1 ) */ if (ci->progeny[2] == sub && cj->progeny[1] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount, cj->progeny[1], -1, 0); if (ci->progeny[2] != NULL && cj->progeny[1] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount, ci->progeny[2], -1, 0); if (ci->progeny[2] == sub && cj->progeny[5] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount, cj->progeny[5], -1, 0); if (ci->progeny[2] != NULL && cj->progeny[5] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount, ci->progeny[2], -1, 0); if (ci->progeny[6] == sub && cj->progeny[1] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount, cj->progeny[1], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[1] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount, ci->progeny[6], -1, 0); if (ci->progeny[6] == sub && cj->progeny[5] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount, cj->progeny[5], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[5] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount, ci->progeny[6], -1, 0); break; case 12: /* ( 0 , 0 , 1 ) */ if (ci->progeny[1] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[1], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[1] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[1], -1, 0); if (ci->progeny[1] == sub && cj->progeny[2] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[1], sparts, ind, scount, cj->progeny[2], -1, 0); if (ci->progeny[1] != NULL && cj->progeny[2] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount, ci->progeny[1], -1, 0); if (ci->progeny[1] == sub && cj->progeny[4] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[1], sparts, ind, scount, cj->progeny[4], -1, 0); if (ci->progeny[1] != NULL && cj->progeny[4] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount, ci->progeny[1], -1, 0); if (ci->progeny[1] == sub && cj->progeny[6] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[1], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[1], sparts, ind, scount, cj->progeny[6], -1, 0); if (ci->progeny[1] != NULL && cj->progeny[6] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[6], sparts, ind, scount, ci->progeny[1], -1, 0); if (ci->progeny[3] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[3], -1, 0); if (ci->progeny[3] == sub && cj->progeny[2] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount, cj->progeny[2], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[2] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount, ci->progeny[3], -1, 0); if (ci->progeny[3] == sub && cj->progeny[4] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount, cj->progeny[4], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[4] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount, ci->progeny[3], -1, 0); if (ci->progeny[3] == sub && cj->progeny[6] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount, cj->progeny[6], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[6] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[6], sparts, ind, scount, ci->progeny[3], -1, 0); if (ci->progeny[5] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[5], -1, 0); if (ci->progeny[5] == sub && cj->progeny[2] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount, cj->progeny[2], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[2] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount, ci->progeny[5], -1, 0); if (ci->progeny[5] == sub && cj->progeny[4] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount, cj->progeny[4], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[4] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount, ci->progeny[5], -1, 0); if (ci->progeny[5] == sub && cj->progeny[6] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount, cj->progeny[6], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[6] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[6], sparts, ind, scount, ci->progeny[5], -1, 0); if (ci->progeny[7] == sub && cj->progeny[0] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[0], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[0] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount, ci->progeny[7], -1, 0); if (ci->progeny[7] == sub && cj->progeny[2] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[2], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[2] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount, ci->progeny[7], -1, 0); if (ci->progeny[7] == sub && cj->progeny[4] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[4], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[4] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount, ci->progeny[7], -1, 0); if (ci->progeny[7] == sub && cj->progeny[6] != NULL) - runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, + DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount, cj->progeny[6], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[6] == sub) - runner_dosub_subset_stars_density(r, cj->progeny[6], sparts, ind, + DOSUB_SUBSET_STARS(r, cj->progeny[6], sparts, ind, scount, ci->progeny[7], -1, 0); break; } @@ -943,23 +970,22 @@ void runner_dosub_subset_stars_density(struct runner *r, struct cell *ci, /* Do any of the cells need to be drifted first? */ if (!cell_are_part_drifted(cj, e)) error("Cell should be drifted!"); - runner_dopair_subset_branch_stars_density(r, ci, sparts, ind, scount, cj); + DOPAIR_SUBSET_BRANCH_STARS(r, ci, sparts, ind, scount, cj); } } /* otherwise, pair interaction. */ - if (gettimer) TIMER_TOC(timer_dosub_subset_pair_stars_density); } /** - * @brief Determine which version of runner_doself needs to be called depending + * @brief Determine which version of DOSELF_STARS needs to be called depending * on the optimisation level. * * @param r #runner * @param c #cell c * */ -void runner_doself_branch_stars_density(struct runner *r, struct cell *c) { +void DOSELF_BRANCH_STARS(struct runner *r, struct cell *c) { const struct engine *restrict e = r->e; @@ -970,48 +996,44 @@ void runner_doself_branch_stars_density(struct runner *r, struct cell *c) { if (c->stars.h_max_old * kernel_gamma > c->dmin) error("Cell smaller than smoothing length"); - runner_doself_stars_density(r, c, 1); + DOSELF_STARS(r, c, 1); } -#define RUNNER_STARS_CHECK_SORT(TYPE, PART) \ - void runner_stars_check_sort_##TYPE(struct cell *cj, struct cell *ci, \ - const int sid) { \ - const struct entry *restrict sort_j = cj->TYPE.sort[sid]; \ - \ - for (int pjd = 0; pjd < cj->TYPE.count; pjd++) { \ - const struct PART *p = &cj->TYPE.parts[sort_j[pjd].i]; \ - const float d = p->x[0] * runner_shift[sid][0] + \ - p->x[1] * runner_shift[sid][1] + \ - p->x[2] * runner_shift[sid][2]; \ - if ((fabsf(d - sort_j[pjd].d) - cj->TYPE.dx_max_sort) > \ - 1.0e-4 * max(fabsf(d), cj->TYPE.dx_max_sort_old) && \ - (fabsf(d - sort_j[pjd].d) - cj->TYPE.dx_max_sort) > \ - cj->width[0] * 1.0e-10) \ - error( \ - "particle shift diff exceeds dx_max_sort in cell cj. " \ - "cj->nodeID=%d " \ - "ci->nodeID=%d d=%e sort_j[pjd].d=%e cj->" #TYPE \ - ".dx_max_sort=%e " \ - "cj->" #TYPE ".dx_max_sort_old=%e", \ - cj->nodeID, ci->nodeID, d, sort_j[pjd].d, cj->TYPE.dx_max_sort, \ - cj->TYPE.dx_max_sort_old); \ - } \ - } - -RUNNER_STARS_CHECK_SORT(hydro, part) -RUNNER_STARS_CHECK_SORT(stars, spart) +#define RUNNER_CHECK_SORT(TYPE, PART, cj, ci, sid) \ + ({ \ + const struct entry *restrict sort_j = cj->TYPE.sort[sid]; \ + \ + for (int pjd = 0; pjd < cj->TYPE.count; pjd++) { \ + const struct PART *p = &cj->TYPE.parts[sort_j[pjd].i]; \ + const float d = p->x[0] * runner_shift[sid][0] + \ + p->x[1] * runner_shift[sid][1] + \ + p->x[2] * runner_shift[sid][2]; \ + if ((fabsf(d - sort_j[pjd].d) - cj->TYPE.dx_max_sort) > \ + 1.0e-4 * max(fabsf(d), cj->TYPE.dx_max_sort_old) && \ + (fabsf(d - sort_j[pjd].d) - cj->TYPE.dx_max_sort) > \ + cj->width[0] * 1.0e-10) \ + error( \ + "particle shift diff exceeds dx_max_sort in cell cj. " \ + "cj->nodeID=%d " \ + "ci->nodeID=%d d=%e sort_j[pjd].d=%e cj->" #TYPE \ + ".dx_max_sort=%e " \ + "cj->" #TYPE ".dx_max_sort_old=%e", \ + cj->nodeID, ci->nodeID, d, sort_j[pjd].d, cj->TYPE.dx_max_sort, \ + cj->TYPE.dx_max_sort_old); \ + } \ + }) /** - * @brief Determine which version of DOPAIR1 needs to be called depending on the - * orientation of the cells or whether DOPAIR1 needs to be called at all. + * @brief Determine which version of DOPAIR_STARS needs to be called depending on the + * orientation of the cells or whether DOPAIR_STARS needs to be called at all. * * @param r #runner * @param ci #cell ci * @param cj #cell cj * */ -void runner_dopair_branch_stars_density(struct runner *r, struct cell *ci, - struct cell *cj) { +void DOPAIR_BRANCH_STARS(struct runner *r, struct cell *ci, + struct cell *cj) { const struct engine *restrict e = r->e; const int ci_active = cell_is_active_stars(ci, e); @@ -1055,17 +1077,17 @@ void runner_dopair_branch_stars_density(struct runner *r, struct cell *ci, #ifdef SWIFT_DEBUG_CHECKS if (do_ci) { - runner_stars_check_sort_hydro(cj, ci, sid); - runner_stars_check_sort_stars(ci, cj, sid); + RUNNER_CHECK_SORT_STARS(hydro, part, cj, ci, sid); + RUNNER_CHECK_SORT_STARS(stars, spart, ci, cj, sid); } if (do_cj) { - runner_stars_check_sort_hydro(ci, cj, sid); - runner_stars_check_sort_stars(cj, ci, sid); + RUNNER_CHECK_SORT_STARS(hydro, part, ci, cj, sid); + RUNNER_CHECK_SORT_STARS(stars, spart, cj, ci, sid); } #endif /* SWIFT_DEBUG_CHECKS */ - runner_dopair_stars_density(r, ci, cj, 1); + DOPAIR_STARS(r, ci, cj, 1); } /** @@ -1080,14 +1102,12 @@ void runner_dopair_branch_stars_density(struct runner *r, struct cell *ci, * @todo Hard-code the sid on the recursive calls to avoid the * redundant computations to find the sid on-the-fly. */ -void runner_dosub_pair_stars_density(struct runner *r, struct cell *ci, - struct cell *cj, int sid, int gettimer) { +void DOSUB_PAIR_STARS(struct runner *r, struct cell *ci, + struct cell *cj, int sid, int gettimer) { struct space *s = r->e->s; const struct engine *e = r->e; - TIMER_TIC; - /* Should we even bother? */ int should_do = ci->stars.count != 0 && cj->hydro.count != 0 && cell_is_active_stars(ci, e); @@ -1109,268 +1129,268 @@ void runner_dosub_pair_stars_density(struct runner *r, struct cell *ci, /* Regular sub-cell interactions of a single cell. */ case 0: /* ( 1 , 1 , 1 ) */ if (ci->progeny[7] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[0], -1, 0); break; case 1: /* ( 1 , 1 , 0 ) */ if (ci->progeny[6] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[6], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[6], cj->progeny[0], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[1] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[6], cj->progeny[1], -1, + DOSUB_PAIR_STARS(r, ci->progeny[6], cj->progeny[1], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[0], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[1] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[1], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[1], -1, 0); break; case 2: /* ( 1 , 1 , -1 ) */ if (ci->progeny[6] != NULL && cj->progeny[1] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[6], cj->progeny[1], -1, + DOSUB_PAIR_STARS(r, ci->progeny[6], cj->progeny[1], -1, 0); break; case 3: /* ( 1 , 0 , 1 ) */ if (ci->progeny[5] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[5], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[5], cj->progeny[0], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[2] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[5], cj->progeny[2], -1, + DOSUB_PAIR_STARS(r, ci->progeny[5], cj->progeny[2], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[0], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[2] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[2], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[2], -1, 0); break; case 4: /* ( 1 , 0 , 0 ) */ if (ci->progeny[4] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[4], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[4], cj->progeny[0], -1, 0); if (ci->progeny[4] != NULL && cj->progeny[1] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[4], cj->progeny[1], -1, + DOSUB_PAIR_STARS(r, ci->progeny[4], cj->progeny[1], -1, 0); if (ci->progeny[4] != NULL && cj->progeny[2] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[4], cj->progeny[2], -1, + DOSUB_PAIR_STARS(r, ci->progeny[4], cj->progeny[2], -1, 0); if (ci->progeny[4] != NULL && cj->progeny[3] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[4], cj->progeny[3], -1, + DOSUB_PAIR_STARS(r, ci->progeny[4], cj->progeny[3], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[5], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[5], cj->progeny[0], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[1] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[5], cj->progeny[1], -1, + DOSUB_PAIR_STARS(r, ci->progeny[5], cj->progeny[1], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[2] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[5], cj->progeny[2], -1, + DOSUB_PAIR_STARS(r, ci->progeny[5], cj->progeny[2], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[3] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[5], cj->progeny[3], -1, + DOSUB_PAIR_STARS(r, ci->progeny[5], cj->progeny[3], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[6], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[6], cj->progeny[0], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[1] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[6], cj->progeny[1], -1, + DOSUB_PAIR_STARS(r, ci->progeny[6], cj->progeny[1], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[2] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[6], cj->progeny[2], -1, + DOSUB_PAIR_STARS(r, ci->progeny[6], cj->progeny[2], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[3] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[6], cj->progeny[3], -1, + DOSUB_PAIR_STARS(r, ci->progeny[6], cj->progeny[3], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[0], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[1] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[1], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[1], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[2] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[2], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[2], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[3] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[3], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[3], -1, 0); break; case 5: /* ( 1 , 0 , -1 ) */ if (ci->progeny[4] != NULL && cj->progeny[1] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[4], cj->progeny[1], -1, + DOSUB_PAIR_STARS(r, ci->progeny[4], cj->progeny[1], -1, 0); if (ci->progeny[4] != NULL && cj->progeny[3] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[4], cj->progeny[3], -1, + DOSUB_PAIR_STARS(r, ci->progeny[4], cj->progeny[3], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[1] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[6], cj->progeny[1], -1, + DOSUB_PAIR_STARS(r, ci->progeny[6], cj->progeny[1], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[3] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[6], cj->progeny[3], -1, + DOSUB_PAIR_STARS(r, ci->progeny[6], cj->progeny[3], -1, 0); break; case 6: /* ( 1 , -1 , 1 ) */ if (ci->progeny[5] != NULL && cj->progeny[2] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[5], cj->progeny[2], -1, + DOSUB_PAIR_STARS(r, ci->progeny[5], cj->progeny[2], -1, 0); break; case 7: /* ( 1 , -1 , 0 ) */ if (ci->progeny[4] != NULL && cj->progeny[2] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[4], cj->progeny[2], -1, + DOSUB_PAIR_STARS(r, ci->progeny[4], cj->progeny[2], -1, 0); if (ci->progeny[4] != NULL && cj->progeny[3] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[4], cj->progeny[3], -1, + DOSUB_PAIR_STARS(r, ci->progeny[4], cj->progeny[3], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[2] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[5], cj->progeny[2], -1, + DOSUB_PAIR_STARS(r, ci->progeny[5], cj->progeny[2], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[3] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[5], cj->progeny[3], -1, + DOSUB_PAIR_STARS(r, ci->progeny[5], cj->progeny[3], -1, 0); break; case 8: /* ( 1 , -1 , -1 ) */ if (ci->progeny[4] != NULL && cj->progeny[3] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[4], cj->progeny[3], -1, + DOSUB_PAIR_STARS(r, ci->progeny[4], cj->progeny[3], -1, 0); break; case 9: /* ( 0 , 1 , 1 ) */ if (ci->progeny[3] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[3], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[3], cj->progeny[0], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[4] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[3], cj->progeny[4], -1, + DOSUB_PAIR_STARS(r, ci->progeny[3], cj->progeny[4], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[0], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[4] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[4], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[4], -1, 0); break; case 10: /* ( 0 , 1 , 0 ) */ if (ci->progeny[2] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[2], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[2], cj->progeny[0], -1, 0); if (ci->progeny[2] != NULL && cj->progeny[1] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[2], cj->progeny[1], -1, + DOSUB_PAIR_STARS(r, ci->progeny[2], cj->progeny[1], -1, 0); if (ci->progeny[2] != NULL && cj->progeny[4] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[2], cj->progeny[4], -1, + DOSUB_PAIR_STARS(r, ci->progeny[2], cj->progeny[4], -1, 0); if (ci->progeny[2] != NULL && cj->progeny[5] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[2], cj->progeny[5], -1, + DOSUB_PAIR_STARS(r, ci->progeny[2], cj->progeny[5], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[3], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[3], cj->progeny[0], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[1] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[3], cj->progeny[1], -1, + DOSUB_PAIR_STARS(r, ci->progeny[3], cj->progeny[1], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[4] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[3], cj->progeny[4], -1, + DOSUB_PAIR_STARS(r, ci->progeny[3], cj->progeny[4], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[5] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[3], cj->progeny[5], -1, + DOSUB_PAIR_STARS(r, ci->progeny[3], cj->progeny[5], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[6], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[6], cj->progeny[0], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[1] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[6], cj->progeny[1], -1, + DOSUB_PAIR_STARS(r, ci->progeny[6], cj->progeny[1], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[4] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[6], cj->progeny[4], -1, + DOSUB_PAIR_STARS(r, ci->progeny[6], cj->progeny[4], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[5] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[6], cj->progeny[5], -1, + DOSUB_PAIR_STARS(r, ci->progeny[6], cj->progeny[5], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[0], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[1] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[1], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[1], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[4] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[4], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[4], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[5] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[5], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[5], -1, 0); break; case 11: /* ( 0 , 1 , -1 ) */ if (ci->progeny[2] != NULL && cj->progeny[1] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[2], cj->progeny[1], -1, + DOSUB_PAIR_STARS(r, ci->progeny[2], cj->progeny[1], -1, 0); if (ci->progeny[2] != NULL && cj->progeny[5] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[2], cj->progeny[5], -1, + DOSUB_PAIR_STARS(r, ci->progeny[2], cj->progeny[5], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[1] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[6], cj->progeny[1], -1, + DOSUB_PAIR_STARS(r, ci->progeny[6], cj->progeny[1], -1, 0); if (ci->progeny[6] != NULL && cj->progeny[5] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[6], cj->progeny[5], -1, + DOSUB_PAIR_STARS(r, ci->progeny[6], cj->progeny[5], -1, 0); break; case 12: /* ( 0 , 0 , 1 ) */ if (ci->progeny[1] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[1], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[1], cj->progeny[0], -1, 0); if (ci->progeny[1] != NULL && cj->progeny[2] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[1], cj->progeny[2], -1, + DOSUB_PAIR_STARS(r, ci->progeny[1], cj->progeny[2], -1, 0); if (ci->progeny[1] != NULL && cj->progeny[4] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[1], cj->progeny[4], -1, + DOSUB_PAIR_STARS(r, ci->progeny[1], cj->progeny[4], -1, 0); if (ci->progeny[1] != NULL && cj->progeny[6] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[1], cj->progeny[6], -1, + DOSUB_PAIR_STARS(r, ci->progeny[1], cj->progeny[6], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[3], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[3], cj->progeny[0], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[2] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[3], cj->progeny[2], -1, + DOSUB_PAIR_STARS(r, ci->progeny[3], cj->progeny[2], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[4] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[3], cj->progeny[4], -1, + DOSUB_PAIR_STARS(r, ci->progeny[3], cj->progeny[4], -1, 0); if (ci->progeny[3] != NULL && cj->progeny[6] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[3], cj->progeny[6], -1, + DOSUB_PAIR_STARS(r, ci->progeny[3], cj->progeny[6], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[5], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[5], cj->progeny[0], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[2] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[5], cj->progeny[2], -1, + DOSUB_PAIR_STARS(r, ci->progeny[5], cj->progeny[2], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[4] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[5], cj->progeny[4], -1, + DOSUB_PAIR_STARS(r, ci->progeny[5], cj->progeny[4], -1, 0); if (ci->progeny[5] != NULL && cj->progeny[6] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[5], cj->progeny[6], -1, + DOSUB_PAIR_STARS(r, ci->progeny[5], cj->progeny[6], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[0] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[0], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[0], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[2] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[2], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[2], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[4] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[4], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[4], -1, 0); if (ci->progeny[7] != NULL && cj->progeny[6] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[7], cj->progeny[6], -1, + DOSUB_PAIR_STARS(r, ci->progeny[7], cj->progeny[6], -1, 0); break; } @@ -1423,10 +1443,9 @@ void runner_dosub_pair_stars_density(struct runner *r, struct cell *ci, error("Interacting unsorted cell (sparts)."); } - if (do_ci || do_cj) runner_dopair_branch_stars_density(r, ci, cj); + if (do_ci || do_cj) DOPAIR_BRANCH_STARS(r, ci, cj); } - if (gettimer) TIMER_TOC(timer_dosub_pair_stars_density); } /** @@ -1436,10 +1455,8 @@ void runner_dosub_pair_stars_density(struct runner *r, struct cell *ci, * @param ci The first #cell. * @param gettimer Do we have a timer ? */ -void runner_dosub_self_stars_density(struct runner *r, struct cell *ci, - int gettimer) { - - TIMER_TIC; +void DOSUB_SELF_STARS(struct runner *r, struct cell *ci, + int gettimer) { /* Should we even bother? */ if (ci->hydro.count == 0 || ci->stars.count == 0 || @@ -1452,10 +1469,10 @@ void runner_dosub_self_stars_density(struct runner *r, struct cell *ci, /* Loop over all progeny. */ for (int k = 0; k < 8; k++) if (ci->progeny[k] != NULL) { - runner_dosub_self_stars_density(r, ci->progeny[k], 0); + DOSUB_SELF_STARS(r, ci->progeny[k], 0); for (int j = k + 1; j < 8; j++) if (ci->progeny[j] != NULL) - runner_dosub_pair_stars_density(r, ci->progeny[k], ci->progeny[j], + DOSUB_PAIR_STARS(r, ci->progeny[k], ci->progeny[j], -1, 0); } } @@ -1466,10 +1483,7 @@ void runner_dosub_self_stars_density(struct runner *r, struct cell *ci, /* Drift the cell to the current timestep if needed. */ if (!cell_are_spart_drifted(ci, r->e)) error("Interacting undrifted cell."); - runner_doself_branch_stars_density(r, ci); + DOSELF_BRANCH_STARS(r, ci); } - if (gettimer) TIMER_TOC(timer_dosub_self_stars_density); } - -#endif // SWIFT_RUNNER_DOIACT_STARS_H diff --git a/src/stars/Default/stars_iact.h b/src/stars/Default/stars_iact.h index 3b066686060bcee7583fe65c032da5c12f637081..2bad98f5df4d68e89d382e2c0bd00b7199190812 100644 --- a/src/stars/Default/stars_iact.h +++ b/src/stars/Default/stars_iact.h @@ -38,3 +38,21 @@ runner_iact_nonsym_stars_density(float r2, const float *dx, float hi, float hj, ++si->num_ngb_density; #endif } + +/** + * @brief Feedback interaction between two particles (non-symmetric). + * + * @param r2 Comoving square distance between the two particles. + * @param dx Comoving vector separating both particles (pi - pj). + * @param hi Comoving smoothing-length of particle i. + * @param hj Comoving smoothing-length of particle j. + * @param si First sparticle. + * @param pj Second particle (not updated). + * @param a Current scale factor. + * @param H Current Hubble parameter. + */ +__attribute__((always_inline)) INLINE static void +runner_iact_nonsym_stars_feedback(float r2, const float *dx, float hi, float hj, + struct spart *restrict si, + const struct part *restrict pj, float a, + float H) {} diff --git a/src/timers.c b/src/timers.c index ccec0a9657d3394de93055992ae4b18c05794a30..d7523edaa42570f8e5f3c01516075267988dfd9c 100644 --- a/src/timers.c +++ b/src/timers.c @@ -87,13 +87,7 @@ const char* timers_names[timer_count] = { "locktree", "runners", "step", - "doself_stars_density", - "dopair_stars_density", "do_stars_ghost", - "doself_subset_stars_density", - "dopair_subset_stars_density", - "dosubpair_stars_density", - "dosub_self_stars_density", "logger", "do_stars_sort", };