use if constexpr

This commit is contained in:
Arne Morten Kvarving 2021-05-27 14:03:43 +02:00
parent cbd7cfe8b6
commit a128c64a03

View File

@ -874,7 +874,7 @@ public:
updatePffDofData_(); updatePffDofData_();
if (getPropValue<TypeTag, Properties::EnablePolymer>()) { if constexpr (getPropValue<TypeTag, Properties::EnablePolymer>()) {
const auto& vanguard = this->simulator().vanguard(); const auto& vanguard = this->simulator().vanguard();
const auto& gridView = vanguard.gridView(); const auto& gridView = vanguard.gridView();
int numElements = gridView.size(/*codim=*/0); int numElements = gridView.size(/*codim=*/0);
@ -1065,7 +1065,7 @@ public:
if (invalidateIntensiveQuantities) if (invalidateIntensiveQuantities)
this->model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0); this->model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0);
if (getPropValue<TypeTag, Properties::EnablePolymer>()) if constexpr (getPropValue<TypeTag, Properties::EnablePolymer>())
updateMaxPolymerAdsorption_(); updateMaxPolymerAdsorption_();
wellModel_.beginTimeStep(); wellModel_.beginTimeStep();
@ -1101,7 +1101,7 @@ public:
void endTimeStep() void endTimeStep()
{ {
#ifndef NDEBUG #ifndef NDEBUG
if (getPropValue<TypeTag, Properties::EnableDebuggingChecks>()) { if constexpr (getPropValue<TypeTag, Properties::EnableDebuggingChecks>()) {
// in debug mode, we don't care about performance, so we check if the model does // in debug mode, we don't care about performance, so we check if the model does
// the right thing (i.e., the mass change inside the whole reservoir must be // the right thing (i.e., the mass change inside the whole reservoir must be
// equivalent to the fluxes over the grid's boundaries plus the source rates // equivalent to the fluxes over the grid's boundaries plus the source rates
@ -1129,7 +1129,7 @@ public:
for (unsigned globalDofIdx = 0; globalDofIdx < residual.size(); globalDofIdx ++) { for (unsigned globalDofIdx = 0; globalDofIdx < residual.size(); globalDofIdx ++) {
drift_[globalDofIdx] = residual[globalDofIdx]; drift_[globalDofIdx] = residual[globalDofIdx];
drift_[globalDofIdx] *= simulator.timeStepSize(); drift_[globalDofIdx] *= simulator.timeStepSize();
if (getPropValue<TypeTag, Properties::UseVolumetricResidual>()) if constexpr (getPropValue<TypeTag, Properties::UseVolumetricResidual>())
drift_[globalDofIdx] *= this->model().dofTotalVolume(globalDofIdx); drift_[globalDofIdx] *= this->model().dofTotalVolume(globalDofIdx);
} }
} }