Make sure that well UDQ with last letter 'L' are included in output

This commit is contained in:
Joakim Hove 2019-06-28 12:11:06 +02:00
parent 034488c902
commit 0cf83567eb
3 changed files with 26 additions and 17 deletions

View File

@ -152,17 +152,26 @@ inline void keywordW( SummaryConfig::keyword_list& list,
const DeckKeyword& keyword,
const Schedule& schedule ) {
const auto hasValue = []( const DeckKeyword& kw ) {
return kw.getDataRecord().getDataItem().hasValue( 0 );
};
/*
Here is a two step check whether this keyword should be discarded as not
supported:
1. Well keywords ending with 'L' represent completions, they are not
supported.
2. If the keyword is a UDQ keyword there is no convention enforced to
the last character, and in that case it is treated as a normal well
keyword anyways.
*/
if (keyword.name().back() == 'L') {
std::string msg = std::string("The completion keywords like: " + keyword.name() + " are not supported");
parseContext.handleError( ParseContext::SUMMARY_UNHANDLED_KEYWORD, msg, errors);
return;
if (!is_udq(keyword.name())) {
std::string msg = std::string("The completion keywords like: " + keyword.name() + " are not supported");
parseContext.handleError( ParseContext::SUMMARY_UNHANDLED_KEYWORD, msg, errors);
return;
}
}
if (keyword.size() && hasValue(keyword)) {
if (keyword.size() && keyword.getDataRecord().getDataItem().hasValue(0)) {
for( const std::string& pattern : keyword.getStringData()) {
auto well_names = schedule.wellNames( pattern, schedule.size() - 1 );

View File

@ -352,7 +352,7 @@ WWPT
/
WUBHP
/
WUOPR
WUOPRL
/
WUWCT
/
@ -372,12 +372,12 @@ RPTRST
UDQ
ASSIGN WUBHP 11 /
ASSIGN WUOPR 20 /
ASSIGN WUOPRL 20 /
ASSIGN WUBHP P2 12 /
ASSIGN WUBHP P3 13 /
ASSIGN WUBHP P4 14 /
UNITS WUBHP 'BARSA' /
UNITS WUOPR 'SM3/DAY' /
UNITS WUOPRL 'SM3/DAY' /
DEFINE WUWCT WWPR / (WWPR + WOPR) /
UNITS WUWCT '1' /
DEFINE FUOPR SUM(WOPR) /

View File

@ -239,21 +239,21 @@ BOOST_AUTO_TEST_CASE(UDQ_ASSIGN) {
ecl_sum_type * ecl_sum = ecl_sum_fread_alloc_case( base_name.c_str(), ":");
BOOST_CHECK( ecl_sum_has_general_var(ecl_sum, "WUBHP:P1") );
BOOST_CHECK( ecl_sum_has_general_var(ecl_sum, "WUBHP:P2") );
BOOST_CHECK( ecl_sum_has_general_var(ecl_sum, "WUOPR:P3") );
BOOST_CHECK( ecl_sum_has_general_var(ecl_sum, "WUOPR:P4") );
BOOST_CHECK( ecl_sum_has_general_var(ecl_sum, "WUOPRL:P3") );
BOOST_CHECK( ecl_sum_has_general_var(ecl_sum, "WUOPRL:P4") );
BOOST_CHECK_EQUAL( ecl_sum_get_unit(ecl_sum, "WUBHP:P1"), "BARSA");
BOOST_CHECK_EQUAL( ecl_sum_get_unit(ecl_sum, "WUOPR:P1"), "SM3/DAY");
BOOST_CHECK_EQUAL( ecl_sum_get_unit(ecl_sum, "WUOPRL:P1"), "SM3/DAY");
BOOST_CHECK_EQUAL( ecl_sum_get_general_var(ecl_sum, 1, "WUBHP:P1"), 11);
BOOST_CHECK_EQUAL( ecl_sum_get_general_var(ecl_sum, 1, "WUBHP:P2"), 12);
BOOST_CHECK_EQUAL( ecl_sum_get_general_var(ecl_sum, 1, "WUBHP:P3"), 13);
BOOST_CHECK_EQUAL( ecl_sum_get_general_var(ecl_sum, 1, "WUBHP:P4"), 14);
BOOST_CHECK_EQUAL( ecl_sum_get_general_var(ecl_sum, 1, "WUOPR:P1"), 20);
BOOST_CHECK_EQUAL( ecl_sum_get_general_var(ecl_sum, 1, "WUOPR:P2"), 20);
BOOST_CHECK_EQUAL( ecl_sum_get_general_var(ecl_sum, 1, "WUOPR:P3"), 20);
BOOST_CHECK_EQUAL( ecl_sum_get_general_var(ecl_sum, 1, "WUOPR:P4"), 20);
BOOST_CHECK_EQUAL( ecl_sum_get_general_var(ecl_sum, 1, "WUOPRL:P1"), 20);
BOOST_CHECK_EQUAL( ecl_sum_get_general_var(ecl_sum, 1, "WUOPRL:P2"), 20);
BOOST_CHECK_EQUAL( ecl_sum_get_general_var(ecl_sum, 1, "WUOPRL:P3"), 20);
BOOST_CHECK_EQUAL( ecl_sum_get_general_var(ecl_sum, 1, "WUOPRL:P4"), 20);
ecl_sum_free( ecl_sum );
test_work_area_free(work_area);