diff --git a/src/gravity_cache.h b/src/gravity_cache.h index f6a848f25173ffacab29b0b589914efcece65900..912961d2e06dc748039f54c72bd9b33fd2547df2 100644 --- a/src/gravity_cache.h +++ b/src/gravity_cache.h @@ -253,11 +253,10 @@ __attribute__((always_inline)) INLINE static void gravity_cache_populate( dz = nearestf(dz, dim[2]); } const float r2 = dx * dx + dy * dy + dz * dz; - const float epsilon2 = epsilon[i] * epsilon[i]; /* Check whether we can use the multipole instead of P-P */ use_mpole[i] = - allow_mpole && gravity_M2P_accept(r_max2, theta_crit2, r2, epsilon2); + allow_mpole && gravity_M2P_accept(r_max2, theta_crit2, r2, epsilon[i]); } #ifdef SWIFT_DEBUG_CHECKS @@ -437,9 +436,8 @@ gravity_cache_populate_all_mpole(const timebin_t max_active_bin, dz = nearestf(dz, dim[2]); } const float r2 = dx * dx + dy * dy + dz * dz; - const float epsilon2 = epsilon[i] * epsilon[i]; - if (!gravity_M2P_accept(r_max2, theta_crit2, r2, epsilon2)) + if (!gravity_M2P_accept(r_max2, theta_crit2, r2, epsilon[i])) error("Using m-pole where the test fails"); #endif } diff --git a/src/multipole.h b/src/multipole.h index 041be93330b3c77676e6204d67a9afd4ebbd9563..0c699ea4d782aeb744b78b472a52c358480184b7 100644 --- a/src/multipole.h +++ b/src/multipole.h @@ -2609,16 +2609,16 @@ __attribute__((always_inline, const)) INLINE static int gravity_M2L_accept( * @param theta_crit2 The square of the critical opening angle. * @param r2 Square of the distance (periodically wrapped) between the * particle and the multipole. - * @param epsilon2 The square of the softening length of the particle. + * @param epsilon The softening length of the particle. */ __attribute__((always_inline, const)) INLINE static int gravity_M2P_accept( const float r_max2, const float theta_crit2, const float r2, - const float epsilon2) { + const float epsilon) { // MATTHIEU: Make this mass-dependent ? /* Multipole acceptance criterion (Dehnen 2002, eq.10) */ - return (r2 * theta_crit2 > r_max2) && (r2 > epsilon2); + return (r2 * theta_crit2 > r_max2) && (r2 > epsilon * epsilon); } #endif /* SWIFT_MULTIPOLE_H */ diff --git a/src/runner_doiact_grav.h b/src/runner_doiact_grav.h index 27e811b0044886e305913b19db0e9d48585ba4c7..5609b295a9c416c3f9bd69bec006baff0134eac1 100644 --- a/src/runner_doiact_grav.h +++ b/src/runner_doiact_grav.h @@ -519,7 +519,7 @@ static INLINE void runner_dopair_grav_pm_full( const float theta_crit2 = e->gravity_properties->theta_crit2; /* Note: 1.1 to avoid FP rounding false-positives */ - if (!gravity_M2P_accept(r_max2, theta_crit2 * 1.1, r2, h_i * h_i)) + if (!gravity_M2P_accept(r_max2, theta_crit2 * 1.1, r2, h_i)) error( "use_mpole[i] set when M2P accept fails CoM=[%e %e %e] pos=[%e %e " "%e], rmax=%e", @@ -650,7 +650,7 @@ static INLINE void runner_dopair_grav_pm_truncated( const float theta_crit2 = e->gravity_properties->theta_crit2; /* 1.1 to avoid FP rounding false-positives */ - if (!gravity_M2P_accept(r_max2, theta_crit2 * 1.1, r2, h_i * h_i)) + if (!gravity_M2P_accept(r_max2, theta_crit2 * 1.1, r2, h_i)) error( "use_mpole[i] set when M2P accept fails CoM=[%e %e %e] pos=[%e %e " "%e], rmax=%e",