diff --git a/framework/src/postprocessors/ExtremeValueBase.C b/framework/src/postprocessors/ExtremeValueBase.C index 07920be9a9cd..39d230f4a852 100644 --- a/framework/src/postprocessors/ExtremeValueBase.C +++ b/framework/src/postprocessors/ExtremeValueBase.C @@ -41,18 +41,12 @@ template void ExtremeValueBase::initialize() { - switch (_type) - { - case ExtremeType::MAX: - _proxy_value = - std::make_pair(-std::numeric_limits::max(), -std::numeric_limits::max()); - break; - - case ExtremeType::MIN: - _proxy_value = - std::make_pair(std::numeric_limits::max(), std::numeric_limits::max()); - break; - } + if (_type == ExtremeType::MAX) + _proxy_value = + std::make_pair(-std::numeric_limits::max(), -std::numeric_limits::max()); + else if (_type == ExtremeType::MIN) + _proxy_value = + std::make_pair(std::numeric_limits::max(), std::numeric_limits::max()); } template @@ -60,18 +54,10 @@ void ExtremeValueBase::computeExtremeValue() { const auto pv = getProxyValuePair(); - switch (_type) - { - case ExtremeType::MAX: - if (pv > _proxy_value) - _proxy_value = pv; - break; - case ExtremeType::MIN: - if (pv < _proxy_value) - _proxy_value = pv; - break; - } + if ((_type == ExtremeType::MAX && pv > _proxy_value) || + (_type == ExtremeType::MIN && pv < _proxy_value)) + _proxy_value = pv; } template @@ -85,26 +71,19 @@ template void ExtremeValueBase::finalize() { - switch (_type) + if (_type == ExtremeType::MAX) { - case ExtremeType::MAX: - if (_use_proxy) - this->gatherProxyValueMax(_proxy_value.first, _proxy_value.second); - else - { - this->gatherMax(_proxy_value.first); - _proxy_value.second = _proxy_value.first; - } - break; - case ExtremeType::MIN: - if (_use_proxy) - this->gatherProxyValueMin(_proxy_value.first, _proxy_value.second); - else - { - this->gatherMin(_proxy_value.first); - _proxy_value.second = _proxy_value.first; - } - break; + if (_use_proxy) + this->gatherProxyValueMax(_proxy_value.first, _proxy_value.second); + else + this->gatherMax(_proxy_value.second); + } + else if (_type == ExtremeType::MIN) + { + if (_use_proxy) + this->gatherProxyValueMin(_proxy_value.first, _proxy_value.second); + else + this->gatherMin(_proxy_value.second); } } @@ -114,17 +93,9 @@ ExtremeValueBase::threadJoin(const UserObject & y) { const auto & pps = static_cast &>(y); - switch (_type) - { - case ExtremeType::MAX: - if (pps._proxy_value > _proxy_value) - _proxy_value = pps._proxy_value; - break; - case ExtremeType::MIN: - if (pps._proxy_value < _proxy_value) - _proxy_value = pps._proxy_value; - break; - } + if ((_type == ExtremeType::MAX && pps._proxy_value > _proxy_value) || + (_type == ExtremeType::MIN && pps._proxy_value < _proxy_value)) + _proxy_value = pps._proxy_value; } template class ExtremeValueBase;