simplify the implementation.

This commit is contained in:
Liu Ming 2016-05-23 10:48:51 +08:00
parent 407c7223f6
commit ca030efeb9
5 changed files with 53 additions and 143 deletions

View File

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

View File

@ -26,9 +26,9 @@ namespace Opm
};
InjectionSpecification();
const std::string ControlMode2String(const ControlMode& mode);
const std::string InjectorType2String(const InjectorType& type);
const std::string GuideRateType2String(const GuideRateType& type);
std::string toString(const ControlMode& mode);
std::string toString(const InjectorType& type);
std::string toString(const GuideRateType& type);
InjectorType injector_type_;
ControlMode control_mode_;
double surface_flow_max_rate_;

View File

@ -20,96 +20,46 @@ namespace Opm
}
const std::string
ProductionSpecification::ControlMode2String(const ControlMode& mode)
std::string
ProductionSpecification::toString(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;
case ControlMode::NONE: return "NONE";
case ControlMode::ORAT: return "ORAT";
case ControlMode::WRAT: return "WRAT";
case ControlMode::GRAT: return "GRAT";
case ControlMode::LRAT: return "LRAT";
case ControlMode::CRAT: return "CRAT";
case ControlMode::RESV: return "RESV";
case ControlMode::PRBL: return "RPBL";
case ControlMode::BHP : return "BHP" ;
case ControlMode::THP : return "THP" ;
case ControlMode::GRUP: return "GRUP";
case ControlMode::FLD : return "FLD" ;
}
return stringValue;
}
const std::string
ProductionSpecification::Procedure2String(const Procedure& type)
std::string
ProductionSpecification::toString(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;
case Procedure::NONE_P: return "NONE_P";
case Procedure::RATE : return "RATE" ;
case Procedure::WELL : return "WELL" ;
}
return stringValue;
}
const std::string
ProductionSpecification::GuideRateType2String(const GuideRateType& type)
std::string
ProductionSpecification::toString(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;
case GuideRateType::OIL : return "OIL" ;
case GuideRateType::GAS : return "GAS" ;
case GuideRateType::WATER : return "WATER" ;
case GuideRateType::NONE_GRT: return "NONE_GRT";
}
return stringValue;
}

View File

@ -26,9 +26,9 @@ namespace Opm
};
ProductionSpecification();
const std::string ControlMode2String(const ControlMode& mode);
const std::string Procedure2String(const Procedure& type);
const std::string GuideRateType2String(const GuideRateType& type);
std::string toString(const ControlMode& mode);
std::string toString(const Procedure& type);
std::string toString(const GuideRateType& type);
ControlMode control_mode_;
Procedure procedure_;

View File

@ -345,7 +345,7 @@ namespace Opm
mode);
if (my_rate > target_rate) {
OpmLog::warning("Group " + injSpec().ControlMode2String(mode)
OpmLog::warning("Group " + injSpec().toString(mode)
+ " target not met for group " + name() + "\n"
+ "target = " + std::to_string(target_rate) + "\n"
+ "rate = " + std::to_string(my_rate));
@ -378,7 +378,7 @@ namespace Opm
child_phases_summed.surf_prod_rates,
mode);
if (std::fabs(my_rate) > target_rate) {
OpmLog::warning("Group" + prodSpec().ControlMode2String(mode)
OpmLog::warning("Group" + prodSpec().toString(mode)
+ " target not met for group " + name() + "\n"
+ "target = " + std::to_string(target_rate) + '\n'
+ "rate = " + std::to_string(my_rate));