From 70f31aa4e9109ad2abd297629da2f587477f33ee Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 30 May 2022 09:13:50 +0200 Subject: [PATCH 1/4] libecl: add support for network variables --- ThirdParty/Ert/lib/ecl/ecl_smspec.cpp | 2 ++ ThirdParty/Ert/lib/ecl/smspec_node.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/ThirdParty/Ert/lib/ecl/ecl_smspec.cpp b/ThirdParty/Ert/lib/ecl/ecl_smspec.cpp index e0a4742c90..7136067d46 100644 --- a/ThirdParty/Ert/lib/ecl/ecl_smspec.cpp +++ b/ThirdParty/Ert/lib/ecl/ecl_smspec.cpp @@ -754,6 +754,8 @@ static void ecl_smspec_install_special_keys( ecl_smspec_type * ecl_smspec , cons break; case(ECL_SMSPEC_AQUIFER_VAR): break; + case(ECL_SMSPEC_NETWORK_VAR): + break; default: throw std::invalid_argument("Internal error - should not be here \n"); } diff --git a/ThirdParty/Ert/lib/ecl/smspec_node.cpp b/ThirdParty/Ert/lib/ecl/smspec_node.cpp index a1c98178fb..0068dff258 100644 --- a/ThirdParty/Ert/lib/ecl/smspec_node.cpp +++ b/ThirdParty/Ert/lib/ecl/smspec_node.cpp @@ -592,6 +592,10 @@ void smspec_node::set_gen_keys( const char* key_join_string_) { // KEYWORD gen_key1 = keyword; break; + case(ECL_SMSPEC_NETWORK_VAR): + // KEYWORD + gen_key1 = keyword; + break; case(ECL_SMSPEC_GROUP_VAR): // KEYWORD:WGNAME gen_key1 = smspec_alloc_group_key( key_join_string_ , keyword , wgname); @@ -718,6 +722,9 @@ ecl_smspec_var_type smspec_node::valid_type(const char * keyword, const char * w return var_type; } + if (var_type == ECL_SMSPEC_NETWORK_VAR) + return var_type; + return ECL_SMSPEC_INVALID_VAR; } @@ -907,6 +914,8 @@ smspec_node::smspec_node(int param_index, case(ECL_SMSPEC_AQUIFER_VAR): set_num( grid_dims , num ); break; + case(ECL_SMSPEC_NETWORK_VAR): + break; default: throw std::invalid_argument("Should not be here ... "); break; @@ -941,6 +950,8 @@ smspec_node::smspec_node( int param_index_, switch (this->var_type) { case(ECL_SMSPEC_LOCAL_WELL_VAR): break; + case(ECL_SMSPEC_NETWORK_VAR): + break; case(ECL_SMSPEC_LOCAL_BLOCK_VAR): set_lgr_ijk( lgr_i, lgr_j , lgr_k ); break; From 1cf2cd732fa8d8c47425a3ce76effe6b3b0bf7ea Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 30 May 2022 09:30:40 +0200 Subject: [PATCH 2/4] libecl: Add more special-case MISC vectors --- ThirdParty/Ert/lib/ecl/smspec_node.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ThirdParty/Ert/lib/ecl/smspec_node.cpp b/ThirdParty/Ert/lib/ecl/smspec_node.cpp index 0068dff258..fdeada0d78 100644 --- a/ThirdParty/Ert/lib/ecl/smspec_node.cpp +++ b/ThirdParty/Ert/lib/ecl/smspec_node.cpp @@ -57,11 +57,26 @@ ecl_smspec_identify_special_var() and ecl_smspec_identify_var_type(). */ -static const char* special_vars[] = {"NEWTON", - "NAIMFRAC", +static const char* special_vars[] = {"NAIMFRAC", + "NBAKFL", + "NBYTOT", + "NCPRLINS", + "NEWTFL", + "NEWTON", + "NLINEARP", + "NLINEARS", "NLINEARS", - "NLINSMIN", "NLINSMAX", + "NLINSMIN", + "NLRESMAX", + "NLRESSUM", + "NMESSAGE", + "NNUMFL", + "NNUMST", + "NTS", + "NTSECL", + "NTSMCL", + "NTSPCL", "ELAPSED", "MAXDPR", "MAXDSO", From 79f7415b44168db7ea3921692c4211aa3da7c85b Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 30 May 2022 11:16:00 +0200 Subject: [PATCH 3/4] Summary Quantity Name Provider: special handling for MISC vectors --- .../RiuSummaryQuantityNameInfoProvider.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp index 618c6d6fa9..ff7f4656ce 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp @@ -2133,7 +2133,24 @@ std::unordered_map Date: Tue, 31 May 2022 20:25:35 +0200 Subject: [PATCH 4/4] #8899 Try exact matches for eclipse summary category search. Fixes incorrect classification for vectors with 8 characters starting with 'N' (e.g NLINSMAX). They were classified as "network", but lookup table have them correctly classified as "misc". --- .../FileInterface/RifEclipseSummaryAddress.cpp | 6 ++++++ .../RiuSummaryQuantityNameInfoProvider.cpp | 11 +++++++---- .../RiuSummaryQuantityNameInfoProvider.h | 5 +++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp index 02a15de185..3516e79b08 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp @@ -157,8 +157,14 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromEclipseTextAddress( const //-------------------------------------------------------------------------------------------------- RifEclipseSummaryAddress::SummaryVarCategory RifEclipseSummaryAddress::identifyCategory( const std::string& vectorName ) { + // Try to an exact match on the vector name first in the vector table. + bool exactMatch = true; + auto exactCategory = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( vectorName, exactMatch ); + if ( exactCategory != SUMMARY_INVALID ) return exactCategory; + if ( vectorName.size() < 3 || vectorName.size() > 8 ) return SUMMARY_INVALID; + // Try to match the base vector name with more heuristics auto strippedQuantityName = baseVectorName( vectorName ); // First, try to lookup vector in vector table diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp index ff7f4656ce..5b4079f0e0 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp @@ -33,9 +33,9 @@ RiuSummaryQuantityNameInfoProvider* RiuSummaryQuantityNameInfoProvider::instance /// //-------------------------------------------------------------------------------------------------- RifEclipseSummaryAddress::SummaryVarCategory - RiuSummaryQuantityNameInfoProvider::categoryFromVectorName( const std::string& vectorName ) const + RiuSummaryQuantityNameInfoProvider::categoryFromVectorName( const std::string& vectorName, bool exactMatch ) const { - auto info = quantityInfo( vectorName ); + auto info = quantityInfo( vectorName, exactMatch ); return info.category; } @@ -44,15 +44,17 @@ RifEclipseSummaryAddress::SummaryVarCategory /// //-------------------------------------------------------------------------------------------------- RiuSummaryQuantityNameInfoProvider::RiuSummaryQuantityInfo - RiuSummaryQuantityNameInfoProvider::quantityInfo( const std::string& vectorName ) const + RiuSummaryQuantityNameInfoProvider::quantityInfo( const std::string& vectorName, bool exactMatch ) const { auto it = m_summaryToDescMap.find( vectorName ); - if ( it != m_summaryToDescMap.end() ) { return it->second; } + // Stop searching if not found in lookup table and exact match was requested. + if ( exactMatch ) return RiuSummaryQuantityInfo(); + if ( vectorName.size() > 1 && vectorName[1] == 'U' ) { // User defined vector name @@ -63,6 +65,7 @@ RiuSummaryQuantityNameInfoProvider::RiuSummaryQuantityInfo return RiuSummaryQuantityInfo(); } + if ( vectorName.size() > 5 ) { // Check for custom vector naming diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h index b23f320dba..cbe66dccf3 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h @@ -31,7 +31,8 @@ class RiuSummaryQuantityNameInfoProvider public: static RiuSummaryQuantityNameInfoProvider* instance(); - RifEclipseSummaryAddress::SummaryVarCategory categoryFromVectorName( const std::string& vectorName ) const; + RifEclipseSummaryAddress::SummaryVarCategory categoryFromVectorName( const std::string& vectorName, + bool exactMatch = false ) const; std::string longNameFromVectorName( const std::string& vectorName, bool returnVectorNameIfNotFound = false ) const; private: @@ -55,7 +56,7 @@ class RiuSummaryQuantityNameInfoProvider private: RiuSummaryQuantityNameInfoProvider(); - RiuSummaryQuantityInfo quantityInfo( const std::string& vectorName ) const; + RiuSummaryQuantityInfo quantityInfo( const std::string& vectorName, bool exactMatch = false ) const; static std::unordered_map createInfoForEclipseKeywords(); static std::unordered_map createInfoFor6xKeywords();