remove ElemType and zero()

This commit is contained in:
Tor Harald Sandve 2021-05-19 09:00:50 +02:00
parent 93237ec345
commit ce5e3ac075

View File

@ -31,20 +31,6 @@
#include <stdexcept>
#include <type_traits>
namespace
{
template <typename ElemType>
ElemType zero()
{
// This is for Evaluation types.
ElemType x;
x = 0.0;
return x;
}
}
namespace Opm
{
@ -66,9 +52,6 @@ TargetCalculator::TargetCalculator(const Group::ProductionCMode cmode,
template <typename RateType>
RateType TargetCalculator::calcModeRateFromRates(const RateType* rates) const
{
// ElemType is just the plain element type of the rates container,
// without any reference, const or volatile modifiers.
using ElemType = std::remove_cv_t<std::remove_reference_t<decltype(rates[0])>>;
switch (cmode_) {
case Group::ProductionCMode::ORAT: {
assert(pu_.phase_used[BlackoilPhases::Liquid]);
@ -93,7 +76,7 @@ RateType TargetCalculator::calcModeRateFromRates(const RateType* rates) const
return rates[opos] + rates[wpos];
}
case Group::ProductionCMode::RESV: {
ElemType mode_rate = rates[0] * resv_coeff_[0];
auto mode_rate = rates[0] * resv_coeff_[0];
for (int phase = 1; phase < pu_.num_phases; ++phase) {
mode_rate += rates[phase] * resv_coeff_[phase];
}
@ -102,7 +85,7 @@ RateType TargetCalculator::calcModeRateFromRates(const RateType* rates) const
default:
// Should never be here.
assert(false);
return zero<ElemType>();
return rates[0];
}
}