Skip to content

Commit

Permalink
9498 Add parsing of network name
Browse files Browse the repository at this point in the history
Use merged commit
  • Loading branch information
magnesj committed Aug 14, 2023
1 parent 7a65690 commit 0bada50
Show file tree
Hide file tree
Showing 33 changed files with 302 additions and 156 deletions.
24 changes: 24 additions & 0 deletions ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ std::set<std::string> RiaSummaryAddressAnalyzer::groupNames() const
return keysInMap( m_groupNames );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RiaSummaryAddressAnalyzer::networkNames() const
{
return keysInMap( m_networkNames );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -207,13 +215,15 @@ std::vector<std::vector<RifEclipseSummaryAddress>> RiaSummaryAddressAnalyzer::ad
{
auto wellAdr = valuesInMap( m_wellNames );
auto groupAdr = valuesInMap( m_groupNames );
auto networkAdr = valuesInMap( m_networkNames );
auto regionAdr = valuesInMap( m_regionNumbers );
auto blockAdr = valuesInMap( m_blocks );
auto aquiferAdr = valuesInMap( m_aquifers );

std::vector<std::vector<RifEclipseSummaryAddress>> groupedByObject;
groupedByObject.insert( groupedByObject.end(), wellAdr.begin(), wellAdr.end() );
groupedByObject.insert( groupedByObject.end(), groupAdr.begin(), groupAdr.end() );
groupedByObject.insert( groupedByObject.end(), networkAdr.begin(), networkAdr.end() );
groupedByObject.insert( groupedByObject.end(), regionAdr.begin(), regionAdr.end() );
groupedByObject.insert( groupedByObject.end(), blockAdr.begin(), blockAdr.end() );
groupedByObject.insert( groupedByObject.end(), aquiferAdr.begin(), aquiferAdr.end() );
Expand Down Expand Up @@ -255,6 +265,14 @@ std::vector<QString> RiaSummaryAddressAnalyzer::identifierTexts( RifEclipseSumma
identifierStrings.push_back( QString::fromStdString( key ) );
}
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_NETWORK )
{
auto keys = keysInMap( m_networkNames );
for ( const auto& key : keys )
{
identifierStrings.push_back( QString::fromStdString( key ) );
}
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_BLOCK )
{
auto keys = keysInMap( m_blocks );
Expand Down Expand Up @@ -345,6 +363,7 @@ void RiaSummaryAddressAnalyzer::clear()
m_quantities.clear();
m_wellNames.clear();
m_groupNames.clear();
m_networkNames.clear();
m_regionNumbers.clear();
m_categories.clear();
m_wellCompletions.clear();
Expand Down Expand Up @@ -425,6 +444,11 @@ void RiaSummaryAddressAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAdd
m_groupNames.insert( { address.groupName(), address } );
}

if ( !address.networkName().empty() )
{
m_networkNames.insert( { address.networkName(), address } );
}

if ( address.regionNumber() != -1 )
{
m_regionNumbers.insert( { address.regionNumber(), address } );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class RiaSummaryAddressAnalyzer

std::set<std::string> wellNames() const;
std::set<std::string> groupNames() const;
std::set<std::string> networkNames() const;
std::set<int> regionNumbers() const;

std::set<std::string> wellCompletions( const std::string& wellName ) const;
Expand Down Expand Up @@ -94,6 +95,7 @@ class RiaSummaryAddressAnalyzer
std::vector<RifEclipseSummaryAddress> m_otherCategory;
std::multimap<std::string, RifEclipseSummaryAddress> m_wellNames;
std::multimap<std::string, RifEclipseSummaryAddress> m_groupNames;
std::multimap<std::string, RifEclipseSummaryAddress> m_networkNames;
std::multimap<int, RifEclipseSummaryAddress> m_regionNumbers;
std::set<std::pair<std::string, std::string>> m_wellCompletions;
std::set<std::pair<std::string, int>> m_wellSegmentNumbers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,20 +249,7 @@ RimSummaryCurve* RicPlotProductionRateFeature::addSummaryCurve( RimSummaryPlot*
CVF_ASSERT( summaryCase );
CVF_ASSERT( well );

RifEclipseSummaryAddress addr( RifEclipseSummaryAddress::SUMMARY_WELL,
vectorName.toStdString(),
-1,
-1,
"",
well->name().toStdString(),
-1,
"",
-1,
-1,
-1,
-1,
false,
-1 );
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::wellAddress( vectorName.toStdString(), well->name().toStdString(), -1 );

if ( !summaryCase->summaryReader()->hasAddress( addr ) )
{
Expand Down
2 changes: 2 additions & 0 deletions ApplicationLibCode/FileInterface/RifEclEclipseSummary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode( const ecl::smspec_node& ertSu
int regionNumber( -1 );
int regionNumber2( -1 );
std::string groupName;
std::string networkName;
std::string wellName;
int wellSegmentNumber( -1 );
std::string lgrName;
Expand Down Expand Up @@ -240,6 +241,7 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode( const ecl::smspec_node& ertSu
regionNumber,
regionNumber2,
groupName,
networkName,
wellName,
wellSegmentNumber,
lgrName,
Expand Down
24 changes: 19 additions & 5 deletions ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ RifEclipseSummaryAddress::RifEclipseSummaryAddress( SummaryVarCategory category,
case SUMMARY_GROUP:
m_groupName = identifiers[INPUT_GROUP_NAME];
break;
case SUMMARY_NETWORK:
m_networkName = identifiers[INPUT_NETWORK_NAME];
break;
case SUMMARY_WELL:
m_wellName = identifiers[INPUT_WELL_NAME];
break;
Expand Down Expand Up @@ -114,6 +117,7 @@ RifEclipseSummaryAddress::RifEclipseSummaryAddress( SummaryVarCategory category,
int16_t regionNumber,
int16_t regionNumber2,
const std::string& groupName,
const std::string& networkName,
const std::string& wellName,
int16_t wellSegmentNumber,
const std::string& lgrName,
Expand All @@ -128,6 +132,7 @@ RifEclipseSummaryAddress::RifEclipseSummaryAddress( SummaryVarCategory category,
, m_regionNumber( regionNumber )
, m_regionNumber2( regionNumber2 )
, m_groupName( groupName )
, m_networkName( networkName )
, m_wellName( wellName )
, m_wellSegmentNumber( wellSegmentNumber )
, m_lgrName( lgrName )
Expand Down Expand Up @@ -229,11 +234,13 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::aquiferAddress( const std::st
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseSummaryAddress RifEclipseSummaryAddress::networkAddress( const std::string& vectorName, int calculationId )
RifEclipseSummaryAddress
RifEclipseSummaryAddress::networkAddress( const std::string& vectorName, const std::string& networkName, int calculationId )
{
RifEclipseSummaryAddress addr;
addr.m_variableCategory = SUMMARY_NETWORK;
addr.m_vectorName = vectorName;
addr.m_networkName = networkName;
addr.m_id = calculationId;
return addr;
}
Expand Down Expand Up @@ -537,6 +544,11 @@ std::string RifEclipseSummaryAddress::itemUiText() const
text += groupName();
}
break;
case SUMMARY_NETWORK:
{
text += networkName();
}
break;
case SUMMARY_WELL:
{
text += wellName();
Expand Down Expand Up @@ -608,6 +620,8 @@ std::string RifEclipseSummaryAddress::addressComponentUiText( RifEclipseSummaryA
return wellName();
case INPUT_GROUP_NAME:
return groupName();
case INPUT_NETWORK_NAME:
return networkName();
case INPUT_CELL_IJK:
return blockAsString();
case INPUT_LGR_NAME:
Expand Down Expand Up @@ -795,7 +809,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector
break;

case SUMMARY_NETWORK:
return networkAddress( vectorName );
return networkAddress( vectorName, token1 );
break;

case SUMMARY_MISC:
Expand Down Expand Up @@ -854,8 +868,8 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector
case SUMMARY_WELL_COMPLETION_LGR:
if ( tokens.size() > 2 )
{
auto token3 = tokens[3];
auto ijk = RiaStdStringTools::splitString( token3, ',' );
const auto& token3 = tokens[3];
const auto ijk = RiaStdStringTools::splitString( token3, ',' );
if ( ijk.size() == 3 )
{
RiaStdStringTools::toInt( ijk[0], intValue0 );
Expand Down Expand Up @@ -913,7 +927,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector
break;
}

return RifEclipseSummaryAddress();
return {};
}

//--------------------------------------------------------------------------------------------------
Expand Down
7 changes: 6 additions & 1 deletion ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class RifEclipseSummaryAddress
INPUT_REGION_2_REGION,
INPUT_WELL_NAME,
INPUT_GROUP_NAME,
INPUT_NETWORK_NAME,
INPUT_CELL_IJK,
INPUT_LGR_NAME,
INPUT_SEGMENT_NUMBER,
Expand All @@ -81,6 +82,7 @@ class RifEclipseSummaryAddress
int16_t regionNumber,
int16_t regionNumber2,
const std::string& groupName,
const std::string& networkName,
const std::string& wellName,
int16_t wellSegmentNumber,
const std::string& lgrName,
Expand All @@ -100,7 +102,7 @@ class RifEclipseSummaryAddress

static RifEclipseSummaryAddress fieldAddress( const std::string& vectorName, int calculationId = -1 );
static RifEclipseSummaryAddress aquiferAddress( const std::string& vectorName, int aquiferNumber, int calculationId = -1 );
static RifEclipseSummaryAddress networkAddress( const std::string& vectorName, int calculationId = -1 );
static RifEclipseSummaryAddress networkAddress( const std::string& vectorName, const std::string& networkName, int calculationId = -1 );
static RifEclipseSummaryAddress miscAddress( const std::string& vectorName, int calculationId = -1 );
static RifEclipseSummaryAddress regionAddress( const std::string& vectorName, int regionNumber, int calculationId = -1 );
static RifEclipseSummaryAddress
Expand Down Expand Up @@ -142,6 +144,7 @@ class RifEclipseSummaryAddress
int regionNumber2() const { return m_regionNumber2; }

const std::string& groupName() const { return m_groupName; }
const std::string& networkName() const { return m_networkName; }
const std::string& wellName() const { return m_wellName; }
int wellSegmentNumber() const { return m_wellSegmentNumber; }
const std::string& lgrName() const { return m_lgrName; }
Expand All @@ -165,6 +168,7 @@ class RifEclipseSummaryAddress
void setVectorName( const std::string& vectorName ) { m_vectorName = vectorName; }
void setWellName( const std::string& wellName ) { m_wellName = wellName; }
void setGroupName( const std::string& groupName ) { m_groupName = groupName; }
void setNetworkName( const std::string& networkName ) { m_networkName = networkName; }
void setRegion( int region ) { m_regionNumber = (int16_t)region; }
void setRegion2( int region2 ) { m_regionNumber2 = (int16_t)region2; }
void setAquiferNumber( int aquiferNumber ) { m_aquiferNumber = (int16_t)aquiferNumber; }
Expand Down Expand Up @@ -201,6 +205,7 @@ class RifEclipseSummaryAddress
std::string m_vectorName;
std::string m_wellName;
std::string m_groupName;
std::string m_networkName;
std::string m_lgrName;
int32_t m_cellK;
int32_t m_cellJ;
Expand Down
24 changes: 13 additions & 11 deletions ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,19 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con
return RifEclipseSummaryAddress::importedAddress( quantityName );
}

int regionNumber = -1;
int regionNumber2 = -1;
std::string groupName = "";
std::string wellName = "";
int regionNumber = -1;
int regionNumber2 = -1;
std::string groupName;
std::string networkName;
std::string wellName;
int wellSegmentNumber = -1;
std::string lgrName = "";
int cellI = -1;
int cellJ = -1;
int cellK = -1;
int aquiferNumber = -1;
bool isErrorResult = false;
int id = -1;
std::string lgrName;
int cellI = -1;
int cellJ = -1;
int cellK = -1;
int aquiferNumber = -1;
bool isErrorResult = false;
int id = -1;

switch ( category )
{
Expand Down Expand Up @@ -285,6 +286,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con
regionNumber,
regionNumber2,
groupName,
networkName,
wellName,
wellSegmentNumber,
lgrName,
Expand Down
16 changes: 1 addition & 15 deletions ApplicationLibCode/FileInterface/RifKeywordVectorUserData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,21 +160,7 @@ bool RifKeywordVectorUserData::parse( const QString& data, const QString& custom
wellName = customWellName;
}

RifEclipseSummaryAddress addr( RifEclipseSummaryAddress::SUMMARY_WELL,
vectorText.toStdString(),
-1,
-1,
"",
wellName.toStdString(),
-1,
"",
-1,
-1,
-1,
-1,
false,
-1 );

auto addr = RifEclipseSummaryAddress::wellAddress( vectorText.toStdString(), wellName.toStdString(), -1 );
m_allResultAddresses.insert( addr );

m_mapFromAddressToTimeIndex[addr] = timeStepIndexIterator->second;
Expand Down
2 changes: 2 additions & 0 deletions ApplicationLibCode/FileInterface/RifReaderObservedData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ RifEclipseSummaryAddress RifReaderObservedData::address( const QString&
int regionNumber( -1 );
int regionNumber2( -1 );
std::string groupName;
std::string networkName;
std::string wellName;
int wellSegmentNumber( -1 );
std::string lgrName;
Expand Down Expand Up @@ -192,6 +193,7 @@ RifEclipseSummaryAddress RifReaderObservedData::address( const QString&
regionNumber,
regionNumber2,
groupName,
networkName,
wellName,
wellSegmentNumber,
lgrName,
Expand Down
12 changes: 12 additions & 0 deletions ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,18 @@ bool RimDataSourceSteppingTools::updateAddressIfMatching( const QVariant&
return true;
}
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_NETWORK )
{
std::string oldString = oldValue.toString().toStdString();
std::string newString = newValue.toString().toStdString();

if ( adr->networkName() == oldString )
{
adr->setNetworkName( newString );

return true;
}
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL )
{
std::string oldString = oldValue.toString().toStdString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ double RimSimWellInViewTools::extractValueForTimeStep( RifSummaryReaderInterface
return 0.0;
}

RifEclipseSummaryAddress
addr( RifEclipseSummaryAddress::SUMMARY_WELL, vectorName, -1, -1, "", wellName.toStdString(), -1, "", -1, -1, -1, -1, false, -1 );
auto addr = RifEclipseSummaryAddress::wellAddress( vectorName, wellName.toStdString(), -1 );

if ( !summaryReader->hasAddress( addr ) )
{
Expand Down
12 changes: 10 additions & 2 deletions ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,15 @@ std::vector<RimSummaryCalculationAddress>
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_NETWORK )
{
addresses.push_back( RimSummaryCalculationAddress( RifEclipseSummaryAddress::networkAddress( name, m_id ) ) );
std::set<std::string> uniqueNames;
std::for_each( allResultAddresses.begin(),
allResultAddresses.end(),
[&]( const auto& addr ) { uniqueNames.insert( addr.networkName() ); } );

for ( auto networkName : uniqueNames )
{
addresses.push_back( RimSummaryCalculationAddress( RifEclipseSummaryAddress::networkAddress( name, networkName, m_id ) ) );
}
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL )
{
Expand Down Expand Up @@ -600,7 +608,7 @@ RimSummaryCalculationAddress RimSummaryCalculation::singleAddressesForCategory(
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_NETWORK )
{
return RifEclipseSummaryAddress::networkAddress( name, m_id );
return RifEclipseSummaryAddress::networkAddress( name, address.networkName(), m_id );
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL )
{
Expand Down
Loading

0 comments on commit 0bada50

Please sign in to comment.