ResolutionShells: Don't allow zero resolution (calculating 1/d^2 gives NaN)

This commit is contained in:
2026-04-15 10:43:53 +02:00
parent 2b13bfaa1d
commit 7dad178d86
+4 -2
View File
@@ -12,8 +12,10 @@ ResolutionShells::ResolutionShells(float d_min, float d_max, int32_t nshells)
one_over_dmin2(1 / (d_min * d_min)),
one_over_dmax2(1 / (d_max * d_max)),
nshells(nshells) {
if (d_min >= d_max || d_min < 0)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Wrong resolution range");
if (d_min <= 0)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Resolution must be above zero");
if (d_min >= d_max)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Reversed resolution bounds");
if (nshells <= 0)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,