Add enum to string functions.

This commit is contained in:
Liu Ming 2016-05-20 16:13:37 +08:00
parent 9979c505b3
commit 8c573d4ef1
4 changed files with 178 additions and 1 deletions

View File

@ -18,4 +18,80 @@ namespace Opm
} }
const std::string
InjectionSpecification::ControlMode2String(const ControlMode& mode)
{
std::string stringValue;
switch(mode) {
case ControlMode::NONE:
stringValue = "NONE";
break;
case ControlMode::RATE:
stringValue = "RATE";
break;
case ControlMode::RESV:
stringValue = "RESV";
break;
case ControlMode::BHP:
stringValue = "BHP";
break;
case ControlMode::THP:
stringValue = "THP";
break;
case ControlMode::REIN:
stringValue = "REIN";
break;
case ControlMode::VREP:
stringValue = "VREP";
break;
case ControlMode::GRUP:
stringValue = "GRUP";
break;
case ControlMode::FLD:
stringValue = "FLD";
break;
}
return stringValue;
}
const std::string
InjectionSpecification::InjectorType2String(const InjectorType& type)
{
std::string stringValue;
switch(type) {
case InjectorType::WATER:
stringValue = "WATER";
break;
case InjectorType::OIL:
stringValue = "OIL";
break;
case InjectorType::GAS:
stringValue = "GAS";
break;
}
return stringValue;
}
const std::string
InjectionSpecification::GuideRateType2String(const GuideRateType& type)
{
std::string stringValue;
switch(type) {
case GuideRateType::RAT:
stringValue = "RAT";
break;
case GuideRateType::NONE_GRT:
stringValue = "NONE_GRT";
break;
}
return stringValue;
}
} // namespace Opm } // namespace Opm

View File

@ -2,6 +2,7 @@
#define OPM_INJECTORSPECIFICATION_HPP #define OPM_INJECTORSPECIFICATION_HPP
#include <opm/core/wells.h> #include <opm/core/wells.h>
#include <string>
namespace Opm namespace Opm
{ {
@ -25,7 +26,9 @@ namespace Opm
}; };
InjectionSpecification(); InjectionSpecification();
const std::string ControlMode2String(const ControlMode& mode);
const std::string InjectorType2String(const InjectorType& type);
const std::string GuideRateType2String(const GuideRateType& type);
InjectorType injector_type_; InjectorType injector_type_;
ControlMode control_mode_; ControlMode control_mode_;
double surface_flow_max_rate_; double surface_flow_max_rate_;

View File

@ -19,4 +19,98 @@ namespace Opm
{ {
} }
const std::string
ProductionSpecification::ControlMode2String(const ControlMode& mode)
{
std::string stringValue;
switch(mode) {
case ControlMode::NONE:
stringValue = "NONE";
break;
case ControlMode::ORAT:
stringValue = "ORAT";
break;
case ControlMode::WRAT:
stringValue = "WRAT";
break;
case ControlMode::GRAT:
stringValue = "GRAT";
break;
case ControlMode::LRAT:
stringValue = "LRAT";
break;
case ControlMode::CRAT:
stringValue = "CRAT";
break;
case ControlMode::RESV:
stringValue = "RESV";
break;
case ControlMode::PRBL:
stringValue = "RPBL";
break;
case ControlMode::BHP:
stringValue = "BHP";
break;
case ControlMode::THP:
stringValue = "THP";
break;
case ControlMode::GRUP:
stringValue = "GRUP";
break;
case ControlMode::FLD:
stringValue = "FLD";
break;
}
return stringValue;
}
const std::string
ProductionSpecification::Procedure2String(const Procedure& type)
{
std::string stringValue;
switch(type) {
case Procedure::NONE_P:
stringValue = "NONE_P";
break;
case Procedure::RATE:
stringValue = "RATE";
break;
case Procedure::WELL:
stringValue = "WELL";
break;
}
return stringValue;
}
const std::string
ProductionSpecification::GuideRateType2String(const GuideRateType& type)
{
std::string stringValue;
switch(type) {
case GuideRateType::OIL:
stringValue = "OIL";
break;
case GuideRateType::GAS:
stringValue = "GAS";
break;
case GuideRateType::WATER:
stringValue = "WATER";
break;
case GuideRateType::NONE_GRT:
stringValue = "NONE_GRT";
break;
}
return stringValue;
}
} }

View File

@ -2,6 +2,7 @@
#define OPM_PRODUCTIONSPECIFICATION_HPP #define OPM_PRODUCTIONSPECIFICATION_HPP
#include <opm/core/wells.h> #include <opm/core/wells.h>
#include <string>
namespace Opm namespace Opm
{ {
@ -25,6 +26,9 @@ namespace Opm
}; };
ProductionSpecification(); ProductionSpecification();
const std::string ControlMode2String(const ControlMode& mode);
const std::string Procedure2String(const Procedure& type);
const std::string GuideRateType2String(const GuideRateType& type);
ControlMode control_mode_; ControlMode control_mode_;
Procedure procedure_; Procedure procedure_;