changed: make has_polymer contexpr

and use if constexpr to eliminate some code
This commit is contained in:
Arne Morten Kvarving
2021-05-11 12:28:10 +02:00
parent a78c7e598d
commit 73ccb42634
2 changed files with 13 additions and 13 deletions

View File

@@ -109,7 +109,7 @@ namespace Opm
static constexpr bool has_solvent = getPropValue<TypeTag, Properties::EnableSolvent>();
static constexpr bool has_zFraction = getPropValue<TypeTag, Properties::EnableExtbo>();
static const bool has_polymer = getPropValue<TypeTag, Properties::EnablePolymer>();
static constexpr bool has_polymer = getPropValue<TypeTag, Properties::EnablePolymer>();
static const bool has_energy = getPropValue<TypeTag, Properties::EnableEnergy>();
static const bool has_temperature = getPropValue<TypeTag, Properties::EnableTemperature>();
// flag for polymer molecular weight related

View File

@@ -375,20 +375,20 @@ namespace Opm
WellInterface<TypeTag>::
wpolymer() const
{
if (!has_polymer) {
return 0.0;
if constexpr (has_polymer) {
auto injectorType = well_ecl_.injectorType();
if (injectorType == InjectorType::WATER) {
WellPolymerProperties polymer = well_ecl_.getPolymerProperties();
const double polymer_injection_concentration = polymer.m_polymerConcentration;
return polymer_injection_concentration;
} else {
// Not a water injection well => no polymer.
return 0.0;
}
}
auto injectorType = well_ecl_.injectorType();
if (injectorType == InjectorType::WATER) {
WellPolymerProperties polymer = well_ecl_.getPolymerProperties();
const double polymer_injection_concentration = polymer.m_polymerConcentration;
return polymer_injection_concentration;
} else {
// Not a water injection well => no polymer.
return 0.0;
}
return 0.0;
}