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

Better error messages for the case where the distance is 0 between two gparts....

Better error messages for the case where the distance is 0 between two gparts. Only crash if the softening is also 0.
parent aeb68375
No related branches found
No related tags found
No related merge requests found
...@@ -234,7 +234,7 @@ static INLINE void runner_dopair_grav_pp_full(const struct engine *e, ...@@ -234,7 +234,7 @@ static INLINE void runner_dopair_grav_pp_full(const struct engine *e,
const float r2 = dx * dx + dy * dy + dz * dz; const float r2 = dx * dx + dy * dy + dz * dz;
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (r2 == 0.f && h_i == 0.) if (r2 == 0.f && h2_i == 0.)
error("Interacting particles with 0 distance and 0 softening."); error("Interacting particles with 0 distance and 0 softening.");
/* Check that particles have been drifted to the current time */ /* Check that particles have been drifted to the current time */
...@@ -329,7 +329,8 @@ static INLINE void runner_dopair_grav_pp_truncated( ...@@ -329,7 +329,8 @@ static INLINE void runner_dopair_grav_pp_truncated(
const float r2 = dx * dx + dy * dy + dz * dz; const float r2 = dx * dx + dy * dy + dz * dz;
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (r2 == 0.f) error("Interacting particles with 0 distance"); if (r2 == 0.f && h2_i == 0.)
error("Interacting particles with 0 distance and 0 softening.");
/* Check that particles have been drifted to the current time */ /* Check that particles have been drifted to the current time */
if (gparts_i[pid].ti_drift != e->ti_current) if (gparts_i[pid].ti_drift != e->ti_current)
...@@ -724,7 +725,8 @@ static INLINE void runner_doself_grav_pp_full(struct runner *r, ...@@ -724,7 +725,8 @@ static INLINE void runner_doself_grav_pp_full(struct runner *r,
const float r2 = dx * dx + dy * dy + dz * dz; const float r2 = dx * dx + dy * dy + dz * dz;
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (r2 == 0.f) error("Interacting particles with 0 distance"); if (r2 == 0.f && h2_i == 0.)
error("Interacting particles with 0 distance and 0 softening.");
/* Check that particles have been drifted to the current time */ /* Check that particles have been drifted to the current time */
if (gparts[pid].ti_drift != e->ti_current) if (gparts[pid].ti_drift != e->ti_current)
...@@ -854,7 +856,8 @@ static INLINE void runner_doself_grav_pp_truncated(struct runner *r, ...@@ -854,7 +856,8 @@ static INLINE void runner_doself_grav_pp_truncated(struct runner *r,
const float r2 = dx * dx + dy * dy + dz * dz; const float r2 = dx * dx + dy * dy + dz * dz;
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (r2 == 0.f) error("Interacting particles with 0 distance"); if (r2 == 0.f && h2_i == 0.)
error("Interacting particles with 0 distance and 0 softening.");
/* Check that particles have been drifted to the current time */ /* Check that particles have been drifted to the current time */
if (gparts[pid].ti_drift != e->ti_current) if (gparts[pid].ti_drift != e->ti_current)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment