Commit 6f800b1c authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Use the CoM at rebuild time and not the actual CoM in...

Use the CoM at rebuild time and not the actual CoM in cell_can_use_pair_mm_rebuild() (as the documentation actually suggests....)
parent 17854055
......@@ -3077,6 +3077,9 @@ int cell_can_use_pair_mm(const struct cell *ci, const struct cell *cj,
/**
* @brief Can we use the MM interactions fo a given pair of cells?
*
* This function uses the information gathered in the multipole at rebuild
* time and not the current position and radius of the multipole.
*
* @param ci The first #cell.
* @param cj The second #cell.
* @param e The #engine.
......@@ -3096,32 +3099,32 @@ int cell_can_use_pair_mm_rebuild(const struct cell *ci, const struct cell *cj,
#ifdef SWIFT_DEBUG_CHECKS
if (multi_i->CoM[0] < ci->loc[0] ||
multi_i->CoM[0] > ci->loc[0] + ci->width[0])
if (multi_i->CoM_rebuild[0] < ci->loc[0] ||
multi_i->CoM_rebuild[0] > ci->loc[0] + ci->width[0])
error("Invalid multipole position ci");
if (multi_i->CoM[1] < ci->loc[1] ||
multi_i->CoM[1] > ci->loc[1] + ci->width[1])
if (multi_i->CoM_rebuild[1] < ci->loc[1] ||
multi_i->CoM_rebuild[1] > ci->loc[1] + ci->width[1])
error("Invalid multipole position ci");
if (multi_i->CoM[2] < ci->loc[2] ||
multi_i->CoM[2] > ci->loc[2] + ci->width[2])
if (multi_i->CoM_rebuild[2] < ci->loc[2] ||
multi_i->CoM_rebuild[2] > ci->loc[2] + ci->width[2])
error("Invalid multipole position ci");
if (multi_j->CoM[0] < cj->loc[0] ||
multi_j->CoM[0] > cj->loc[0] + cj->width[0])
if (multi_j->CoM_rebuild[0] < cj->loc[0] ||
multi_j->CoM_rebuild[0] > cj->loc[0] + cj->width[0])
error("Invalid multipole position cj");
if (multi_j->CoM[1] < cj->loc[1] ||
multi_j->CoM[1] > cj->loc[1] + cj->width[1])
if (multi_j->CoM_rebuild[1] < cj->loc[1] ||
multi_j->CoM_rebuild[1] > cj->loc[1] + cj->width[1])
error("Invalid multipole position cj");
if (multi_j->CoM[2] < cj->loc[2] ||
multi_j->CoM[2] > cj->loc[2] + cj->width[2])
if (multi_j->CoM_rebuild[2] < cj->loc[2] ||
multi_j->CoM_rebuild[2] > cj->loc[2] + cj->width[2])
error("Invalid multipole position cj");
#endif
/* Get the distance between the CoMs */
double dx = multi_i->CoM[0] - multi_j->CoM[0];
double dy = multi_i->CoM[1] - multi_j->CoM[1];
double dz = multi_i->CoM[2] - multi_j->CoM[2];
double dx = multi_i->CoM_rebuild[0] - multi_j->CoM_rebuild[0];
double dy = multi_i->CoM_rebuild[1] - multi_j->CoM_rebuild[1];
double dz = multi_i->CoM_rebuild[2] - multi_j->CoM_rebuild[2];
/* Apply BC */
if (periodic) {
......@@ -3131,5 +3134,6 @@ int cell_can_use_pair_mm_rebuild(const struct cell *ci, const struct cell *cj,
}
const double r2 = dx * dx + dy * dy + dz * dz;
return gravity_M2L_accept(multi_i->r_max, multi_j->r_max, theta_crit2, r2);
return gravity_M2L_accept(multi_i->r_max_rebuild, multi_j->r_max_rebuild,
theta_crit2, r2);
}
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