41 double Units::convert(
const double val,
const std::string &unit_s,
const std::string &unit_type_s)
43 auto unit = units::unit_from_string(unit_s);
44 auto unit_type = units::unit_from_string(unit_type_s);
45 if (!unit.is_convertible(unit_type))
47 log_and_throw_error(fmt::format(
"Cannot convert {} to {}", units::to_string(unit), units::to_string(unit_type)));
50 return units::convert(
val, unit, unit_type);