diff --git a/src/runner_doiact_stars.h b/src/runner_doiact_stars.h index a97344f4aab5afae99b23cbdf11a4eeecf409b4c..e3a1df7d1a941db3cb3414e76dc4f927e04f68a1 100644 --- a/src/runner_doiact_stars.h +++ b/src/runner_doiact_stars.h @@ -91,8 +91,8 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) { const struct cosmology *cosmo = e->cosmology; /* Anything to do here? */ + if (c->hydro.count == 0 || c->stars.count == 0) return; if (!cell_is_active_stars(c, e)) return; - if (c->hydro.count == 0 && c->stars.count == 0) return; /* Cosmological terms */ const float a = cosmo->a; @@ -108,7 +108,7 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) { /* Get a hold of the ith spart in ci. */ struct spart *restrict si = &sparts[sid]; - if (!spart_is_active(si, e) || spart_is_inhibited(si, e)) continue; + if (!spart_is_active(si, e)) continue; const float hi = si->h; const float hig2 = hi * hi * kernel_gamma2; @@ -121,7 +121,9 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) { /* Get a pointer to the jth particle. */ struct part *restrict pj = &parts[pjd]; - const float hj = pj->h; + + /* Early abort? */ + if (part_is_inhibited(pj, e)) continue; /* Compute the pairwise distance. */ const float pjx[3] = {(float)(pj->x[0] - c->loc[0]), @@ -136,8 +138,8 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) { error("Particle pj not drifted to current time"); #endif - if (r2 > 0.f && r2 < hig2) { - IACT_STARS(r2, dx, hi, hj, si, pj, a, H); + if (r2 < hig2) { + IACT_STARS(r2, dx, hi, pj->h, si, pj, a, H); } } /* loop over the parts in ci. */ } /* loop over the sparts in ci. */ @@ -749,6 +751,9 @@ void DOSELF1_SUBSET_STARS(struct runner *r, struct cell *restrict ci, const int count_i = ci->hydro.count; struct part *restrict parts_j = ci->hydro.parts; + /* Early abort? */ + if (count_i == 0) return; + /* Loop over the parts in ci. */ for (int spid = 0; spid < scount; spid++) { @@ -770,7 +775,9 @@ void DOSELF1_SUBSET_STARS(struct runner *r, struct cell *restrict ci, /* Get a pointer to the jth particle. */ struct part *restrict pj = &parts_j[pjd]; - const float hj = pj->h; + + /* Early abort? */ + if (part_is_inhibited(pj, e)) continue; /* Compute the pairwise distance. */ const float pjx[3] = {(float)(pj->x[0] - ci->loc[0]), @@ -786,8 +793,8 @@ void DOSELF1_SUBSET_STARS(struct runner *r, struct cell *restrict ci, #endif /* Hit or miss? */ - if (r2 > 0.f && r2 < hig2) { - IACT_STARS(r2, dx, hi, hj, spi, pj, a, H); + if (r2 < hig2) { + IACT_STARS(r2, dx, hi, pj->h, spi, pj, a, H); } } /* loop over the parts in cj. */ } /* loop over the parts in ci. */