Commit 317c515e authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Pass the 'periodic' argument to the MACs

parent ed3a32d3
......@@ -6418,5 +6418,5 @@ int cell_can_use_pair_mm(const struct cell *ci, const struct cell *cj,
const double r2 = dx * dx + dy * dy + dz * dz;
return gravity_M2L_accept_symmetric(props, multi_i, multi_j, r2,
use_rebuild_data);
use_rebuild_data, periodic);
}
......@@ -255,8 +255,8 @@ INLINE static void gravity_cache_populate(
const float r2 = dx * dx + dy * dy + dz * dz;
/* Check whether we can use the multipole instead of P-P */
use_mpole[i] = allow_mpole &&
gravity_M2P_accept(grav_props, &gparts[i], multipole, r2);
use_mpole[i] = allow_mpole && gravity_M2P_accept(grav_props, &gparts[i],
multipole, r2, periodic);
}
#ifdef SWIFT_DEBUG_CHECKS
......@@ -430,7 +430,7 @@ INLINE static void gravity_cache_populate_all_mpole(
}
const float r2 = dx * dx + dy * dy + dz * dz;
if (!gravity_M2P_accept(grav_props, &gparts[i], multipole, r2))
if (!gravity_M2P_accept(grav_props, &gparts[i], multipole, r2, periodic))
error("Using m-pole where the test fails");
#endif
}
......
......@@ -43,11 +43,12 @@
* @param r2 The square of the distance between the centres of mass of A and B.
* @param use_rebuild_sizes Are we considering the sizes at the last tree-build
* (1) or current sizes (0)?
* @param periodic Are we using periodic BCs?
*/
__attribute__((nonnull, pure)) INLINE static int gravity_M2L_accept(
const struct gravity_props *props, const struct gravity_tensors *restrict A,
const struct gravity_tensors *restrict B, const float r2,
const int use_rebuild_sizes) {
const int use_rebuild_sizes, const int periodic) {
/* Order of the expansion */
const int p = SELF_GRAVITY_MULTIPOLE_ORDER;
......@@ -144,14 +145,15 @@ __attribute__((nonnull, pure)) INLINE static int gravity_M2L_accept(
* @param r2 The square of the distance between the centres of mass of A and B.
* @param use_rebuild_sizes Are we considering the sizes at the last tree-build
* (1) or current sizes (0)?
* @param periodic Are we using periodic BCs?
*/
__attribute__((nonnull, pure)) INLINE static int gravity_M2L_accept_symmetric(
const struct gravity_props *props, const struct gravity_tensors *restrict A,
const struct gravity_tensors *restrict B, const float r2,
const int use_rebuild_sizes) {
const int use_rebuild_sizes, const int periodic) {
return gravity_M2L_accept(props, A, B, r2, use_rebuild_sizes) &&
gravity_M2L_accept(props, B, A, r2, use_rebuild_sizes);
return gravity_M2L_accept(props, A, B, r2, use_rebuild_sizes, periodic) &&
gravity_M2L_accept(props, B, A, r2, use_rebuild_sizes, periodic);
}
/**
......@@ -164,10 +166,11 @@ __attribute__((nonnull, pure)) INLINE static int gravity_M2L_accept_symmetric(
* @param pa The particle we want to compute forces for (sink)
* @param B The gravity tensors that act as a source.
* @param r2 The square of the distance between pa and the centres of mass of B.
* @param periodic Are we using periodic BCs?
*/
__attribute__((nonnull, pure)) INLINE static int gravity_M2P_accept(
const struct gravity_props *props, const struct gpart *pa,
const struct gravity_tensors *B, const float r2) {
const struct gravity_tensors *B, const float r2, const int periodic) {
/* Order of the expansion */
const int p = SELF_GRAVITY_MULTIPOLE_ORDER;
......
......@@ -1678,7 +1678,7 @@ void runner_dopair_recursive_grav(struct runner *r, struct cell *ci,
/* Can we use M-M interactions ? */
if (gravity_M2L_accept_symmetric(e->gravity_properties, multi_i, multi_j, r2,
/* use_rebuild_sizes=*/0)) {
/* use_rebuild_sizes=*/0, periodic)) {
/* Go M-M */
runner_dopair_grav_mm(r, ci, cj);
......@@ -1906,7 +1906,8 @@ void runner_do_grav_long_range(struct runner *r, struct cell *ci,
/* Are we in charge of this cell pair? */
if (gravity_M2L_accept_symmetric(e->gravity_properties, multi_top, multi_j,
r2_rebuild, /*use_rebuild_sizes=*/1)) {
r2_rebuild, /*use_rebuild_sizes=*/1,
periodic)) {
/* Call the PM interaction fucntion on the active sub-cells of ci */
runner_dopair_grav_mm_nonsym(r, ci, cj);
......
Supports Markdown
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