changed: this is known on compile time

use info to disable code
This commit is contained in:
Arne Morten Kvarving 2021-01-28 14:33:21 +01:00
parent 2a5d908c2e
commit 9b74b5dfac
2 changed files with 5 additions and 9 deletions

View File

@ -106,6 +106,8 @@ namespace Opm {
static const int numEq = Indices::numEq;
static const int solventSaturationIdx = Indices::solventSaturationIdx;
static constexpr bool has_solvent_ = getPropValue<TypeTag, Properties::EnableSolvent>();
static constexpr bool has_polymer_ = getPropValue<TypeTag, Properties::EnablePolymer>();
// TODO: where we should put these types, WellInterface or Well Model?
// or there is some other strategy, like TypeTag
@ -315,9 +317,6 @@ namespace Opm {
const ModelParameters param_;
bool terminal_output_;
bool has_solvent_;
bool has_zFraction_;
bool has_polymer_;
std::vector<int> pvt_region_idx_;
PhaseUsage phase_usage_;
size_t global_num_cells_;

View File

@ -34,9 +34,6 @@ namespace Opm {
BlackoilWellModel<TypeTag>::
BlackoilWellModel(Simulator& ebosSimulator)
: ebosSimulator_(ebosSimulator)
, has_solvent_(getPropValue<TypeTag, Properties::EnableSolvent>())
, has_zFraction_(getPropValue<TypeTag, Properties::EnableExtbo>())
, has_polymer_(getPropValue<TypeTag, Properties::EnablePolymer>())
{
terminal_output_ = false;
if (ebosSimulator.gridView().comm().rank() == 0)
@ -359,7 +356,7 @@ namespace Opm {
// calculate the efficiency factors for each well
calculateEfficiencyFactors(reportStepIdx);
if (has_polymer_)
if constexpr (has_polymer_)
{
if (PolymerModule::hasPlyshlog() || getPropValue<TypeTag, Properties::EnablePolymerMW>() ) {
setRepRadiusPerfLength();
@ -1620,7 +1617,7 @@ namespace Opm {
B += 1 / fs.invB(phaseIdx).value();
}
if (has_solvent_) {
if constexpr (has_solvent_) {
auto& B = B_avg[solventSaturationIdx];
B += 1 / intQuants.solventInverseFormationVolumeFactor().value();
}
@ -1672,7 +1669,7 @@ namespace Opm {
return numPhases();
}
int numComp = FluidSystem::numComponents;
if (has_solvent_) {
if constexpr (has_solvent_) {
numComp ++;
}