mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #4895 from OPM/fix-cumulative-curve-statistics-resample
Fix cumulative curve statistics resampling
This commit is contained in:
commit
d59cdfa6ec
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "RiaStdStringTools.h"
|
#include "RiaStdStringTools.h"
|
||||||
|
|
||||||
#include "RiuSummaryVectorDescriptionMap.h"
|
#include "RiuSummaryQuantityNameInfoProvider.h"
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
@ -285,8 +285,8 @@ RifEclipseSummaryAddress::SummaryVarCategory RifEclipseSummaryAddress::identifyC
|
|||||||
if ( !regexp.exactMatch( QString::fromStdString( quantityName ) ) ) return SUMMARY_INVALID;
|
if ( !regexp.exactMatch( QString::fromStdString( quantityName ) ) ) return SUMMARY_INVALID;
|
||||||
|
|
||||||
// First, try to lookup vector in vector table
|
// First, try to lookup vector in vector table
|
||||||
auto vectorInfo = RiuSummaryVectorDescriptionMap::instance()->vectorInfo( quantityName );
|
auto category = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( quantityName );
|
||||||
if ( vectorInfo.category != SUMMARY_INVALID ) return vectorInfo.category;
|
if ( category != SUMMARY_INVALID ) return category;
|
||||||
|
|
||||||
// Then check LGR categories
|
// Then check LGR categories
|
||||||
std::string firstTwoLetters = quantityName.substr( 0, 2 );
|
std::string firstTwoLetters = quantityName.substr( 0, 2 );
|
||||||
@ -784,7 +784,14 @@ bool RifEclipseSummaryAddress::hasAccumulatedData() const
|
|||||||
{
|
{
|
||||||
if ( !isValidEclipseCategory() ) return false;
|
if ( !isValidEclipseCategory() ) return false;
|
||||||
|
|
||||||
QString qBaseName = QString::fromStdString( baseQuantityName( quantityName() ) );
|
QString quantityForInspection = QString::fromStdString( quantityName() );
|
||||||
|
if ( category() == SUMMARY_ENSEMBLE_STATISTICS )
|
||||||
|
{
|
||||||
|
// Remove statistics text prefix
|
||||||
|
quantityForInspection = quantityForInspection.mid( quantityForInspection.indexOf( ":" ) + 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
QString qBaseName = baseQuantityName( quantityForInspection );
|
||||||
return qBaseName.endsWith( "T" ) || qBaseName.endsWith( "TH" );
|
return qBaseName.endsWith( "T" ) || qBaseName.endsWith( "TH" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -809,6 +816,7 @@ bool RifEclipseSummaryAddress::isValidEclipseCategory() const
|
|||||||
case SUMMARY_WELL_SEGMENT:
|
case SUMMARY_WELL_SEGMENT:
|
||||||
case SUMMARY_BLOCK:
|
case SUMMARY_BLOCK:
|
||||||
case SUMMARY_BLOCK_LGR:
|
case SUMMARY_BLOCK_LGR:
|
||||||
|
case SUMMARY_ENSEMBLE_STATISTICS:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -817,13 +825,13 @@ bool RifEclipseSummaryAddress::isValidEclipseCategory() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::string RifEclipseSummaryAddress::baseQuantityName( const std::string& quantityName )
|
QString RifEclipseSummaryAddress::baseQuantityName( const QString& quantityName )
|
||||||
{
|
{
|
||||||
QString qBaseName = QString::fromStdString( quantityName );
|
QString qBaseName = quantityName;
|
||||||
if ( qBaseName.size() == 8 ) qBaseName.chop( 3 );
|
if ( qBaseName.size() == 8 ) qBaseName.chop( 3 );
|
||||||
while ( qBaseName.endsWith( "_" ) )
|
while ( qBaseName.endsWith( "_" ) )
|
||||||
qBaseName.chop( 1 );
|
qBaseName.chop( 1 );
|
||||||
return qBaseName.toStdString();
|
return qBaseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -252,7 +252,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool isValidEclipseCategory() const;
|
bool isValidEclipseCategory() const;
|
||||||
static std::string baseQuantityName( const std::string& quantityName );
|
static QString baseQuantityName( const QString& quantityName );
|
||||||
static std::tuple<int32_t, int32_t, int32_t> ijkTupleFromUiText( const std::string& s );
|
static std::tuple<int32_t, int32_t, int32_t> ijkTupleFromUiText( const std::string& s );
|
||||||
std::string formatUiTextRegionToRegion() const;
|
std::string formatUiTextRegionToRegion() const;
|
||||||
std::pair<int16_t, int16_t> regionToRegionPairFromUiText( const std::string& s );
|
std::pair<int16_t, int16_t> regionToRegionPairFromUiText( const std::string& s );
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
#include "RimPlotAxisProperties.h"
|
#include "RimPlotAxisProperties.h"
|
||||||
#include "RimSummaryCurve.h"
|
#include "RimSummaryCurve.h"
|
||||||
|
|
||||||
|
#include "RiuSummaryQuantityNameInfoProvider.h"
|
||||||
#include "RiuSummaryQwtPlot.h"
|
#include "RiuSummaryQwtPlot.h"
|
||||||
#include "RiuSummaryVectorDescriptionMap.h"
|
|
||||||
|
|
||||||
#include "qwt_plot_curve.h"
|
#include "qwt_plot_curve.h"
|
||||||
#include "qwt_scale_draw.h"
|
#include "qwt_scale_draw.h"
|
||||||
@ -226,8 +226,8 @@ QString RimSummaryPlotYAxisFormatter::autoAxisTitle() const
|
|||||||
{
|
{
|
||||||
if ( m_axisProperties->showDescription() )
|
if ( m_axisProperties->showDescription() )
|
||||||
{
|
{
|
||||||
quantityNameForDisplay = RiuSummaryVectorDescriptionMap::instance()->vectorLongName( quantityName,
|
quantityNameForDisplay = RiuSummaryQuantityNameInfoProvider::instance()
|
||||||
true );
|
->longNameFromQuantityName( quantityName, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_axisProperties->showAcronym() )
|
if ( m_axisProperties->showAcronym() )
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "RimSummaryCase.h"
|
#include "RimSummaryCase.h"
|
||||||
#include "RimSummaryCaseCollection.h"
|
#include "RimSummaryCaseCollection.h"
|
||||||
|
|
||||||
#include "RiuSummaryVectorDescriptionMap.h"
|
#include "RiuSummaryQuantityNameInfoProvider.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -139,7 +139,7 @@ QString RimSummaryPlotNameHelper::plotTitle() const
|
|||||||
{
|
{
|
||||||
if ( !title.isEmpty() ) title += ", ";
|
if ( !title.isEmpty() ) title += ", ";
|
||||||
title += QString::fromStdString(
|
title += QString::fromStdString(
|
||||||
RiuSummaryVectorDescriptionMap::instance()->vectorLongName( m_titleQuantity, true ) );
|
RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( m_titleQuantity, true ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( title.isEmpty() )
|
if ( title.isEmpty() )
|
||||||
|
@ -1,45 +1,48 @@
|
|||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include "RiuSummaryVectorDescriptionMap.h"
|
#include "RiuSummaryQuantityNameInfoProvider.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
TEST( RiuSummaryVectorDescriptionMap, TestInit )
|
TEST( RiuSummaryQuantityNameInfoProvider, TestInit )
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::string s( "SRSFC" );
|
std::string s( "SRSFC" );
|
||||||
auto test = RiuSummaryVectorDescriptionMap::instance()->vectorInfo( s );
|
auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s );
|
||||||
|
EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT );
|
||||||
|
|
||||||
EXPECT_TRUE( test.category == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT );
|
auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s );
|
||||||
EXPECT_TRUE( test.longName == "Reach brine concentration" );
|
EXPECT_TRUE( longName == "Reach brine concentration" );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::string s( "SRSFC" );
|
std::string s( "SRSFC" );
|
||||||
auto test = RiuSummaryVectorDescriptionMap::instance()->vectorLongName( s );
|
auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s );
|
||||||
|
|
||||||
EXPECT_TRUE( test == "Reach brine concentration" );
|
EXPECT_TRUE( test == "Reach brine concentration" );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::string s( "does not exist" );
|
std::string s( "does not exist" );
|
||||||
auto test = RiuSummaryVectorDescriptionMap::instance()->vectorInfo( s );
|
auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s );
|
||||||
|
EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_INVALID );
|
||||||
|
|
||||||
EXPECT_TRUE( test.category == RifEclipseSummaryAddress::SUMMARY_INVALID );
|
auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s );
|
||||||
EXPECT_TRUE( test.longName == "" );
|
|
||||||
|
EXPECT_TRUE( longName == "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::string s( "does not exist" );
|
std::string s( "does not exist" );
|
||||||
auto test = RiuSummaryVectorDescriptionMap::instance()->vectorLongName( s );
|
auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s );
|
||||||
|
|
||||||
EXPECT_TRUE( test == "" );
|
EXPECT_TRUE( test == "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::string s( "does not exist" );
|
std::string s( "does not exist" );
|
||||||
auto test = RiuSummaryVectorDescriptionMap::instance()->vectorLongName( s, true );
|
auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s, true );
|
||||||
|
|
||||||
EXPECT_TRUE( test == s );
|
EXPECT_TRUE( test == s );
|
||||||
}
|
}
|
||||||
@ -48,19 +51,20 @@ TEST( RiuSummaryVectorDescriptionMap, TestInit )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
TEST( RiuSummaryVectorDescriptionMap, TestCustomNaming )
|
TEST( RiuSummaryQuantityNameInfoProvider, TestCustomNaming )
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::string s( "SRSFCABC" );
|
std::string s( "SRSFCABC" );
|
||||||
auto test = RiuSummaryVectorDescriptionMap::instance()->vectorInfo( s );
|
auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s );
|
||||||
|
EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT );
|
||||||
|
|
||||||
EXPECT_TRUE( test.category == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT );
|
auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s );
|
||||||
EXPECT_TRUE( test.longName == "Reach brine concentration" );
|
EXPECT_TRUE( longName == "Reach brine concentration" );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::string s( "BHD__ABC" );
|
std::string s( "BHD__ABC" );
|
||||||
auto test = RiuSummaryVectorDescriptionMap::instance()->vectorLongName( s );
|
auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s );
|
||||||
|
|
||||||
EXPECT_TRUE( test == "Hydraulic head" );
|
EXPECT_TRUE( test == "Hydraulic head" );
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryCurveDefinitionKeywords.h
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryCurveDefSelection.h
|
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryCurveDefSelection.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryCurveDefSelectionDialog.h
|
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryCurveDefSelectionDialog.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryCurveDefSelectionEditor.h
|
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryCurveDefSelectionEditor.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryVectorDescriptionMap.h
|
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryQuantityNameInfoProvider.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuExpressionContextMenuManager.h
|
${CMAKE_CURRENT_LIST_DIR}/RiuExpressionContextMenuManager.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuCalculationsContextMenuManager.h
|
${CMAKE_CURRENT_LIST_DIR}/RiuCalculationsContextMenuManager.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuGridStatisticsHistogramWidget.h
|
${CMAKE_CURRENT_LIST_DIR}/RiuGridStatisticsHistogramWidget.h
|
||||||
@ -151,7 +151,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuContextMenuLauncher.cpp
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryCurveDefSelection.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryCurveDefSelection.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryCurveDefSelectionDialog.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryCurveDefSelectionDialog.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryCurveDefSelectionEditor.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryCurveDefSelectionEditor.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryVectorDescriptionMap.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryQuantityNameInfoProvider.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuExpressionContextMenuManager.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RiuExpressionContextMenuManager.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuCalculationsContextMenuManager.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RiuCalculationsContextMenuManager.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuGridStatisticsHistogramWidget.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RiuGridStatisticsHistogramWidget.cpp
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include "RimSummaryCaseMainCollection.h"
|
#include "RimSummaryCaseMainCollection.h"
|
||||||
|
|
||||||
#include "RiuSummaryCurveDefinitionKeywords.h"
|
#include "RiuSummaryCurveDefinitionKeywords.h"
|
||||||
#include "RiuSummaryVectorDescriptionMap.h"
|
#include "RiuSummaryQuantityNameInfoProvider.h"
|
||||||
|
|
||||||
#include "cafPdmPointer.h"
|
#include "cafPdmPointer.h"
|
||||||
#include "cafPdmUiFieldHandle.h"
|
#include "cafPdmUiFieldHandle.h"
|
||||||
@ -1506,8 +1506,9 @@ void RiuSummaryCurveDefSelection::appendOptionItemsForSubCategoriesAndVectors(
|
|||||||
|
|
||||||
if ( isVectorField )
|
if ( isVectorField )
|
||||||
{
|
{
|
||||||
std::string longVectorName = RiuSummaryVectorDescriptionMap::instance()->vectorLongName( itemName, true );
|
std::string longVectorName = RiuSummaryQuantityNameInfoProvider::instance()
|
||||||
displayName = QString::fromStdString( longVectorName );
|
->longNameFromQuantityName( itemName, true );
|
||||||
|
displayName = QString::fromStdString( longVectorName );
|
||||||
displayName += QString( " (%1)" ).arg( QString::fromStdString( itemName ) );
|
displayName += QString( " (%1)" ).arg( QString::fromStdString( itemName ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -16,33 +16,45 @@
|
|||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "RiuSummaryVectorDescriptionMap.h"
|
#include "RiuSummaryQuantityNameInfoProvider.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuSummaryVectorDescriptionMap* RiuSummaryVectorDescriptionMap::instance()
|
RiuSummaryQuantityNameInfoProvider* RiuSummaryQuantityNameInfoProvider::instance()
|
||||||
{
|
{
|
||||||
static RiuSummaryVectorDescriptionMap* singleton = new RiuSummaryVectorDescriptionMap;
|
static RiuSummaryQuantityNameInfoProvider* singleton = new RiuSummaryQuantityNameInfoProvider;
|
||||||
return singleton;
|
return singleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuSummaryVectorInfo RiuSummaryVectorDescriptionMap::vectorInfo( const std::string& vectorName )
|
RifEclipseSummaryAddress::SummaryVarCategory
|
||||||
|
RiuSummaryQuantityNameInfoProvider::categoryFromQuantityName( const std::string& quantity ) const
|
||||||
{
|
{
|
||||||
std::map<std::string, RiuSummaryVectorInfo>::iterator it = m_summaryToDescMap.find( vectorName );
|
auto info = quantityInfo( quantity );
|
||||||
|
|
||||||
|
return info.category;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuSummaryQuantityNameInfoProvider::RiuSummaryQuantityInfo
|
||||||
|
RiuSummaryQuantityNameInfoProvider::quantityInfo( const std::string& quantity ) const
|
||||||
|
{
|
||||||
|
auto it = m_summaryToDescMap.find( quantity );
|
||||||
|
|
||||||
if ( it != m_summaryToDescMap.end() )
|
if ( it != m_summaryToDescMap.end() )
|
||||||
{
|
{
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
else if ( vectorName.size() > 1 && vectorName[1] == 'U' )
|
else if ( quantity.size() > 1 && quantity[1] == 'U' )
|
||||||
{
|
{
|
||||||
// User defined vector name
|
// User defined vector name
|
||||||
|
|
||||||
std::string key = vectorName.substr( 0, 2 );
|
std::string key = quantity.substr( 0, 2 );
|
||||||
|
|
||||||
it = m_summaryToDescMap.find( key );
|
it = m_summaryToDescMap.find( key );
|
||||||
|
|
||||||
@ -51,11 +63,11 @@ RiuSummaryVectorInfo RiuSummaryVectorDescriptionMap::vectorInfo( const std::stri
|
|||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( vectorName.size() > 5 )
|
else if ( quantity.size() > 5 )
|
||||||
{
|
{
|
||||||
// Check for custom vector naming
|
// Check for custom vector naming
|
||||||
|
|
||||||
std::string baseName = vectorName.substr( 0, 5 );
|
std::string baseName = quantity.substr( 0, 5 );
|
||||||
while ( baseName.back() == '_' )
|
while ( baseName.back() == '_' )
|
||||||
baseName.pop_back();
|
baseName.pop_back();
|
||||||
|
|
||||||
@ -67,16 +79,16 @@ RiuSummaryVectorInfo RiuSummaryVectorDescriptionMap::vectorInfo( const std::stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return RiuSummaryVectorInfo();
|
return RiuSummaryQuantityInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::string RiuSummaryVectorDescriptionMap::vectorLongName( const std::string& vectorName,
|
std::string RiuSummaryQuantityNameInfoProvider::longNameFromQuantityName( const std::string& vectorName,
|
||||||
bool returnVectorNameIfNotFound )
|
bool returnVectorNameIfNotFound ) const
|
||||||
{
|
{
|
||||||
auto info = vectorInfo( vectorName );
|
auto info = quantityInfo( vectorName );
|
||||||
return info.category != RifEclipseSummaryAddress::SUMMARY_INVALID || !returnVectorNameIfNotFound ? info.longName
|
return info.category != RifEclipseSummaryAddress::SUMMARY_INVALID || !returnVectorNameIfNotFound ? info.longName
|
||||||
: vectorName;
|
: vectorName;
|
||||||
}
|
}
|
||||||
@ -84,7 +96,7 @@ std::string RiuSummaryVectorDescriptionMap::vectorLongName( const std::string& v
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuSummaryVectorDescriptionMap::RiuSummaryVectorDescriptionMap()
|
RiuSummaryQuantityNameInfoProvider::RiuSummaryQuantityNameInfoProvider()
|
||||||
{
|
{
|
||||||
populateFieldToInfoMap();
|
populateFieldToInfoMap();
|
||||||
}
|
}
|
||||||
@ -92,7 +104,7 @@ RiuSummaryVectorDescriptionMap::RiuSummaryVectorDescriptionMap()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuSummaryVectorDescriptionMap::populateFieldToInfoMap()
|
void RiuSummaryQuantityNameInfoProvider::populateFieldToInfoMap()
|
||||||
{
|
{
|
||||||
using A = RifEclipseSummaryAddress;
|
using A = RifEclipseSummaryAddress;
|
||||||
|
|
@ -23,38 +23,41 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class RiuSummaryVectorInfo
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RiuSummaryVectorInfo()
|
|
||||||
: category( RifEclipseSummaryAddress::SUMMARY_INVALID )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
RiuSummaryVectorInfo( RifEclipseSummaryAddress::SummaryVarCategory category, const std::string& longName )
|
|
||||||
: category( category )
|
|
||||||
, longName( longName )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
RifEclipseSummaryAddress::SummaryVarCategory category;
|
|
||||||
std::string longName;
|
|
||||||
};
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
class RiuSummaryVectorDescriptionMap
|
class RiuSummaryQuantityNameInfoProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static RiuSummaryVectorDescriptionMap* instance();
|
static RiuSummaryQuantityNameInfoProvider* instance();
|
||||||
|
|
||||||
RiuSummaryVectorInfo vectorInfo( const std::string& vectorName );
|
RifEclipseSummaryAddress::SummaryVarCategory categoryFromQuantityName( const std::string& quantity ) const;
|
||||||
std::string vectorLongName( const std::string& vectorName, bool returnVectorNameIfNotFound = false );
|
std::string longNameFromQuantityName( const std::string& quantity, bool returnVectorNameIfNotFound = false ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RiuSummaryVectorDescriptionMap();
|
class RiuSummaryQuantityInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RiuSummaryQuantityInfo()
|
||||||
|
: category( RifEclipseSummaryAddress::SUMMARY_INVALID )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
RiuSummaryQuantityInfo( RifEclipseSummaryAddress::SummaryVarCategory category, const std::string& longName )
|
||||||
|
: category( category )
|
||||||
|
, longName( longName )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
RifEclipseSummaryAddress::SummaryVarCategory category;
|
||||||
|
std::string longName;
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
RiuSummaryQuantityNameInfoProvider();
|
||||||
void populateFieldToInfoMap();
|
void populateFieldToInfoMap();
|
||||||
|
|
||||||
|
RiuSummaryQuantityInfo quantityInfo( const std::string& quantity ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<std::string, RiuSummaryVectorInfo> m_summaryToDescMap;
|
std::map<std::string, RiuSummaryQuantityInfo> m_summaryToDescMap;
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user