move string conversion of WellGasInflowEquation to WellEnums.cpp
This commit is contained in:
@@ -92,8 +92,6 @@ public:
|
||||
using GuideRateTarget = WellGuideRateTarget;
|
||||
|
||||
using GasInflowEquation = WellGasInflowEquation;
|
||||
static const std::string GasInflowEquation2String(GasInflowEquation enumValue);
|
||||
static GasInflowEquation GasInflowEquationFromString(const std::string& stringValue);
|
||||
|
||||
struct WellGuideRate {
|
||||
bool available;
|
||||
|
||||
@@ -119,6 +119,9 @@ WellWELTARGCMode WellWELTARGCModeFromString(const std::string& stringValue);
|
||||
std::string WellGuideRateTarget2String(WellGuideRateTarget enumValue);
|
||||
WellGuideRateTarget WellGuideRateTargetFromString(const std::string& stringValue);
|
||||
|
||||
std::string WellGasInflowEquation2String(WellGasInflowEquation enumValue);
|
||||
WellGasInflowEquation WellGasInflowEquationFromString(const std::string& stringValue);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -954,7 +954,7 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
|
||||
|
||||
const std::string& group = record.getItem<ParserKeywords::WELSPECS::GROUP>().getTrimmedString(0);
|
||||
auto pvt_table = record.getItem<ParserKeywords::WELSPECS::P_TABLE>().get<int>(0);
|
||||
auto gas_inflow = Well::GasInflowEquationFromString( record.getItem<ParserKeywords::WELSPECS::INFLOW_EQ>().get<std::string>(0) );
|
||||
auto gas_inflow = WellGasInflowEquationFromString(record.getItem<ParserKeywords::WELSPECS::INFLOW_EQ>().get<std::string>(0));
|
||||
|
||||
this->addWell(wellName,
|
||||
group,
|
||||
|
||||
@@ -1357,38 +1357,6 @@ Well::GasInflowEquation Well::gas_inflow_equation() const {
|
||||
return this->gas_inflow;
|
||||
}
|
||||
|
||||
const std::string Well::GasInflowEquation2String(GasInflowEquation enumValue) {
|
||||
switch(enumValue) {
|
||||
case GasInflowEquation::STD:
|
||||
return "STD";
|
||||
case GasInflowEquation::R_G:
|
||||
return "R-G";
|
||||
case GasInflowEquation::P_P:
|
||||
return "P-P";
|
||||
case GasInflowEquation::GPP:
|
||||
return "GPP";
|
||||
default:
|
||||
throw std::invalid_argument("Unhandled enum value");
|
||||
}
|
||||
}
|
||||
|
||||
Well::GasInflowEquation Well::GasInflowEquationFromString(const std::string& stringValue) {
|
||||
if (stringValue == "STD" || stringValue == "NO")
|
||||
return GasInflowEquation::STD;
|
||||
|
||||
if (stringValue == "R-G" || stringValue == "YES")
|
||||
return GasInflowEquation::R_G;
|
||||
|
||||
if (stringValue == "P-P")
|
||||
return GasInflowEquation::P_P;
|
||||
|
||||
if (stringValue == "GPP")
|
||||
return GasInflowEquation::GPP;
|
||||
|
||||
throw std::invalid_argument("Gas inflow equation type: " + stringValue + " not recognized");
|
||||
}
|
||||
|
||||
|
||||
bool Well::canOpen() const {
|
||||
if (this->allow_cross_flow)
|
||||
return true;
|
||||
|
||||
@@ -258,4 +258,37 @@ WellGuideRateTarget WellGuideRateTargetFromString(const std::string& stringValue
|
||||
throw std::invalid_argument("Unknown enum state string: " + stringValue );
|
||||
}
|
||||
|
||||
std::string WellGasInflowEquation2String(WellGasInflowEquation enumValue)
|
||||
{
|
||||
switch (enumValue) {
|
||||
case WellGasInflowEquation::STD:
|
||||
return "STD";
|
||||
case WellGasInflowEquation::R_G:
|
||||
return "R-G";
|
||||
case WellGasInflowEquation::P_P:
|
||||
return "P-P";
|
||||
case WellGasInflowEquation::GPP:
|
||||
return "GPP";
|
||||
default:
|
||||
throw std::invalid_argument("Unhandled enum value");
|
||||
}
|
||||
}
|
||||
|
||||
WellGasInflowEquation WellGasInflowEquationFromString(const std::string& stringValue)
|
||||
{
|
||||
if (stringValue == "STD" || stringValue == "NO")
|
||||
return WellGasInflowEquation::STD;
|
||||
|
||||
if (stringValue == "R-G" || stringValue == "YES")
|
||||
return WellGasInflowEquation::R_G;
|
||||
|
||||
if (stringValue == "P-P")
|
||||
return WellGasInflowEquation::P_P;
|
||||
|
||||
if (stringValue == "GPP")
|
||||
return WellGasInflowEquation::GPP;
|
||||
|
||||
throw std::invalid_argument("Gas inflow equation type: " + stringValue + " not recognized");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ namespace {
|
||||
}
|
||||
|
||||
std::string gas_inflow(const context&, std::size_t, std::size_t) const {
|
||||
return Opm::Well::GasInflowEquation2String( well.gas_inflow_equation() );
|
||||
return Opm::WellGasInflowEquation2String(well.gas_inflow_equation());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user