diff --git a/src/runner_doiact_functions_hydro.h b/src/runner_doiact_functions_hydro.h index 30423d3956ccd0ecb7724b6dd9ab06fe70e6942a..1aaf13a2c3a023c1aa13e9875680cb1722e86cf1 100644 --- a/src/runner_doiact_functions_hydro.h +++ b/src/runner_doiact_functions_hydro.h @@ -1337,6 +1337,15 @@ void DOPAIR1_BRANCH(struct runner *r, struct cell *ci, struct cell *cj, double shift[3] = {0.0, 0.0, 0.0}; const int sid = space_getsid(e->s, &ci, &cj, shift); + /* Have the cells been sorted? */ + if (!(ci->hydro.sorted & (1 << sid)) || + ci->hydro.dx_max_sort_old > space_maxreldx * ci->dmin) + error("Interacting unsorted cells (ci)."); + + if (!(cj->hydro.sorted & (1 << sid)) || + cj->hydro.dx_max_sort_old > space_maxreldx * cj->dmin) + error("Interacting unsorted cells (cj)."); + #if defined(SWIFT_USE_NAIVE_INTERACTIONS) DOPAIR1_NAIVE(r, ci, cj, limit_min_h, limit_max_h); #elif defined(WITH_VECTORIZATION) && defined(GADGET2_SPH) && \ @@ -1927,6 +1936,15 @@ void DOPAIR2_BRANCH(struct runner *r, struct cell *ci, struct cell *cj, double shift[3] = {0.0, 0.0, 0.0}; const int sid = space_getsid(e->s, &ci, &cj, shift); + /* Have the cells been sorted? */ + if (!(ci->hydro.sorted & (1 << sid)) || + ci->hydro.dx_max_sort_old > space_maxreldx * ci->dmin) + error("Interacting unsorted cells (ci)."); + + if (!(cj->hydro.sorted & (1 << sid)) || + cj->hydro.dx_max_sort_old > space_maxreldx * cj->dmin) + error("Interacting unsorted cells (cj)."); + #ifdef SWIFT_USE_NAIVE_INTERACTIONS DOPAIR2_NAIVE(r, ci, cj, limit_min_h, limit_max_h); #elif defined(WITH_VECTORIZATION) && defined(GADGET2_SPH) && \ diff --git a/src/runner_doiact_functions_limiter.h b/src/runner_doiact_functions_limiter.h index 1975f318c322e472ac2972f80023a02577400b75..0fd7710d6fe11fdc2d88f7eba73756a603270460 100644 --- a/src/runner_doiact_functions_limiter.h +++ b/src/runner_doiact_functions_limiter.h @@ -516,6 +516,15 @@ void DOPAIR1_BRANCH(struct runner *r, struct cell *ci, struct cell *cj, double shift[3] = {0.0, 0.0, 0.0}; const int sid = space_getsid(e->s, &ci, &cj, shift); + /* Have the cells been sorted? */ + if (!(ci->hydro.sorted & (1 << sid)) || + ci->hydro.dx_max_sort_old > space_maxreldx * ci->dmin) + error("Interacting unsorted cells (ci)."); + + if (!(cj->hydro.sorted & (1 << sid)) || + cj->hydro.dx_max_sort_old > space_maxreldx * cj->dmin) + error("Interacting unsorted cells (cj)."); + #if defined(SWIFT_USE_NAIVE_INTERACTIONS) DOPAIR1_NAIVE(r, ci, cj, limit_min_h, limit_max_h); #else