2013-11-06 16:19:48 +01:00
|
|
|
/*
|
|
|
|
|
Copyright 2013 Statoil ASA.
|
|
|
|
|
|
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
|
|
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
|
|
|
|
|
|
|
|
|
namespace Opm {
|
|
|
|
|
|
2015-01-12 10:58:30 +01:00
|
|
|
namespace WellCompletion {
|
|
|
|
|
|
|
|
|
|
std::string
|
|
|
|
|
DirectionEnum2String(const DirectionEnum enumValue)
|
|
|
|
|
{
|
|
|
|
|
std::string stringValue;
|
|
|
|
|
|
|
|
|
|
switch (enumValue) {
|
|
|
|
|
case DirectionEnum::X:
|
|
|
|
|
stringValue = "X";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DirectionEnum::Y:
|
|
|
|
|
stringValue = "Y";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DirectionEnum::Z:
|
|
|
|
|
stringValue = "Z";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return stringValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DirectionEnum
|
2016-08-05 12:34:08 +02:00
|
|
|
DirectionEnumFromString(const std::string& s )
|
2015-01-12 10:58:30 +01:00
|
|
|
{
|
|
|
|
|
DirectionEnum direction;
|
|
|
|
|
|
|
|
|
|
if (s == "X") { direction = DirectionEnum::X; }
|
|
|
|
|
else if (s == "Y") { direction = DirectionEnum::Y; }
|
|
|
|
|
else if (s == "Z") { direction = DirectionEnum::Z; }
|
|
|
|
|
else {
|
|
|
|
|
std::string msg = "Unsupported completion direction " + s;
|
|
|
|
|
throw std::invalid_argument(msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return direction;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const std::string StateEnum2String( StateEnum enumValue ) {
|
|
|
|
|
switch( enumValue ) {
|
|
|
|
|
case OPEN:
|
|
|
|
|
return "OPEN";
|
|
|
|
|
case AUTO:
|
|
|
|
|
return "AUTO";
|
|
|
|
|
case SHUT:
|
|
|
|
|
return "SHUT";
|
|
|
|
|
default:
|
|
|
|
|
throw std::invalid_argument("Unhandled enum value");
|
|
|
|
|
}
|
2013-11-06 16:19:48 +01:00
|
|
|
}
|
2014-12-08 16:34:28 +01:00
|
|
|
|
|
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
StateEnum StateEnumFromString( const std::string& stringValue ) {
|
2015-01-12 10:58:30 +01:00
|
|
|
if (stringValue == "OPEN")
|
|
|
|
|
return OPEN;
|
|
|
|
|
else if (stringValue == "SHUT")
|
|
|
|
|
return SHUT;
|
2015-01-12 12:33:49 +01:00
|
|
|
else if (stringValue == "STOP")
|
|
|
|
|
return SHUT;
|
2015-01-12 10:58:30 +01:00
|
|
|
else if (stringValue == "AUTO")
|
|
|
|
|
return AUTO;
|
|
|
|
|
else
|
|
|
|
|
throw std::invalid_argument("Unknown enum state string: " + stringValue );
|
|
|
|
|
}
|
2015-08-31 15:51:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
const std::string CompletionOrderEnum2String( CompletionOrderEnum enumValue ) {
|
|
|
|
|
switch( enumValue ) {
|
2015-09-02 12:24:33 +02:00
|
|
|
case DEPTH:
|
2015-08-31 15:51:14 +02:00
|
|
|
return "DEPTH";
|
2015-09-02 12:24:33 +02:00
|
|
|
case INPUT:
|
2015-08-31 15:51:14 +02:00
|
|
|
return "INPUT";
|
2015-09-02 12:24:33 +02:00
|
|
|
case TRACK:
|
2015-08-31 15:51:14 +02:00
|
|
|
return "TRACK";
|
|
|
|
|
default:
|
|
|
|
|
throw std::invalid_argument("Unhandled enum value");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
CompletionOrderEnum CompletionOrderEnumFromString(const std::string& stringValue ) {
|
2015-08-31 15:51:14 +02:00
|
|
|
if (stringValue == "DEPTH")
|
|
|
|
|
return DEPTH;
|
|
|
|
|
else if (stringValue == "INPUT")
|
|
|
|
|
return INPUT;
|
|
|
|
|
else if (stringValue == "TRACK")
|
|
|
|
|
return TRACK;
|
|
|
|
|
else
|
|
|
|
|
throw std::invalid_argument("Unknown enum state string: " + stringValue );
|
|
|
|
|
}
|
2013-11-06 16:19:48 +01:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 15:51:14 +02:00
|
|
|
|
2013-11-17 22:34:08 +01:00
|
|
|
/*****************************************************************/
|
2013-11-19 17:20:18 +01:00
|
|
|
|
|
|
|
|
namespace GroupInjection {
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2013-11-19 17:20:18 +01:00
|
|
|
const std::string ControlEnum2String( ControlEnum enumValue ) {
|
|
|
|
|
switch( enumValue ) {
|
|
|
|
|
case NONE:
|
|
|
|
|
return "NONE";
|
|
|
|
|
case RATE:
|
|
|
|
|
return "RATE";
|
|
|
|
|
case RESV:
|
|
|
|
|
return "RESV";
|
|
|
|
|
case REIN:
|
|
|
|
|
return "REIN";
|
|
|
|
|
case VREP:
|
|
|
|
|
return "VREP";
|
|
|
|
|
case FLD:
|
|
|
|
|
return "FLD";
|
|
|
|
|
default:
|
|
|
|
|
throw std::invalid_argument("Unhandled enum value");
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-12-08 16:34:28 +01:00
|
|
|
|
|
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
ControlEnum ControlEnumFromString( const std::string& stringValue ) {
|
2013-11-19 17:20:18 +01:00
|
|
|
if (stringValue == "NONE")
|
|
|
|
|
return NONE;
|
|
|
|
|
else if (stringValue == "RATE")
|
|
|
|
|
return RATE;
|
|
|
|
|
else if (stringValue == "RESV")
|
|
|
|
|
return RESV;
|
|
|
|
|
else if (stringValue == "REIN")
|
|
|
|
|
return REIN;
|
|
|
|
|
else if (stringValue == "VREP")
|
|
|
|
|
return VREP;
|
|
|
|
|
else if (stringValue == "FLD")
|
|
|
|
|
return FLD;
|
|
|
|
|
else
|
|
|
|
|
throw std::invalid_argument("Unknown enum state string: " + stringValue );
|
2013-11-17 22:34:08 +01:00
|
|
|
}
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2013-11-17 22:34:08 +01:00
|
|
|
}
|
2013-11-19 17:20:18 +01:00
|
|
|
|
|
|
|
|
/*****************************************************************/
|
|
|
|
|
|
|
|
|
|
namespace GroupProduction {
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2013-11-19 17:20:18 +01:00
|
|
|
const std::string ControlEnum2String( ControlEnum enumValue ) {
|
|
|
|
|
switch( enumValue ) {
|
|
|
|
|
case NONE:
|
|
|
|
|
return "NONE";
|
|
|
|
|
case ORAT:
|
|
|
|
|
return "ORAT";
|
|
|
|
|
case WRAT:
|
|
|
|
|
return "WRAT";
|
|
|
|
|
case GRAT:
|
|
|
|
|
return "GRAT";
|
|
|
|
|
case LRAT:
|
|
|
|
|
return "LRAT";
|
|
|
|
|
case CRAT:
|
|
|
|
|
return "CRAT";
|
|
|
|
|
case RESV:
|
|
|
|
|
return "RESV";
|
|
|
|
|
case PRBL:
|
|
|
|
|
return "PRBL";
|
2016-09-20 13:37:07 +02:00
|
|
|
case FLD:
|
|
|
|
|
return "FLD";
|
2013-11-19 17:20:18 +01:00
|
|
|
default:
|
|
|
|
|
throw std::invalid_argument("Unhandled enum value");
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-12-08 16:34:28 +01:00
|
|
|
|
|
|
|
|
|
2013-11-19 17:20:18 +01:00
|
|
|
ControlEnum ControlEnumFromString( const std::string& stringValue ) {
|
|
|
|
|
if (stringValue == "NONE")
|
|
|
|
|
return NONE;
|
|
|
|
|
else if (stringValue == "ORAT")
|
|
|
|
|
return ORAT;
|
|
|
|
|
else if (stringValue == "WRAT")
|
|
|
|
|
return WRAT;
|
|
|
|
|
else if (stringValue == "GRAT")
|
|
|
|
|
return GRAT;
|
|
|
|
|
else if (stringValue == "LRAT")
|
|
|
|
|
return LRAT;
|
|
|
|
|
else if (stringValue == "CRAT")
|
|
|
|
|
return CRAT;
|
|
|
|
|
else if (stringValue == "RESV")
|
|
|
|
|
return RESV;
|
|
|
|
|
else if (stringValue == "PRBL")
|
|
|
|
|
return PRBL;
|
2016-09-20 13:37:07 +02:00
|
|
|
else if (stringValue == "FLD")
|
|
|
|
|
return FLD;
|
2013-11-19 17:20:18 +01:00
|
|
|
else
|
|
|
|
|
throw std::invalid_argument("Unknown enum state string: " + stringValue );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************/
|
|
|
|
|
namespace GroupProductionExceedLimit {
|
|
|
|
|
|
|
|
|
|
const std::string ActionEnum2String( ActionEnum enumValue ) {
|
|
|
|
|
switch(enumValue) {
|
|
|
|
|
case NONE:
|
|
|
|
|
return "NONE";
|
|
|
|
|
case CON:
|
|
|
|
|
return "CON";
|
|
|
|
|
case CON_PLUS:
|
|
|
|
|
return "+CON";
|
|
|
|
|
case WELL:
|
|
|
|
|
return "WELL";
|
|
|
|
|
case PLUG:
|
|
|
|
|
return "PLUG";
|
|
|
|
|
case RATE:
|
|
|
|
|
return "RATE";
|
|
|
|
|
default:
|
2014-12-08 16:34:28 +01:00
|
|
|
throw std::invalid_argument("unhandled enum value");
|
2013-11-19 17:20:18 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
ActionEnum ActionEnumFromString( const std::string& stringValue ) {
|
2014-03-17 18:13:49 +01:00
|
|
|
|
2013-11-19 17:20:18 +01:00
|
|
|
if (stringValue == "NONE")
|
|
|
|
|
return NONE;
|
|
|
|
|
else if (stringValue == "CON")
|
|
|
|
|
return CON;
|
|
|
|
|
else if (stringValue == "+CON")
|
|
|
|
|
return CON_PLUS;
|
|
|
|
|
else if (stringValue == "WELL")
|
|
|
|
|
return WELL;
|
|
|
|
|
else if (stringValue == "PLUG")
|
|
|
|
|
return PLUG;
|
|
|
|
|
else if (stringValue == "RATE")
|
|
|
|
|
return RATE;
|
|
|
|
|
else
|
|
|
|
|
throw std::invalid_argument("Unknown enum state string: " + stringValue );
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-17 22:34:08 +01:00
|
|
|
}
|
|
|
|
|
|
2013-11-15 14:11:01 +01:00
|
|
|
/*****************************************************************/
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2014-01-30 13:29:04 +01:00
|
|
|
namespace WellProducer {
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2014-01-30 13:29:04 +01:00
|
|
|
const std::string ControlMode2String( ControlModeEnum enumValue ) {
|
|
|
|
|
switch( enumValue ) {
|
|
|
|
|
case ORAT:
|
|
|
|
|
return "ORAT";
|
|
|
|
|
case WRAT:
|
|
|
|
|
return "WRAT";
|
|
|
|
|
case GRAT:
|
|
|
|
|
return "GRAT";
|
|
|
|
|
case LRAT:
|
|
|
|
|
return "LRAT";
|
|
|
|
|
case CRAT:
|
|
|
|
|
return "CRAT";
|
|
|
|
|
case RESV:
|
|
|
|
|
return "RESV";
|
|
|
|
|
case BHP:
|
|
|
|
|
return "BHP";
|
|
|
|
|
case THP:
|
|
|
|
|
return "THP";
|
|
|
|
|
case GRUP:
|
|
|
|
|
return "GRUP";
|
|
|
|
|
default:
|
|
|
|
|
throw std::invalid_argument("unhandled enum value");
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
ControlModeEnum ControlModeFromString( const std::string& stringValue ) {
|
2014-01-30 13:29:04 +01:00
|
|
|
if (stringValue == "ORAT")
|
|
|
|
|
return ORAT;
|
|
|
|
|
else if (stringValue == "WRAT")
|
|
|
|
|
return WRAT;
|
|
|
|
|
else if (stringValue == "GRAT")
|
|
|
|
|
return GRAT;
|
|
|
|
|
else if (stringValue == "LRAT")
|
|
|
|
|
return LRAT;
|
|
|
|
|
else if (stringValue == "CRAT")
|
|
|
|
|
return CRAT;
|
|
|
|
|
else if (stringValue == "RESV")
|
|
|
|
|
return RESV;
|
|
|
|
|
else if (stringValue == "BHP")
|
|
|
|
|
return BHP;
|
|
|
|
|
else if (stringValue == "THP")
|
|
|
|
|
return THP;
|
|
|
|
|
else if (stringValue == "GRUP")
|
|
|
|
|
return GRUP;
|
2016-09-22 09:28:43 +02:00
|
|
|
else if (stringValue == "NONE")
|
|
|
|
|
return NONE;
|
2014-01-30 13:29:04 +01:00
|
|
|
else
|
|
|
|
|
throw std::invalid_argument("Unknown enum state string: " + stringValue );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-01-29 13:11:35 +01:00
|
|
|
namespace WellInjector {
|
2014-01-29 13:21:04 +01:00
|
|
|
|
2014-01-29 13:11:35 +01:00
|
|
|
const std::string Type2String( TypeEnum enumValue ) {
|
2014-01-28 08:35:12 +01:00
|
|
|
switch( enumValue ) {
|
|
|
|
|
case OIL:
|
|
|
|
|
return "OIL";
|
|
|
|
|
case GAS:
|
|
|
|
|
return "GAS";
|
|
|
|
|
case WATER:
|
|
|
|
|
return "WATER";
|
|
|
|
|
case MULTI:
|
|
|
|
|
return "MULTI";
|
|
|
|
|
default:
|
|
|
|
|
throw std::invalid_argument("unhandled enum value");
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
TypeEnum TypeFromString( const std::string& stringValue ) {
|
2014-01-28 08:35:12 +01:00
|
|
|
if (stringValue == "OIL")
|
|
|
|
|
return OIL;
|
|
|
|
|
else if (stringValue == "WATER")
|
|
|
|
|
return WATER;
|
2016-03-22 08:50:00 +01:00
|
|
|
else if (stringValue == "WAT")
|
|
|
|
|
return WATER;
|
2014-01-28 08:35:12 +01:00
|
|
|
else if (stringValue == "GAS")
|
|
|
|
|
return GAS;
|
|
|
|
|
else if (stringValue == "MULTI")
|
|
|
|
|
return MULTI;
|
|
|
|
|
else
|
|
|
|
|
throw std::invalid_argument("Unknown enum state string: " + stringValue );
|
|
|
|
|
}
|
2014-01-29 13:21:04 +01:00
|
|
|
|
|
|
|
|
/*****************************************************************/
|
|
|
|
|
|
|
|
|
|
const std::string ControlMode2String( ControlModeEnum enumValue ) {
|
|
|
|
|
switch( enumValue ) {
|
|
|
|
|
case RESV:
|
|
|
|
|
return "RESV";
|
|
|
|
|
case RATE:
|
|
|
|
|
return "RATE";
|
|
|
|
|
case BHP:
|
|
|
|
|
return "BHP";
|
|
|
|
|
case THP:
|
|
|
|
|
return "THP";
|
|
|
|
|
case GRUP:
|
|
|
|
|
return "GRUP";
|
|
|
|
|
default:
|
|
|
|
|
throw std::invalid_argument("unhandled enum value");
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
ControlModeEnum ControlModeFromString( const std::string& stringValue ) {
|
2014-01-29 13:21:04 +01:00
|
|
|
if (stringValue == "RATE")
|
|
|
|
|
return RATE;
|
|
|
|
|
else if (stringValue == "RESV")
|
|
|
|
|
return RESV;
|
|
|
|
|
else if (stringValue == "BHP")
|
|
|
|
|
return BHP;
|
|
|
|
|
else if (stringValue == "THP")
|
|
|
|
|
return THP;
|
|
|
|
|
else if (stringValue == "GRUP")
|
|
|
|
|
return GRUP;
|
|
|
|
|
else
|
|
|
|
|
throw std::invalid_argument("Unknown enum state string: " + stringValue );
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-28 08:35:12 +01:00
|
|
|
}
|
2014-01-29 15:10:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace WellCommon {
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2014-01-29 15:10:52 +01:00
|
|
|
const std::string Status2String(StatusEnum enumValue) {
|
|
|
|
|
switch( enumValue ) {
|
|
|
|
|
case OPEN:
|
|
|
|
|
return "OPEN";
|
|
|
|
|
case SHUT:
|
|
|
|
|
return "SHUT";
|
|
|
|
|
case AUTO:
|
|
|
|
|
return "AUTO";
|
|
|
|
|
case STOP:
|
|
|
|
|
return "STOP";
|
|
|
|
|
default:
|
|
|
|
|
throw std::invalid_argument("unhandled enum value");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
StatusEnum StatusFromString(const std::string& stringValue) {
|
2014-01-29 15:10:52 +01:00
|
|
|
if (stringValue == "OPEN")
|
|
|
|
|
return OPEN;
|
|
|
|
|
else if (stringValue == "SHUT")
|
|
|
|
|
return SHUT;
|
|
|
|
|
else if (stringValue == "STOP")
|
|
|
|
|
return STOP;
|
|
|
|
|
else if (stringValue == "AUTO")
|
|
|
|
|
return AUTO;
|
|
|
|
|
else
|
|
|
|
|
throw std::invalid_argument("Unknown enum state string: " + stringValue );
|
|
|
|
|
}
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2014-01-29 15:10:52 +01:00
|
|
|
}
|
2013-11-06 16:19:48 +01:00
|
|
|
|
2014-02-20 09:30:33 +01:00
|
|
|
namespace GuideRate {
|
|
|
|
|
|
|
|
|
|
const std::string GuideRatePhaseEnum2String( GuideRatePhaseEnum enumValue ) {
|
|
|
|
|
switch( enumValue ) {
|
|
|
|
|
case OIL:
|
|
|
|
|
return "OIL";
|
|
|
|
|
case WAT:
|
|
|
|
|
return "WAT";
|
|
|
|
|
case GAS:
|
|
|
|
|
return "GAS";
|
|
|
|
|
case LIQ:
|
|
|
|
|
return "LIQ";
|
|
|
|
|
case COMB:
|
|
|
|
|
return "COMB";
|
|
|
|
|
case WGA:
|
|
|
|
|
return "WGA";
|
|
|
|
|
case CVAL:
|
|
|
|
|
return "CVAL";
|
|
|
|
|
case RAT:
|
|
|
|
|
return "RAT";
|
|
|
|
|
case RES:
|
|
|
|
|
return "RES";
|
2014-02-21 12:48:36 +01:00
|
|
|
case UNDEFINED:
|
|
|
|
|
return "UNDEFINED";
|
2014-02-20 09:30:33 +01:00
|
|
|
default:
|
|
|
|
|
throw std::invalid_argument("unhandled enum value");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
GuideRatePhaseEnum GuideRatePhaseEnumFromString( const std::string& stringValue ) {
|
2014-03-17 18:13:49 +01:00
|
|
|
|
2014-02-20 09:30:33 +01:00
|
|
|
if (stringValue == "OIL")
|
|
|
|
|
return OIL;
|
|
|
|
|
else if (stringValue == "WAT")
|
|
|
|
|
return WAT;
|
|
|
|
|
else if (stringValue == "GAS")
|
|
|
|
|
return GAS;
|
|
|
|
|
else if (stringValue == "LIQ")
|
|
|
|
|
return LIQ;
|
|
|
|
|
else if (stringValue == "COMB")
|
|
|
|
|
return COMB;
|
|
|
|
|
else if (stringValue == "WGA")
|
|
|
|
|
return WGA;
|
|
|
|
|
else if (stringValue == "CVAL")
|
|
|
|
|
return CVAL;
|
|
|
|
|
else if (stringValue == "RAT")
|
|
|
|
|
return RAT;
|
|
|
|
|
else if (stringValue == "RES")
|
|
|
|
|
return RES;
|
2014-02-21 12:48:36 +01:00
|
|
|
else if (stringValue == "UNDEFINED")
|
|
|
|
|
return UNDEFINED;
|
2014-02-20 09:30:33 +01:00
|
|
|
else
|
|
|
|
|
throw std::invalid_argument("Unknown enum state string: " + stringValue );
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-08-29 15:08:13 +02:00
|
|
|
|
2015-02-06 14:52:59 +01:00
|
|
|
namespace RFTConnections {
|
|
|
|
|
const std::string RFTEnum2String(RFTEnum enumValue) {
|
|
|
|
|
switch (enumValue) {
|
|
|
|
|
case YES:
|
|
|
|
|
return "YES";
|
|
|
|
|
case REPT:
|
|
|
|
|
return "REPT";
|
|
|
|
|
case TIMESTEP:
|
|
|
|
|
return "TIMESTEP";
|
|
|
|
|
case FOPN:
|
|
|
|
|
return "FOPN";
|
|
|
|
|
case NO:
|
|
|
|
|
return "NO";
|
|
|
|
|
default:
|
|
|
|
|
throw std::invalid_argument("unhandled enum value");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
RFTEnum RFTEnumFromString(const std::string& stringValue) {
|
2015-02-06 14:52:59 +01:00
|
|
|
|
|
|
|
|
if (stringValue == "YES")
|
|
|
|
|
return YES;
|
|
|
|
|
else if (stringValue == "REPT")
|
|
|
|
|
return REPT;
|
|
|
|
|
else if (stringValue == "TIMESTEP")
|
|
|
|
|
return TIMESTEP;
|
|
|
|
|
else if (stringValue == "FOPN")
|
|
|
|
|
return FOPN;
|
|
|
|
|
else if (stringValue == "NO")
|
|
|
|
|
return NO;
|
|
|
|
|
else
|
|
|
|
|
throw std::invalid_argument("Unknown enum state string: " + stringValue);
|
2015-02-13 14:19:24 +01:00
|
|
|
}
|
2015-02-06 14:52:59 +01:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
namespace PLTConnections {
|
|
|
|
|
const std::string PLTEnum2String(PLTEnum enumValue) {
|
|
|
|
|
switch (enumValue) {
|
|
|
|
|
case YES:
|
|
|
|
|
return "YES";
|
|
|
|
|
case REPT:
|
|
|
|
|
return "REPT";
|
|
|
|
|
case TIMESTEP:
|
|
|
|
|
return "TIMESTEP";
|
|
|
|
|
case NO:
|
|
|
|
|
return "NO";
|
|
|
|
|
default:
|
|
|
|
|
throw std::invalid_argument("unhandled enum value");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
PLTEnum PLTEnumFromString( const std::string& stringValue ){
|
2015-02-06 14:52:59 +01:00
|
|
|
if (stringValue == "YES")
|
|
|
|
|
return YES;
|
|
|
|
|
else if (stringValue == "REPT")
|
|
|
|
|
return REPT;
|
|
|
|
|
else if (stringValue == "TIMESTEP")
|
|
|
|
|
return TIMESTEP;
|
|
|
|
|
else if (stringValue == "NO")
|
|
|
|
|
return NO;
|
|
|
|
|
else
|
|
|
|
|
throw std::invalid_argument("Unknown enum state string: " + stringValue );
|
2015-02-13 14:19:24 +01:00
|
|
|
}
|
2015-02-06 14:52:59 +01:00
|
|
|
}
|
|
|
|
|
|
2015-10-23 15:16:20 +02:00
|
|
|
namespace WellSegment{
|
|
|
|
|
|
|
|
|
|
const std::string LengthDepthEnumToString(LengthDepthEnum enumValue) {
|
|
|
|
|
switch (enumValue) {
|
|
|
|
|
case INC:
|
|
|
|
|
return "INC";
|
|
|
|
|
case ABS:
|
|
|
|
|
return "ABS";
|
|
|
|
|
default:
|
|
|
|
|
throw std::invalid_argument("unhandled LengthDepthEnum value");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
LengthDepthEnum LengthDepthEnumFromString(const std::string& string ) {
|
|
|
|
|
if (string == "INC") {
|
2015-10-23 15:16:20 +02:00
|
|
|
return INC;
|
2016-08-05 12:34:08 +02:00
|
|
|
} else if (string == "ABS") {
|
2015-10-23 15:16:20 +02:00
|
|
|
return ABS;
|
|
|
|
|
} else {
|
2016-08-05 12:34:08 +02:00
|
|
|
throw std::invalid_argument("Unknown enum string: " + string + " for LengthDepthEnum");
|
2015-10-23 15:16:20 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-02 15:57:29 +01:00
|
|
|
const std::string CompPressureDropEnumToString(CompPressureDropEnum enumValue) {
|
2015-10-23 15:16:20 +02:00
|
|
|
switch (enumValue) {
|
|
|
|
|
case HFA:
|
|
|
|
|
return "HFA";
|
|
|
|
|
case HF_:
|
|
|
|
|
return "HF-";
|
|
|
|
|
case H__:
|
|
|
|
|
return "H--";
|
|
|
|
|
default:
|
2015-11-02 15:57:29 +01:00
|
|
|
throw std::invalid_argument("unhandled CompPressureDropEnum value");
|
2015-10-23 15:16:20 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
CompPressureDropEnum CompPressureDropEnumFromString( const std::string& string ) {
|
2015-10-23 15:16:20 +02:00
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
if (string == "HFA") {
|
2015-10-23 15:16:20 +02:00
|
|
|
return HFA;
|
2016-08-05 12:34:08 +02:00
|
|
|
} else if (string == "HF-") {
|
2015-10-23 15:16:20 +02:00
|
|
|
return HF_;
|
2016-08-05 12:34:08 +02:00
|
|
|
} else if (string == "H--") {
|
2015-10-23 15:16:20 +02:00
|
|
|
return H__;
|
|
|
|
|
} else {
|
2016-08-05 12:34:08 +02:00
|
|
|
throw std::invalid_argument("Unknown enum string: " + string + " for CompPressureDropEnum");
|
2015-10-23 15:16:20 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const std::string MultiPhaseModelEnumToString(MultiPhaseModelEnum enumValue) {
|
|
|
|
|
switch (enumValue) {
|
2015-11-11 09:33:30 +01:00
|
|
|
case HO:
|
|
|
|
|
return "HO";
|
2015-10-23 15:16:20 +02:00
|
|
|
case DF:
|
|
|
|
|
return "DF";
|
|
|
|
|
default:
|
|
|
|
|
throw std::invalid_argument("unhandled MultiPhaseModelEnum value");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
MultiPhaseModelEnum MultiPhaseModelEnumFromString(const std::string& string ) {
|
2015-10-23 15:16:20 +02:00
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
if ((string == "HO") || (string == "H0")) {
|
2015-11-11 09:33:30 +01:00
|
|
|
return HO;
|
2016-08-05 12:34:08 +02:00
|
|
|
} else if (string == "DF") {
|
2015-10-23 15:16:20 +02:00
|
|
|
return DF;
|
|
|
|
|
} else {
|
2016-08-05 12:34:08 +02:00
|
|
|
throw std::invalid_argument("Unknown enum string: " + string + " for MultiPhaseModelEnum");
|
2015-10-23 15:16:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-06-22 16:04:48 +02:00
|
|
|
|
|
|
|
|
namespace WellEcon {
|
|
|
|
|
const std::string WorkoverEnumToString(WorkoverEnum enumValue) {
|
|
|
|
|
switch(enumValue) {
|
|
|
|
|
case NONE:
|
|
|
|
|
return "NONE";
|
|
|
|
|
case CON:
|
|
|
|
|
return "CON";
|
|
|
|
|
case CONP:
|
|
|
|
|
return "+CON";
|
|
|
|
|
case WELL:
|
|
|
|
|
return "WELL";
|
|
|
|
|
case PLUG:
|
|
|
|
|
return "PLUG";
|
|
|
|
|
case LAST:
|
|
|
|
|
return "LAST";
|
|
|
|
|
case RED:
|
|
|
|
|
return "RED";
|
|
|
|
|
default:
|
|
|
|
|
throw std::invalid_argument("unhandled WorkoverEnum value");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
WorkoverEnum WorkoverEnumFromString( const std::string& string ) {
|
2016-06-22 16:04:48 +02:00
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
if (string == "NONE") {
|
2016-06-22 16:04:48 +02:00
|
|
|
return NONE;
|
2016-08-05 12:34:08 +02:00
|
|
|
} else if (string == "CON") {
|
2016-06-22 16:04:48 +02:00
|
|
|
return CON;
|
2016-08-05 12:34:08 +02:00
|
|
|
} else if (string == "+CON") {
|
2016-06-22 16:04:48 +02:00
|
|
|
return CONP;
|
2016-08-05 12:34:08 +02:00
|
|
|
} else if (string == "WELL") {
|
2016-06-22 16:04:48 +02:00
|
|
|
return WELL;
|
2016-08-05 12:34:08 +02:00
|
|
|
} else if (string == "PLUG") {
|
2016-06-22 16:04:48 +02:00
|
|
|
return PLUG;
|
2016-08-05 12:34:08 +02:00
|
|
|
} else if (string == "LAST") {
|
2016-06-22 16:04:48 +02:00
|
|
|
return LAST;
|
2016-08-05 12:34:08 +02:00
|
|
|
} else if (string == "RED") {
|
2016-06-22 16:04:48 +02:00
|
|
|
return RED;
|
|
|
|
|
} else {
|
2016-08-05 12:34:08 +02:00
|
|
|
throw std::invalid_argument("Unknown enum string: " + string + " for WorkoverEnum");
|
2016-06-22 16:04:48 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const std::string QuantityLimitEnumToString(QuantityLimitEnum enumValue) {
|
|
|
|
|
switch(enumValue) {
|
|
|
|
|
case RATE:
|
|
|
|
|
return "RATE";
|
|
|
|
|
case POTN:
|
|
|
|
|
return "POTN";
|
|
|
|
|
default:
|
|
|
|
|
throw std::invalid_argument("unhandled QuantityLimitvalue");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-05 12:34:08 +02:00
|
|
|
QuantityLimitEnum QuantityLimitEnumFromString(const std::string& string ) {
|
|
|
|
|
if (string == "RATE") {
|
2016-06-22 16:04:48 +02:00
|
|
|
return RATE;
|
2016-08-05 12:34:08 +02:00
|
|
|
} else if (string == "POTN") {
|
2016-06-22 16:04:48 +02:00
|
|
|
return POTN;
|
|
|
|
|
} else {
|
2016-08-05 12:34:08 +02:00
|
|
|
throw std::invalid_argument("Unknown enum string: " + string + " for QuantityLimitEnum");
|
2016-06-22 16:04:48 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-02-20 09:30:33 +01:00
|
|
|
}
|