mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Performance : Use std::string when parsing address strings
This commit is contained in:
parent
f89cd51416
commit
9838f766cb
2
.gitignore
vendored
2
.gitignore
vendored
@ -78,3 +78,5 @@ enc_temp_folder
|
||||
|
||||
#Python
|
||||
*.pyc
|
||||
|
||||
*.ESMRY
|
||||
|
@ -105,6 +105,17 @@ bool RiaStdStringTools::startsWithAlphabetic( const std::string& s )
|
||||
return isalpha( s[0] ) != 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RiaStdStringTools::toUpper( const std::string& s )
|
||||
{
|
||||
auto strCopy( s );
|
||||
std::transform( strCopy.begin(), strCopy.end(), strCopy.begin(), []( unsigned char c ) { return std::toupper( c ); } );
|
||||
|
||||
return strCopy;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -120,15 +131,25 @@ bool RiaStdStringTools::endsWith( const std::string& mainStr, const std::string&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::string> RiaStdStringTools::splitStringBySpace( const std::string& s )
|
||||
std::vector<std::string> RiaStdStringTools::splitString( const std::string& s, char delimiter )
|
||||
{
|
||||
std::vector<std::string> words;
|
||||
|
||||
splitByDelimiter( s, words );
|
||||
splitByDelimiter( s, words, delimiter );
|
||||
|
||||
return words;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RiaStdStringTools::joinStrings( const std::vector<std::string>& s, char delimiter )
|
||||
{
|
||||
std::string delimiterString( 1, delimiter );
|
||||
|
||||
return join( s.begin(), s.end(), delimiterString );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <numeric>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -39,9 +39,12 @@ public:
|
||||
static bool containsAlphabetic( const std::string& s );
|
||||
static bool startsWithAlphabetic( const std::string& s );
|
||||
|
||||
static std::string toUpper( const std::string& s );
|
||||
|
||||
static bool endsWith( const std::string& mainStr, const std::string& toMatch );
|
||||
|
||||
static std::vector<std::string> splitStringBySpace( const std::string& s );
|
||||
static std::vector<std::string> splitString( const std::string& s, char delimiter );
|
||||
static std::string joinStrings( const std::vector<std::string>& s, char delimiter );
|
||||
|
||||
static int computeEditDistance( const std::string& x, const std::string& y );
|
||||
|
||||
@ -57,13 +60,22 @@ private:
|
||||
template <class Container>
|
||||
void RiaStdStringTools::splitByDelimiter( const std::string& str, Container& cont, char delimiter )
|
||||
{
|
||||
std::stringstream ss( str );
|
||||
std::string token;
|
||||
while ( std::getline( ss, token, delimiter ) )
|
||||
size_t start;
|
||||
size_t end = 0;
|
||||
|
||||
while ( ( start = str.find_first_not_of( delimiter, end ) ) != std::string::npos )
|
||||
{
|
||||
if ( token.find_first_not_of( delimiter ) != std::string::npos )
|
||||
{
|
||||
cont.push_back( token );
|
||||
}
|
||||
end = str.find( delimiter, start );
|
||||
cont.push_back( str.substr( start, end - start ) );
|
||||
}
|
||||
}
|
||||
|
||||
template <typename InputIt>
|
||||
std::string join( InputIt begin, InputIt end, const std::string& separator = ", " )
|
||||
{
|
||||
auto compose_key = [&separator]( std::string& key, const std::string& key_part ) -> std::string {
|
||||
return key.empty() ? key_part : key + separator + key_part;
|
||||
};
|
||||
|
||||
return std::accumulate( begin, end, std::string(), compose_key );
|
||||
}
|
||||
|
@ -319,7 +319,8 @@ bool RifCsvUserDataParser::parseColumnInfo( QTextStream* dataStr
|
||||
for ( int iCol = 0; iCol < colCount; iCol++ )
|
||||
{
|
||||
QString colName = RiaTextStringTools::trimAndRemoveDoubleSpaces( lineColumns[iCol] );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( colName.toStdString() );
|
||||
RifEclipseSummaryAddress addr =
|
||||
RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( colName.toStdString() );
|
||||
Column col = Column::createColumnInfoFromCsvData( addr, "" );
|
||||
|
||||
columnInfoList->push_back( col );
|
||||
@ -520,7 +521,7 @@ bool RifCsvUserDataParser::parseLineBasedData()
|
||||
|
||||
{
|
||||
auto textAddr = dataItems[colIndexes[(size_t)CsvLineBasedColumnType::VECTOR]];
|
||||
auto addr = RifEclipseSummaryAddress::fromEclipseTextAddress( textAddr.toStdString() );
|
||||
auto addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( textAddr.toStdString() );
|
||||
auto errAddr = addr;
|
||||
errAddr.setAsErrorResult();
|
||||
|
||||
|
@ -112,173 +112,47 @@ RifEclipseSummaryAddress::RifEclipseSummaryAddress( SummaryVarCategory
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Column header text format: [<ER|ERR|ERROR>:]<VECTOR>:<CATEGORY_PARAM_NAME1>[:<CATEGORY_PARAM_NAME2>][....]
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RifEclipseSummaryAddress::fromEclipseTextAddress( const std::string& textAddress )
|
||||
RifEclipseSummaryAddress RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( const std::string& textAddress )
|
||||
{
|
||||
QStringList names = QString().fromStdString( textAddress ).split( ":" );
|
||||
auto tokens = RiaStdStringTools::splitString( textAddress, ':' );
|
||||
|
||||
bool isErrorResult = false;
|
||||
|
||||
if ( names.size() > 1 )
|
||||
if ( tokens.size() > 1 )
|
||||
{
|
||||
QString name = names[0].trimmed();
|
||||
if ( name.compare( "ER", Qt::CaseInsensitive ) == 0 || name.compare( "ERR", Qt::CaseInsensitive ) == 0 ||
|
||||
name.compare( "ERROR", Qt::CaseInsensitive ) == 0 )
|
||||
auto firstToken = RiaStdStringTools::trimString( tokens[0] );
|
||||
firstToken = RiaStdStringTools::toUpper( firstToken );
|
||||
|
||||
if ( ( firstToken == "ER" ) || ( firstToken == "ERR" ) || ( firstToken == "ERROR" ) )
|
||||
{
|
||||
isErrorResult = true;
|
||||
names.pop_front();
|
||||
tokens.erase( tokens.begin() );
|
||||
}
|
||||
}
|
||||
else if ( names.empty() )
|
||||
{
|
||||
return RifEclipseSummaryAddress();
|
||||
}
|
||||
|
||||
std::string quantityName = names[0].trimmed().toStdString();
|
||||
names.pop_front();
|
||||
|
||||
SummaryVarCategory category = identifyCategory( quantityName );
|
||||
|
||||
RifEclipseSummaryAddress address;
|
||||
switch ( category )
|
||||
{
|
||||
case SUMMARY_FIELD:
|
||||
address = fieldAddress( quantityName );
|
||||
break;
|
||||
|
||||
case SUMMARY_AQUIFER:
|
||||
if ( names.size() > 0 )
|
||||
address = aquiferAddress( quantityName, RiaStdStringTools::toInt( names[0].toStdString() ) );
|
||||
break;
|
||||
|
||||
case SUMMARY_NETWORK:
|
||||
address = networkAddress( quantityName );
|
||||
break;
|
||||
|
||||
case SUMMARY_MISC:
|
||||
address = miscAddress( quantityName );
|
||||
break;
|
||||
|
||||
case SUMMARY_REGION:
|
||||
if ( names.size() > 0 )
|
||||
address = regionAddress( quantityName, RiaStdStringTools::toInt( names[0].toStdString() ) );
|
||||
break;
|
||||
|
||||
case SUMMARY_REGION_2_REGION:
|
||||
if ( names.size() > 0 )
|
||||
{
|
||||
QStringList regions = names[0].trimmed().split( "-" );
|
||||
if ( regions.size() == 2 )
|
||||
{
|
||||
address = regionToRegionAddress( quantityName,
|
||||
RiaStdStringTools::toInt( regions[0].toStdString() ),
|
||||
RiaStdStringTools::toInt( regions[1].toStdString() ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SUMMARY_WELL_GROUP:
|
||||
if ( names.size() > 0 ) address = wellGroupAddress( quantityName, names[0].toStdString() );
|
||||
break;
|
||||
|
||||
case SUMMARY_WELL:
|
||||
if ( names.size() > 0 ) address = wellAddress( quantityName, names[0].toStdString() );
|
||||
break;
|
||||
|
||||
case SUMMARY_WELL_COMPLETION:
|
||||
if ( names.size() > 1 )
|
||||
{
|
||||
QStringList ijk = names[1].trimmed().split( "," );
|
||||
if ( ijk.size() == 3 )
|
||||
{
|
||||
address = wellCompletionAddress( quantityName,
|
||||
names[0].toStdString(),
|
||||
RiaStdStringTools::toInt( ijk[0].toStdString() ),
|
||||
RiaStdStringTools::toInt( ijk[1].toStdString() ),
|
||||
RiaStdStringTools::toInt( ijk[2].toStdString() ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SUMMARY_WELL_LGR:
|
||||
if ( names.size() > 1 )
|
||||
address = wellLgrAddress( quantityName, names[0].toStdString(), names[1].toStdString() );
|
||||
break;
|
||||
|
||||
case SUMMARY_WELL_COMPLETION_LGR:
|
||||
if ( names.size() > 2 )
|
||||
{
|
||||
QStringList ijk = names[2].trimmed().split( "," );
|
||||
if ( ijk.size() == 3 )
|
||||
{
|
||||
address = wellCompletionLgrAddress( quantityName,
|
||||
names[0].toStdString(),
|
||||
names[1].toStdString(),
|
||||
RiaStdStringTools::toInt( ijk[0].toStdString() ),
|
||||
RiaStdStringTools::toInt( ijk[1].toStdString() ),
|
||||
RiaStdStringTools::toInt( ijk[2].toStdString() ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SUMMARY_WELL_SEGMENT:
|
||||
if ( names.size() > 1 )
|
||||
address = wellSegmentAddress( quantityName,
|
||||
names[0].toStdString(),
|
||||
RiaStdStringTools::toInt( names[1].toStdString() ) );
|
||||
break;
|
||||
|
||||
case SUMMARY_BLOCK:
|
||||
if ( names.size() > 0 )
|
||||
{
|
||||
QStringList ijk = names[0].trimmed().split( "," );
|
||||
if ( ijk.size() == 3 )
|
||||
{
|
||||
address = blockAddress( quantityName,
|
||||
RiaStdStringTools::toInt( ijk[0].toStdString() ),
|
||||
RiaStdStringTools::toInt( ijk[1].toStdString() ),
|
||||
RiaStdStringTools::toInt( ijk[2].toStdString() ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SUMMARY_BLOCK_LGR:
|
||||
if ( names.size() > 1 )
|
||||
{
|
||||
QStringList ijk = names[1].trimmed().split( "," );
|
||||
if ( ijk.size() == 3 )
|
||||
{
|
||||
address = blockLgrAddress( quantityName,
|
||||
names[0].toStdString(),
|
||||
RiaStdStringTools::toInt( ijk[0].toStdString() ),
|
||||
RiaStdStringTools::toInt( ijk[1].toStdString() ),
|
||||
RiaStdStringTools::toInt( ijk[2].toStdString() ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SUMMARY_CALCULATED:
|
||||
address = calculatedAddress( quantityName, RiaStdStringTools::toInt( names[0].toStdString() ) );
|
||||
break;
|
||||
|
||||
case SUMMARY_IMPORTED:
|
||||
case SUMMARY_INVALID:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
auto address = fromTokens( tokens );
|
||||
|
||||
if ( address.category() == SUMMARY_INVALID || address.category() == SUMMARY_IMPORTED )
|
||||
{
|
||||
// Address category not recognized, use complete text address
|
||||
// QString addr = QString::fromStdString(quantityName) + (!names.empty() ? (":" + names.join(":")) : "");
|
||||
QStringList addr = names;
|
||||
addr.push_front( QString::fromStdString( quantityName ) );
|
||||
address = importedAddress( addr.join( ":" ).toStdString() );
|
||||
// Address category not recognized, use incoming text string without error prefix as quantity name
|
||||
auto text = RiaStdStringTools::joinStrings( tokens, ':' );
|
||||
address = importedAddress( text );
|
||||
}
|
||||
|
||||
if ( isErrorResult ) address.setAsErrorResult();
|
||||
return address;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RifEclipseSummaryAddress::fromEclipseTextAddress( const std::string& textAddress )
|
||||
{
|
||||
auto tokens = RiaStdStringTools::splitString( textAddress, ':' );
|
||||
|
||||
return fromTokens( tokens );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -286,9 +160,6 @@ RifEclipseSummaryAddress::SummaryVarCategory RifEclipseSummaryAddress::identifyC
|
||||
{
|
||||
if ( quantityName.size() < 3 || quantityName.size() > 8 ) return SUMMARY_INVALID;
|
||||
|
||||
QRegExp regexp( "^[A-Za-z0-9_\\-+#]*$" );
|
||||
if ( !regexp.exactMatch( QString::fromStdString( quantityName ) ) ) return SUMMARY_INVALID;
|
||||
|
||||
// First, try to lookup vector in vector table
|
||||
auto category = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( quantityName );
|
||||
if ( category != SUMMARY_INVALID ) return category;
|
||||
@ -861,6 +732,148 @@ bool RifEclipseSummaryAddress::hasAccumulatedData() const
|
||||
return qBaseName.endsWith( "T" ) || qBaseName.endsWith( "TH" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector<std::string>& tokens )
|
||||
{
|
||||
if ( tokens.empty() )
|
||||
{
|
||||
return RifEclipseSummaryAddress();
|
||||
}
|
||||
|
||||
std::string quantityName;
|
||||
std::string token1;
|
||||
std::string token2;
|
||||
|
||||
quantityName = tokens[0];
|
||||
|
||||
if ( tokens.size() > 1 ) token1 = tokens[1];
|
||||
if ( tokens.size() > 2 ) token2 = tokens[2];
|
||||
|
||||
SummaryVarCategory category = identifyCategory( quantityName );
|
||||
|
||||
switch ( category )
|
||||
{
|
||||
case SUMMARY_FIELD:
|
||||
return fieldAddress( quantityName );
|
||||
|
||||
case SUMMARY_AQUIFER:
|
||||
if ( !token1.empty() ) return aquiferAddress( quantityName, RiaStdStringTools::toInt( token1 ) );
|
||||
break;
|
||||
|
||||
case SUMMARY_NETWORK:
|
||||
return networkAddress( quantityName );
|
||||
break;
|
||||
|
||||
case SUMMARY_MISC:
|
||||
return miscAddress( quantityName );
|
||||
break;
|
||||
|
||||
case SUMMARY_REGION:
|
||||
if ( !token1.empty() ) return regionAddress( quantityName, RiaStdStringTools::toInt( token1 ) );
|
||||
break;
|
||||
|
||||
case SUMMARY_REGION_2_REGION:
|
||||
if ( !token1.empty() )
|
||||
{
|
||||
auto regions = RiaStdStringTools::splitString( token1, '-' );
|
||||
if ( regions.size() == 2 )
|
||||
{
|
||||
return regionToRegionAddress( quantityName,
|
||||
RiaStdStringTools::toInt( regions[0] ),
|
||||
RiaStdStringTools::toInt( regions[1] ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SUMMARY_WELL_GROUP:
|
||||
if ( !token1.empty() ) return wellGroupAddress( quantityName, token1 );
|
||||
break;
|
||||
|
||||
case SUMMARY_WELL:
|
||||
if ( !token1.empty() ) return wellAddress( quantityName, token1 );
|
||||
break;
|
||||
|
||||
case SUMMARY_WELL_COMPLETION:
|
||||
if ( !token2.empty() )
|
||||
{
|
||||
auto ijk = RiaStdStringTools::splitString( token2, ',' );
|
||||
if ( ijk.size() == 3 )
|
||||
{
|
||||
return wellCompletionAddress( quantityName,
|
||||
token1,
|
||||
RiaStdStringTools::toInt( ijk[0] ),
|
||||
RiaStdStringTools::toInt( ijk[1] ),
|
||||
RiaStdStringTools::toInt( ijk[2] ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SUMMARY_WELL_LGR:
|
||||
if ( !token1.empty() && !token2.empty() ) return wellLgrAddress( quantityName, token1, token2 );
|
||||
break;
|
||||
|
||||
case SUMMARY_WELL_COMPLETION_LGR:
|
||||
if ( tokens.size() > 2 )
|
||||
{
|
||||
auto token3 = tokens[3];
|
||||
auto ijk = RiaStdStringTools::splitString( token3, ',' );
|
||||
if ( ijk.size() == 3 )
|
||||
{
|
||||
return wellCompletionLgrAddress( quantityName,
|
||||
token1,
|
||||
token2,
|
||||
RiaStdStringTools::toInt( ijk[0] ),
|
||||
RiaStdStringTools::toInt( ijk[1] ),
|
||||
RiaStdStringTools::toInt( ijk[2] ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SUMMARY_WELL_SEGMENT:
|
||||
if ( !token2.empty() )
|
||||
return wellSegmentAddress( quantityName, token1, RiaStdStringTools::toInt( token2 ) );
|
||||
break;
|
||||
|
||||
case SUMMARY_BLOCK:
|
||||
if ( !token1.empty() )
|
||||
{
|
||||
auto ijk = RiaStdStringTools::splitString( token1, ',' );
|
||||
if ( ijk.size() == 3 )
|
||||
{
|
||||
return blockAddress( quantityName,
|
||||
RiaStdStringTools::toInt( ijk[0] ),
|
||||
RiaStdStringTools::toInt( ijk[1] ),
|
||||
RiaStdStringTools::toInt( ijk[2] ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SUMMARY_BLOCK_LGR:
|
||||
if ( !token2.empty() )
|
||||
{
|
||||
auto ijk = RiaStdStringTools::splitString( token2, ',' );
|
||||
if ( ijk.size() == 3 )
|
||||
{
|
||||
return blockLgrAddress( quantityName,
|
||||
token1,
|
||||
RiaStdStringTools::toInt( ijk[0] ),
|
||||
RiaStdStringTools::toInt( ijk[1] ),
|
||||
RiaStdStringTools::toInt( ijk[2] ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SUMMARY_IMPORTED:
|
||||
case SUMMARY_INVALID:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return RifEclipseSummaryAddress();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -125,6 +125,8 @@ public:
|
||||
// Static specialized creation methods
|
||||
|
||||
static RifEclipseSummaryAddress fromEclipseTextAddress( const std::string& textAddress );
|
||||
static RifEclipseSummaryAddress fromEclipseTextAddressParseErrorTokens( const std::string& textAddress );
|
||||
|
||||
static SummaryVarCategory identifyCategory( const std::string& quantityName );
|
||||
|
||||
static RifEclipseSummaryAddress fieldAddress( const std::string& quantityName );
|
||||
@ -209,6 +211,8 @@ public:
|
||||
static QString baseQuantityName( const QString& quantityName );
|
||||
|
||||
private:
|
||||
static RifEclipseSummaryAddress fromTokens( const std::vector<std::string>& tokens );
|
||||
|
||||
bool isValidEclipseCategory() const;
|
||||
static std::tuple<int32_t, int32_t, int32_t> ijkTupleFromUiText( const std::string& s );
|
||||
std::string formatUiTextRegionToRegion() const;
|
||||
|
@ -365,7 +365,7 @@ bool RifEclipseUserDataKeywordTools::knownKeywordsWithZeroRequiredHeaderLines( c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifEclipseUserDataKeywordTools::extractThreeInts( int* cellI, int* cellJ, int* cellK, const std::string& line )
|
||||
{
|
||||
std::vector<std::string> words = RiaStdStringTools::splitStringBySpace( line );
|
||||
std::vector<std::string> words = RiaStdStringTools::splitString( line, ' ' );
|
||||
if ( words.size() > 2 )
|
||||
{
|
||||
*cellI = RiaStdStringTools::toInt( words[0] );
|
||||
|
@ -392,7 +392,7 @@ std::pair<std::set<RifEclipseSummaryAddress>, std::map<RifEclipseSummaryAddress,
|
||||
std::set<RifEclipseSummaryAddress> addresses;
|
||||
std::map<RifEclipseSummaryAddress, std::string> addressToNodeIndexMap;
|
||||
|
||||
for ( auto keyword : keywords )
|
||||
for ( const auto& keyword : keywords )
|
||||
{
|
||||
auto eclAdr = RifEclipseSummaryAddress::fromEclipseTextAddress( keyword );
|
||||
|
||||
|
@ -51,7 +51,7 @@ caf::PdmObjectHandle* RimSummaryCase_summaryVectorValues::execute()
|
||||
auto* summaryCase = self<RimSummaryCase>();
|
||||
RifSummaryReaderInterface* sumReader = summaryCase->summaryReader();
|
||||
|
||||
auto adr = RifEclipseSummaryAddress::fromEclipseTextAddress( m_addressString().toStdString() );
|
||||
auto adr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( m_addressString().toStdString() );
|
||||
|
||||
std::vector<double> values;
|
||||
|
||||
@ -205,7 +205,7 @@ caf::PdmObjectHandle* RimSummaryCase_resampleValues::execute()
|
||||
auto* summaryCase = self<RimSummaryCase>();
|
||||
RifSummaryReaderInterface* sumReader = summaryCase->summaryReader();
|
||||
|
||||
auto adr = RifEclipseSummaryAddress::fromEclipseTextAddress( m_addressString().toStdString() );
|
||||
auto adr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( m_addressString().toStdString() );
|
||||
|
||||
auto dataObject = new RimcSummaryResampleData();
|
||||
|
||||
|
@ -12,7 +12,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Field )
|
||||
{
|
||||
std::string addrString = "FOPT";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_FIELD, addr.category() );
|
||||
@ -24,7 +24,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Aquifer )
|
||||
{
|
||||
std::string addrString = "AAQR:456";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_AQUIFER, addr.category() );
|
||||
@ -37,7 +37,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Network )
|
||||
{
|
||||
std::string addrString = "NETW";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_NETWORK, addr.category() );
|
||||
@ -49,7 +49,7 @@ TEST( RifEclipseSummaryAddressTest, DISABLED_TestEclipseAddressParsing_Misc )
|
||||
{
|
||||
std::string addrString = "CPU";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_MISC, addr.category() );
|
||||
@ -61,7 +61,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Region )
|
||||
{
|
||||
std::string addrString = "RPR:7081";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_REGION, addr.category() );
|
||||
@ -74,7 +74,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_RegionToRegion )
|
||||
{
|
||||
std::string addrString = "ROFR:7081-8001";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION, addr.category() );
|
||||
@ -88,7 +88,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellGroup )
|
||||
{
|
||||
std::string addrString = "GOPR:WELLS1";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_GROUP, addr.category() );
|
||||
@ -101,7 +101,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Well )
|
||||
{
|
||||
std::string addrString = "WOPR:B-2H";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL, addr.category() );
|
||||
@ -114,7 +114,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellCompletion )
|
||||
{
|
||||
std::string addrString = "COFRL:B-1H:15,13,14";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION, addr.category() );
|
||||
@ -130,7 +130,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellLgr )
|
||||
{
|
||||
std::string addrString = "LWABC:LGRNA:B-10H";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_LGR, addr.category() );
|
||||
@ -144,7 +144,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellCompletionLgr
|
||||
{
|
||||
std::string addrString = "LCGAS:LGR1:B-1H:11,12,13";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR, addr.category() );
|
||||
@ -161,7 +161,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellSegment )
|
||||
{
|
||||
std::string addrString = "SOFR:B-5H:32";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT, addr.category() );
|
||||
@ -175,7 +175,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Block )
|
||||
{
|
||||
std::string addrString = "BPR:123,122,121";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_BLOCK, addr.category() );
|
||||
@ -190,7 +190,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_BlockLgr )
|
||||
{
|
||||
std::string addrString = "LBABC:LGRN:45,47,49";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR, addr.category() );
|
||||
@ -206,7 +206,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Imported )
|
||||
{
|
||||
std::string addrString = "FAULT (Imp)";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_IMPORTED, addr.category() );
|
||||
@ -218,7 +218,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_ErrorResult1 )
|
||||
{
|
||||
std::string addrString = "ER:AAQR:456";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_AQUIFER, addr.category() );
|
||||
@ -231,7 +231,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_ErrorResult2 )
|
||||
{
|
||||
std::string addrString = "ERR:LCGAS:LGR1:B-1H:11,12,13";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR, addr.category() );
|
||||
@ -248,7 +248,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_ErrorResult3 )
|
||||
{
|
||||
std::string addrString = "ERROR:FAULT (Imp)";
|
||||
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString );
|
||||
|
||||
EXPECT_TRUE( addr.isValid() );
|
||||
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_IMPORTED, addr.category() );
|
||||
|
@ -108,7 +108,7 @@ TEST( DISABLED_RiuSummaryQuantityNameInfoProvider, PerformanceLookup )
|
||||
{
|
||||
for ( const auto& s : values )
|
||||
{
|
||||
auto category = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s );
|
||||
RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ TEST( OpmSummaryTests, ReadOpmSummaryDataListContent )
|
||||
auto s2 = extEsmryKeywords[i];
|
||||
EXPECT_STREQ( s1.c_str(), s2.c_str() );
|
||||
|
||||
RifEclipseSummaryAddress eclAdr = RifEclipseSummaryAddress::fromEclipseTextAddress( s1 );
|
||||
RifEclipseSummaryAddress eclAdr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( s1 );
|
||||
EXPECT_TRUE( eclAdr.isValid() );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user