diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake
index f9a0410bd..6df77ab2e 100644
--- a/CMakeLists_files.cmake
+++ b/CMakeLists_files.cmake
@@ -128,6 +128,7 @@ if(ENABLE_ECL_INPUT)
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQSet.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQWellSet.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.cpp
+ src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQExpression.cpp
@@ -516,6 +517,7 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp
+ opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQWellSet.hpp
diff --git a/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp b/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp
new file mode 100644
index 000000000..7bfe6cbac
--- /dev/null
+++ b/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp
@@ -0,0 +1,45 @@
+/*
+ Copyright 2019 Equinor 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 .
+*/
+
+
+#ifndef UDQ_ENUMS_HPP
+#define UDQ_ENUMS_HPP
+
+namespace Opm {
+
+enum class UDQVarType {
+ WELL_VAR = 1,
+ CONNECTION_VAR= 2,
+ FIELD_VAR = 3,
+ GROUP_VAR = 4,
+ REGION_VAR = 5,
+ SEGMENT_VAR = 6,
+ AQUIFER_VAR = 7,
+ BLOCK_VAR = 8
+};
+
+
+namespace UDQ {
+
+ UDQVarType varType(const std::string& keyword);
+
+}
+}
+
+#endif
diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.cpp
new file mode 100644
index 000000000..9a6bbd43f
--- /dev/null
+++ b/src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.cpp
@@ -0,0 +1,58 @@
+/*
+ Copyright 2019 Equinor 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 .
+*/
+
+#include
+#include
+
+#include
+
+
+namespace Opm {
+namespace UDQ {
+
+UDQVarType varType(const std::string& keyword) {
+ if (keyword[1] != 'U')
+ throw std::invalid_argument("Keyword: " + keyword + " is not of UDQ type");
+
+ char first_char = keyword[0];
+ switch(first_char) {
+ case 'W':
+ return UDQVarType::WELL_VAR;
+ case 'G':
+ return UDQVarType::GROUP_VAR;
+ case 'C':
+ return UDQVarType::CONNECTION_VAR;
+ case 'R':
+ return UDQVarType::REGION_VAR;
+ case 'F':
+ return UDQVarType::FIELD_VAR;
+ case 'S':
+ return UDQVarType::SEGMENT_VAR;
+ case 'A':
+ return UDQVarType::AQUIFER_VAR;
+ case 'B':
+ return UDQVarType::BLOCK_VAR;
+ default:
+ throw std::invalid_argument("Keyword: " + keyword + " is not of UDQ type");
+ }
+
+}
+
+}
+}
diff --git a/tests/parser/UDQTests.cpp b/tests/parser/UDQTests.cpp
index 647fd554f..dd3ba0c8c 100644
--- a/tests/parser/UDQTests.cpp
+++ b/tests/parser/UDQTests.cpp
@@ -24,6 +24,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -69,6 +70,21 @@ UDQPARAM
}
+BOOST_AUTO_TEST_CASE(ENUM_CONVERSION) {
+ BOOST_CHECK_THROW(UDQ::varType("WWCT"), std::invalid_argument);
+ BOOST_CHECK_THROW(UDQ::varType("XUCT"), std::invalid_argument);
+
+ BOOST_CHECK(UDQ::varType("WUBHP") == UDQVarType::WELL_VAR);
+ BOOST_CHECK(UDQ::varType("GUBHP") == UDQVarType::GROUP_VAR);
+ BOOST_CHECK(UDQ::varType("CUBHP") == UDQVarType::CONNECTION_VAR);
+ BOOST_CHECK(UDQ::varType("FUBHP") == UDQVarType::FIELD_VAR);
+ BOOST_CHECK(UDQ::varType("RUBHP") == UDQVarType::REGION_VAR);
+ BOOST_CHECK(UDQ::varType("AUBHP") == UDQVarType::AQUIFER_VAR);
+ BOOST_CHECK(UDQ::varType("SUBHP") == UDQVarType::SEGMENT_VAR);
+}
+
+
+
BOOST_AUTO_TEST_CASE(UDQ_KEWYORDS) {
const std::string input = R"(
RUNSPEC