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
......@@ -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;
#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.");
/* Check that particles have been drifted to the current time */
......@@ -329,7 +329,8 @@ static INLINE void runner_dopair_grav_pp_truncated(
const float r2 = dx * dx + dy * dy + dz * dz;
#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 */
if (gparts_i[pid].ti_drift != e->ti_current)
......@@ -724,7 +725,8 @@ static INLINE void runner_doself_grav_pp_full(struct runner *r,
const float r2 = dx * dx + dy * dy + dz * dz;
#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 */
if (gparts[pid].ti_drift != e->ti_current)
......@@ -854,7 +856,8 @@ static INLINE void runner_doself_grav_pp_truncated(struct runner *r,
const float r2 = dx * dx + dy * dy + dz * dz;
#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 */
if (gparts[pid].ti_drift != e->ti_current)
......
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