mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#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".
This commit is contained in:
parent
34a5d3e756
commit
92afb11a76
@ -157,8 +157,14 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromEclipseTextAddress( const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RifEclipseSummaryAddress::SummaryVarCategory RifEclipseSummaryAddress::identifyCategory( const std::string& vectorName )
|
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;
|
if ( vectorName.size() < 3 || vectorName.size() > 8 ) return SUMMARY_INVALID;
|
||||||
|
|
||||||
|
// Try to match the base vector name with more heuristics
|
||||||
auto strippedQuantityName = baseVectorName( vectorName );
|
auto strippedQuantityName = baseVectorName( vectorName );
|
||||||
|
|
||||||
// First, try to lookup vector in vector table
|
// First, try to lookup vector in vector table
|
||||||
|
@ -33,9 +33,9 @@ RiuSummaryQuantityNameInfoProvider* RiuSummaryQuantityNameInfoProvider::instance
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RifEclipseSummaryAddress::SummaryVarCategory
|
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;
|
return info.category;
|
||||||
}
|
}
|
||||||
@ -44,15 +44,17 @@ RifEclipseSummaryAddress::SummaryVarCategory
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuSummaryQuantityNameInfoProvider::RiuSummaryQuantityInfo
|
RiuSummaryQuantityNameInfoProvider::RiuSummaryQuantityInfo
|
||||||
RiuSummaryQuantityNameInfoProvider::quantityInfo( const std::string& vectorName ) const
|
RiuSummaryQuantityNameInfoProvider::quantityInfo( const std::string& vectorName, bool exactMatch ) const
|
||||||
{
|
{
|
||||||
auto it = m_summaryToDescMap.find( vectorName );
|
auto it = m_summaryToDescMap.find( vectorName );
|
||||||
|
|
||||||
if ( it != m_summaryToDescMap.end() )
|
if ( it != m_summaryToDescMap.end() )
|
||||||
{
|
{
|
||||||
return it->second;
|
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' )
|
if ( vectorName.size() > 1 && vectorName[1] == 'U' )
|
||||||
{
|
{
|
||||||
// User defined vector name
|
// User defined vector name
|
||||||
@ -63,6 +65,7 @@ RiuSummaryQuantityNameInfoProvider::RiuSummaryQuantityInfo
|
|||||||
|
|
||||||
return RiuSummaryQuantityInfo();
|
return RiuSummaryQuantityInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( vectorName.size() > 5 )
|
if ( vectorName.size() > 5 )
|
||||||
{
|
{
|
||||||
// Check for custom vector naming
|
// Check for custom vector naming
|
||||||
|
@ -31,7 +31,8 @@ class RiuSummaryQuantityNameInfoProvider
|
|||||||
public:
|
public:
|
||||||
static RiuSummaryQuantityNameInfoProvider* instance();
|
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;
|
std::string longNameFromVectorName( const std::string& vectorName, bool returnVectorNameIfNotFound = false ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -55,7 +56,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
RiuSummaryQuantityNameInfoProvider();
|
RiuSummaryQuantityNameInfoProvider();
|
||||||
|
|
||||||
RiuSummaryQuantityInfo quantityInfo( const std::string& vectorName ) const;
|
RiuSummaryQuantityInfo quantityInfo( const std::string& vectorName, bool exactMatch = false ) const;
|
||||||
|
|
||||||
static std::unordered_map<std::string, RiuSummaryQuantityInfo> createInfoForEclipseKeywords();
|
static std::unordered_map<std::string, RiuSummaryQuantityInfo> createInfoForEclipseKeywords();
|
||||||
static std::unordered_map<std::string, RiuSummaryQuantityInfo> createInfoFor6xKeywords();
|
static std::unordered_map<std::string, RiuSummaryQuantityInfo> createInfoFor6xKeywords();
|
||||||
|
Loading…
Reference in New Issue
Block a user