Commit 79b0d507 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Improve the interface of the gravity cache construction.

parent d86953f9
......@@ -41,6 +41,7 @@ __attribute__((always_inline)) INLINE static float gravity_get_mass(
* @brief Returns the softening of a particle
*
* @param gp The particle of interest
* @param grav_props The global gravity properties.
*/
__attribute__((always_inline)) INLINE static float gravity_get_softening(
const struct gpart* gp, const struct gravity_props* restrict grav_props) {
......
......@@ -149,15 +149,17 @@ static INLINE void gravity_cache_init(struct gravity_cache *c, int count) {
* @param shift A shift to apply to all the particles.
* @param CoM The position of the multipole.
* @param r_max2 The square of the multipole radius.
* @param theta_crit2 The square of the opening angle.
* @param cell The cell we play with (to get reasonable padding positions).
* @param grav_props The global gravity properties.
*/
__attribute__((always_inline)) INLINE static void gravity_cache_populate(
timebin_t max_active_bin, struct gravity_cache *c,
const struct gpart *restrict gparts, int gcount, int gcount_padded,
const double shift[3], const float CoM[3], float r_max2, float theta_crit2,
const double shift[3], const float CoM[3], float r_max2,
const struct cell *cell, const struct gravity_props *grav_props) {
const float theta_crit2 = grav_props->theta_crit2;
/* Make the compiler understand we are in happy vectorization land */
swift_declare_aligned_ptr(float, x, c->x, SWIFT_CACHE_ALIGNMENT);
swift_declare_aligned_ptr(float, y, c->y, SWIFT_CACHE_ALIGNMENT);
......@@ -220,6 +222,7 @@ __attribute__((always_inline)) INLINE static void gravity_cache_populate(
* multiple of the vector length.
* @param shift A shift to apply to all the particles.
* @param cell The cell we play with (to get reasonable padding positions).
* @param grav_props The global gravity properties.
*/
__attribute__((always_inline)) INLINE static void
gravity_cache_populate_no_mpole(timebin_t max_active_bin,
......
......@@ -466,7 +466,6 @@ static INLINE void runner_dopair_grav_pp(struct runner *r, struct cell *ci,
struct space *s = e->s;
const int periodic = s->periodic;
const double cell_width = s->width[0];
const float theta_crit2 = e->gravity_properties->theta_crit2;
const double a_smooth = e->gravity_properties->a_smooth;
const double r_cut_min = e->gravity_properties->r_cut_min;
const double rlr = cell_width * a_smooth;
......@@ -532,11 +531,11 @@ static INLINE void runner_dopair_grav_pp(struct runner *r, struct cell *ci,
/* Fill the caches */
gravity_cache_populate(e->max_active_bin, ci_cache, ci->gparts, gcount_i,
gcount_padded_i, shift_i, CoM_j, rmax2_j, theta_crit2,
ci, e->gravity_properties);
gcount_padded_i, shift_i, CoM_j, rmax2_j, ci,
e->gravity_properties);
gravity_cache_populate(e->max_active_bin, cj_cache, cj->gparts, gcount_j,
gcount_padded_j, shift_j, CoM_i, rmax2_i, theta_crit2,
cj, e->gravity_properties);
gcount_padded_j, shift_j, CoM_i, rmax2_i, cj,
e->gravity_properties);
/* Can we use the Newtonian version or do we need the truncated one ? */
if (!periodic) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment