make has_energy constexpr and use if constexpr to eliminate code

This commit is contained in:
Arne Morten Kvarving 2021-05-14 21:49:47 +02:00
parent 268201eeb1
commit db668e8d80
3 changed files with 4 additions and 4 deletions

View File

@ -69,7 +69,7 @@ namespace Opm
OPM_THROW(std::runtime_error, "polymer is not supported by multisegment well yet");
}
if (Base::has_energy) {
if constexpr (Base::has_energy) {
OPM_THROW(std::runtime_error, "energy is not supported by multisegment well yet");
}

View File

@ -722,11 +722,11 @@ namespace Opm
well_state.wellVaporizedOilRates()[index_of_well_] += perf_vap_oil_rate;
}
if (has_energy) {
if constexpr (has_energy) {
connectionRates[perf][contiEnergyEqIdx] = 0.0;
}
if (has_energy) {
if constexpr (has_energy) {
auto fs = intQuants.fluidState();
for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) {

View File

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