Unverified Commit 3186aebb authored by Gagik Vardanyan's avatar Gagik Vardanyan Committed by GitHub
Browse files

Merge pull request #32518 from mantidproject/remove_assert_difc_greater_zero_in_unit

Remove assertion difc greater than zero in unit conversion
parents c282f103 70b10d43
......@@ -596,12 +596,7 @@ Unit *dSpacing::clone() const { return new dSpacing(*this); }
void dSpacing::validateUnitParams(const int, const UnitParametersMap &params) {
double difc = 0.;
if (!ParamPresentAndSet(&params, UnitParams::difc, difc)) {
if (!ParamPresent(params, UnitParams::twoTheta) || (!ParamPresent(params, UnitParams::l2)))
throw std::runtime_error("A difc value or L2/two theta must be supplied "
"in the extra parameters when initialising " +
this->unitID() + " for conversion via TOF");
} else {
if (ParamPresentAndSet(&params, UnitParams::difc, difc)) {
// check validations only applicable to fromTOF
toDSpacingError = "";
double difa = 0.;
......@@ -615,6 +610,12 @@ void dSpacing::validateUnitParams(const int, const UnitParametersMap &params) {
"initialising " +
this->unitID() + " for conversion via TOF";
}
} else {
if (!ParamPresent(params, UnitParams::twoTheta) || (!ParamPresent(params, UnitParams::l2))) {
throw std::runtime_error("A difc value or L2/two theta must be supplied "
"in the extra parameters when initialising " +
this->unitID() + " for conversion via TOF");
}
}
}
......@@ -644,8 +645,6 @@ void dSpacing::init() {
}
}
}
// force the assumption that difc is positive in debug builds
assert(difc > 0.);
}
double dSpacing::singleToTOF(const double x) const {
......@@ -682,9 +681,6 @@ double dSpacing::singleFromTOF(const double tof) const {
if (!toDSpacingError.empty())
throw std::runtime_error(toDSpacingError);
// force the assumption that difc is positive in debug builds
assert(difc > 0.);
// non-physical result
if (tzero > tof) {
if (difa > 0.) {
......
Markdown is supported
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