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

When rebuilding in non-periodic world, do crash if a particle is out of the box.

parent 5742dedb
No related branches found
No related tags found
1 merge request!703Non periodic BCs: Correct particle treatment
...@@ -1757,6 +1757,17 @@ void space_parts_get_cell_index_mapper(void *map_data, int nr_parts, ...@@ -1757,6 +1757,17 @@ void space_parts_get_cell_index_mapper(void *map_data, int nr_parts,
const double old_pos_y = p->x[1]; const double old_pos_y = p->x[1];
const double old_pos_z = p->x[2]; const double old_pos_z = p->x[2];
#ifdef SWIFT_DEBUG_CHECKS
if (!s->periodic) {
if (old_pos_x < 0. || old_pos_x > dim_x)
error("Particle outside of volume along X.");
if (old_pos_y < 0. || old_pos_y > dim_y)
error("Particle outside of volume along Y.");
if (old_pos_z < 0. || old_pos_z > dim_z)
error("Particle outside of volume along Z.");
}
#endif
/* Put it back into the simulation volume */ /* Put it back into the simulation volume */
const double pos_x = box_wrap(old_pos_x, 0.0, dim_x); const double pos_x = box_wrap(old_pos_x, 0.0, dim_x);
const double pos_y = box_wrap(old_pos_y, 0.0, dim_y); const double pos_y = box_wrap(old_pos_y, 0.0, dim_y);
...@@ -1864,6 +1875,17 @@ void space_gparts_get_cell_index_mapper(void *map_data, int nr_gparts, ...@@ -1864,6 +1875,17 @@ void space_gparts_get_cell_index_mapper(void *map_data, int nr_gparts,
const double old_pos_y = gp->x[1]; const double old_pos_y = gp->x[1];
const double old_pos_z = gp->x[2]; const double old_pos_z = gp->x[2];
#ifdef SWIFT_DEBUG_CHECKS
if (!s->periodic) {
if (old_pos_x < 0. || old_pos_x > dim_x)
error("Particle outside of volume along X.");
if (old_pos_y < 0. || old_pos_y > dim_y)
error("Particle outside of volume along Y.");
if (old_pos_z < 0. || old_pos_z > dim_z)
error("Particle outside of volume along Z.");
}
#endif
/* Put it back into the simulation volume */ /* Put it back into the simulation volume */
const double pos_x = box_wrap(old_pos_x, 0.0, dim_x); const double pos_x = box_wrap(old_pos_x, 0.0, dim_x);
const double pos_y = box_wrap(old_pos_y, 0.0, dim_y); const double pos_y = box_wrap(old_pos_y, 0.0, dim_y);
...@@ -1977,6 +1999,17 @@ void space_sparts_get_cell_index_mapper(void *map_data, int nr_sparts, ...@@ -1977,6 +1999,17 @@ void space_sparts_get_cell_index_mapper(void *map_data, int nr_sparts,
const double old_pos_y = sp->x[1]; const double old_pos_y = sp->x[1];
const double old_pos_z = sp->x[2]; const double old_pos_z = sp->x[2];
#ifdef SWIFT_DEBUG_CHECKS
if (!s->periodic) {
if (old_pos_x < 0. || old_pos_x > dim_x)
error("Particle outside of volume along X.");
if (old_pos_y < 0. || old_pos_y > dim_y)
error("Particle outside of volume along Y.");
if (old_pos_z < 0. || old_pos_z > dim_z)
error("Particle outside of volume along Z.");
}
#endif
/* Put it back into the simulation volume */ /* Put it back into the simulation volume */
const double pos_x = box_wrap(old_pos_x, 0.0, dim_x); const double pos_x = box_wrap(old_pos_x, 0.0, dim_x);
const double pos_y = box_wrap(old_pos_y, 0.0, dim_y); const double pos_y = box_wrap(old_pos_y, 0.0, dim_y);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment