Surface Density: Explicitly Recognise Failure Path

Use the "throw if invalid phase" approach.
This commit is contained in:
Bård Skaflestad 2018-11-13 22:22:16 +01:00
parent 32eb83712f
commit 3d5dca4693

View File

@ -385,7 +385,8 @@ namespace Opm
};
}
double ECLFluxCalc::surfaceDensity(const ECLPhaseIndex phase) const{
double ECLFluxCalc::surfaceDensity(const ECLPhaseIndex phase) const
{
switch (phase) {
case ECLPhaseIndex::Aqua:
return this->pvtWat_->surfaceMassDensity(0);
@ -396,6 +397,11 @@ namespace Opm
case ECLPhaseIndex::Vapour:
return this->pvtGas_->surfaceMassDensity(0);
}
throw std::invalid_argument {
"Unsupported Phase Index " +
std::to_string(static_cast<std::size_t>(phase))
};
}