changed: make has_solvent and has_zFraction constexpr

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 dc8bbc9e5a
commit a78c7e598d
2 changed files with 8 additions and 6 deletions

View File

@ -107,8 +107,8 @@ namespace Opm
typedef Dune::BlockVector<VectorBlockType> BVector;
typedef DenseAd::Evaluation<double, /*size=*/numEq> Eval;
static const bool has_solvent = getPropValue<TypeTag, Properties::EnableSolvent>();
static const bool has_zFraction = getPropValue<TypeTag, Properties::EnableExtbo>();
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 const bool has_energy = getPropValue<TypeTag, Properties::EnableEnergy>();
static const bool has_temperature = getPropValue<TypeTag, Properties::EnableTemperature>();

View File

@ -97,10 +97,12 @@ namespace Opm
wsolvent_ = 0.0;
if ((has_solvent || has_zFraction) && well.isInjector()) {
auto injectorType = well_ecl_.injectorType();
if (injectorType == InjectorType::GAS) {
wsolvent_ = well_ecl_.getSolventFraction();
if constexpr (has_solvent || has_zFraction) {
if (well.isInjector()) {
auto injectorType = well_ecl_.injectorType();
if (injectorType == InjectorType::GAS) {
wsolvent_ = well_ecl_.getSolventFraction();
}
}
}
}