Skip to content
Snippets Groups Projects
Commit c08fce03 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Also use quadrupole P-M interactions when running the truncated pair_pp a the lead level

parent 797090ce
No related branches found
No related tags found
1 merge request!420Gravity speedup
...@@ -494,8 +494,8 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci, ...@@ -494,8 +494,8 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
/* Recover the multipole info and shift the CoM locations */ /* Recover the multipole info and shift the CoM locations */
const float rmax_i = ci->multipole->r_max; const float rmax_i = ci->multipole->r_max;
const float rmax_j = cj->multipole->r_max; const float rmax_j = cj->multipole->r_max;
const float multi_mass_i = ci->multipole->m_pole.M_000; const struct multipole *multi_i = &ci->multipole->m_pole;
const float multi_mass_j = cj->multipole->m_pole.M_000; const struct multipole *multi_j = &cj->multipole->m_pole;
const float CoM_i[3] = {ci->multipole->CoM[0] - loc_mean[0], const float CoM_i[3] = {ci->multipole->CoM[0] - loc_mean[0],
ci->multipole->CoM[1] - loc_mean[1], ci->multipole->CoM[1] - loc_mean[1],
ci->multipole->CoM[2] - loc_mean[2]}; ci->multipole->CoM[2] - loc_mean[2]};
...@@ -533,14 +533,14 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci, ...@@ -533,14 +533,14 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
if (gravity_multipole_accept(0., rmax_j, theta_crit2, r2)) { if (gravity_multipole_accept(0., rmax_j, theta_crit2, r2)) {
/* Interact! */ /* Interact! */
float f_ij; float f_x, f_y, f_z;
runner_iact_grav_pp_truncated(r2, h2_i, h_inv_i, h_inv3_i, multi_mass_j, runner_iact_grav_pm(dx, dy, dz, r2, h_i, h_inv_i, multi_j, &f_x, &f_y,
rlr_inv, &f_ij); &f_z);
/* Store it back */ /* Store it back */
ci_cache->a_x[pid] = -f_ij * dx; ci_cache->a_x[pid] = f_x;
ci_cache->a_y[pid] = -f_ij * dy; ci_cache->a_y[pid] = f_y;
ci_cache->a_z[pid] = -f_ij * dz; ci_cache->a_z[pid] = f_z;
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
/* Update the interaction counter */ /* Update the interaction counter */
...@@ -639,14 +639,14 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci, ...@@ -639,14 +639,14 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
if (gravity_multipole_accept(0., rmax_i, theta_crit2, r2)) { if (gravity_multipole_accept(0., rmax_i, theta_crit2, r2)) {
/* Interact! */ /* Interact! */
float f_ji; float f_x, f_y, f_z;
runner_iact_grav_pp_truncated(r2, h2_j, h_inv_j, h_inv3_j, multi_mass_i, runner_iact_grav_pm(dx, dy, dz, r2, h_j, h_inv_j, multi_i, &f_x, &f_y,
rlr_inv, &f_ji); &f_z);
/* Store it back */ /* Store it back */
cj_cache->a_x[pjd] = -f_ji * dx; cj_cache->a_x[pjd] = f_x;
cj_cache->a_y[pjd] = -f_ji * dy; cj_cache->a_y[pjd] = f_y;
cj_cache->a_z[pjd] = -f_ji * dz; cj_cache->a_z[pjd] = f_z;
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
/* Update the interaction counter */ /* Update the interaction counter */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment