diff --git a/src/engine.c b/src/engine.c index 5ed61430c47cbdd2030fd0b53473aca519cebb3e..41b9ad4fa87b438f3179a83a1523ae5c70bd493b 100644 --- a/src/engine.c +++ b/src/engine.c @@ -1726,7 +1726,7 @@ void engine_make_self_gravity_tasks_mapper(void *map_data, int num_elements, const int cdim[3] = {s->cdim[0], s->cdim[1], s->cdim[2]}; const int cdim_ghost[3] = {s->cdim[0] / 4 + 1, s->cdim[1] / 4 + 1, s->cdim[2] / 4 + 1}; - const double theta_crit_inv = e->gravity_properties->theta_crit_inv; + const double theta_crit = e->gravity_properties->theta_crit; struct cell *cells = s->cells_top; const int n_ghosts = cdim_ghost[0] * cdim_ghost[1] * cdim_ghost[2] * 2; @@ -1782,7 +1782,7 @@ void engine_make_self_gravity_tasks_mapper(void *map_data, int num_elements, if (cj->nodeID != nodeID) continue; // MATTHIEU /* Recover the multipole information */ - struct gravity_tensors *const multi_j = cj->multipole; + const struct gravity_tensors *const multi_j = cj->multipole; /* Get the distance between the CoMs */ double dx = CoM_i[0] - multi_j->CoM[0]; @@ -1798,8 +1798,8 @@ void engine_make_self_gravity_tasks_mapper(void *map_data, int num_elements, const double r2 = dx * dx + dy * dy + dz * dz; /* Are the cells too close for a MM interaction ? */ - if (!gravity_multipole_accept_rebuild(multi_i, multi_j, - theta_crit_inv, r2)) { + if (!gravity_multipole_accept_rebuild(multi_i, multi_j, theta_crit, + r2)) { /* Ok, we need to add a direct pair calculation */ scheduler_addtask(sched, task_type_pair, task_subtype_grav, 0, 0, diff --git a/src/multipole.h b/src/multipole.h index 004757924cccb6bc2f450c19f1ccd600f50e1990..255be3e538dcf50ced1a62a5fa9fef2a93f917da 100644 --- a/src/multipole.h +++ b/src/multipole.h @@ -2646,17 +2646,17 @@ INLINE static void gravity_L2P(const struct grav_tensor *lb, * * @param ma The #multipole of the first #cell. * @param mb The #multipole of the second #cell. - * @param theta_crit_inv The inverse of the critical opening angle. + * @param theta_crit The critical opening angle. * @param r2 Square of the distance (periodically wrapped) between the * multipoles. */ __attribute__((always_inline)) INLINE static int gravity_multipole_accept_rebuild(const struct gravity_tensors *const ma, const struct gravity_tensors *const mb, - double theta_crit_inv, double r2) { + double theta_crit, double r2) { - const double r_crit_a = ma->r_max_rebuild * theta_crit_inv; - const double r_crit_b = mb->r_max_rebuild * theta_crit_inv; + const double r_crit_a = ma->r_max_rebuild * theta_crit; + const double r_crit_b = mb->r_max_rebuild * theta_crit; // MATTHIEU: Make this mass-dependent ? @@ -2673,16 +2673,16 @@ gravity_multipole_accept_rebuild(const struct gravity_tensors *const ma, * * @param ma The #multipole of the first #cell. * @param mb The #multipole of the second #cell. - * @param theta_crit_inv The inverse of the critical opening angle. + * @param theta_crit The critical opening angle. * @param r2 Square of the distance (periodically wrapped) between the * multipoles. */ __attribute__((always_inline)) INLINE static int gravity_multipole_accept( const struct gravity_tensors *const ma, - const struct gravity_tensors *const mb, double theta_crit_inv, double r2) { + const struct gravity_tensors *const mb, double theta_crit, double r2) { - const double r_crit_a = ma->r_max * theta_crit_inv; - const double r_crit_b = mb->r_max * theta_crit_inv; + const double r_crit_a = ma->r_max * theta_crit; + const double r_crit_b = mb->r_max * theta_crit; // MATTHIEU: Make this mass-dependent ? diff --git a/src/runner_doiact_grav.h b/src/runner_doiact_grav.h index d018ec8839036eaba5e7b581e4a2b990186cb673..ee881fd00225db9331f37a540611cb6b313523e6 100644 --- a/src/runner_doiact_grav.h +++ b/src/runner_doiact_grav.h @@ -1408,7 +1408,7 @@ void runner_dopair_grav(struct runner *r, struct cell *ci, struct cell *cj, const double cell_width = s->width[0]; const double dim[3] = {s->dim[0], s->dim[1], s->dim[2]}; const struct gravity_props *props = e->gravity_properties; - const double theta_crit_inv = props->theta_crit_inv; + const double theta_crit = props->theta_crit; const double max_distance = props->a_smooth * props->r_cut_max * cell_width; const double max_distance2 = max_distance * max_distance; @@ -1469,7 +1469,7 @@ void runner_dopair_grav(struct runner *r, struct cell *ci, struct cell *cj, * option... */ /* Can we use M-M interactions ? */ - if (gravity_multipole_accept(multi_i, multi_j, theta_crit_inv, r2)) { + if (gravity_multipole_accept(multi_i, multi_j, theta_crit, r2)) { /* MATTHIEU: make a symmetric M-M interaction function ! */ runner_dopair_grav_mm(r, ci, cj); @@ -1634,7 +1634,7 @@ void runner_do_grav_long_range(struct runner *r, struct cell *ci, int timer) { const int periodic = s->periodic; const double cell_width = s->width[0]; const double dim[3] = {s->dim[0], s->dim[1], s->dim[2]}; - const double theta_crit_inv = props->theta_crit_inv; + const double theta_crit = props->theta_crit; const double max_distance = props->a_smooth * props->r_cut_max * cell_width; const double max_distance2 = max_distance * max_distance; @@ -1693,7 +1693,7 @@ void runner_do_grav_long_range(struct runner *r, struct cell *ci, int timer) { } /* Check the multipole acceptance criterion */ - if (gravity_multipole_accept(multi_i, multi_j, theta_crit_inv, r2)) { + if (gravity_multipole_accept(multi_i, multi_j, theta_crit, r2)) { /* Go for a (non-symmetric) M-M calculation */ runner_dopair_grav_mm(r, ci, cj); @@ -1716,7 +1716,7 @@ void runner_do_grav_long_range(struct runner *r, struct cell *ci, int timer) { const double r2_rebuild = dx * dx + dy * dy + dz * dz; /* Is the criterion violated now but was OK at the last rebuild ? */ - if (gravity_multipole_accept_rebuild(multi_i, multi_j, theta_crit_inv, + if (gravity_multipole_accept_rebuild(multi_i, multi_j, theta_crit, r2_rebuild)) { /* Alright, we have to take charge of that pair in a different way. */