2017-11-24 08:17:20 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017 Statoil ASA
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2022-01-10 07:51:31 -06:00
|
|
|
#include "RiaSummaryAddressAnalyzer.h"
|
2018-12-17 08:45:37 -06:00
|
|
|
#include "RiaStdStringTools.h"
|
2017-11-24 08:17:20 -06:00
|
|
|
|
|
|
|
#include "RiaSummaryCurveDefinition.h"
|
|
|
|
|
|
|
|
#include "RimSummaryCurve.h"
|
|
|
|
#include "RimSummaryCurveCollection.h"
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
RiaSummaryAddressAnalyzer::RiaSummaryAddressAnalyzer()
|
2020-02-12 04:13:38 -06:00
|
|
|
{
|
|
|
|
}
|
2017-11-24 08:17:20 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
void RiaSummaryAddressAnalyzer::appendAddresses( const std::vector<RifEclipseSummaryAddress>& allAddresses )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( const auto& adr : allAddresses )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
analyzeSingleAddress( adr );
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-01 04:15:19 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-12-01 06:22:41 -06:00
|
|
|
///
|
2017-12-01 04:15:19 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
void RiaSummaryAddressAnalyzer::appendAddresses( const std::set<RifEclipseSummaryAddress>& allAddresses )
|
2017-12-01 04:15:19 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( const auto& adr : allAddresses )
|
2017-12-01 04:15:19 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
analyzeSingleAddress( adr );
|
2017-12-01 04:15:19 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-24 08:17:20 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
std::set<std::string> RiaSummaryAddressAnalyzer::quantities() const
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
|
|
|
return m_quantities;
|
|
|
|
}
|
|
|
|
|
2018-12-17 08:45:37 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
std::set<std::string> RiaSummaryAddressAnalyzer::quantityNamesWithHistory() const
|
2018-12-17 08:45:37 -06:00
|
|
|
{
|
|
|
|
assignCategoryToQuantities();
|
|
|
|
|
|
|
|
return m_quantitiesWithMatchingHistory;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
std::set<std::string> RiaSummaryAddressAnalyzer::quantityNamesNoHistory() const
|
2018-12-17 08:45:37 -06:00
|
|
|
{
|
|
|
|
assignCategoryToQuantities();
|
|
|
|
|
|
|
|
return m_quantitiesNoMatchingHistory;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
std::string RiaSummaryAddressAnalyzer::quantityNameForTitle() const
|
2018-12-17 08:45:37 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( quantityNamesWithHistory().size() == 1 && quantityNamesNoHistory().empty() )
|
2018-12-17 08:45:37 -06:00
|
|
|
{
|
|
|
|
return *quantityNamesWithHistory().begin();
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( quantityNamesNoHistory().size() == 1 && quantityNamesWithHistory().empty() )
|
2018-12-17 08:45:37 -06:00
|
|
|
{
|
|
|
|
return *quantityNamesNoHistory().begin();
|
|
|
|
}
|
|
|
|
|
2022-01-10 07:51:31 -06:00
|
|
|
return {};
|
2018-12-17 08:45:37 -06:00
|
|
|
}
|
|
|
|
|
2017-11-24 08:17:20 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
std::set<std::string> RiaSummaryAddressAnalyzer::wellNames() const
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
return keysInMap( m_wellNames );
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
std::set<std::string> RiaSummaryAddressAnalyzer::wellGroupNames() const
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
return keysInMap( m_wellGroupNames );
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
std::set<int> RiaSummaryAddressAnalyzer::regionNumbers() const
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
return keysInMap( m_regionNumbers );
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
|
2019-08-05 14:53:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
std::set<std::string> RiaSummaryAddressAnalyzer::wellCompletions( const std::string& wellName ) const
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
|
|
|
std::set<std::string> connections;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( const auto& conn : m_wellCompletions )
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( conn.first == wellName )
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
connections.insert( conn.second );
|
2019-08-05 14:53:48 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return connections;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
std::set<int> RiaSummaryAddressAnalyzer::wellSegmentNumbers( const std::string& wellName ) const
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
|
|
|
std::set<int> segmentNumberForWell;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( const auto& wellSegment : m_wellSegmentNumbers )
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( wellName.empty() || std::get<0>( wellSegment ) == wellName )
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
segmentNumberForWell.insert( std::get<1>( wellSegment ) );
|
2019-08-05 14:53:48 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return segmentNumberForWell;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
std::set<std::string> RiaSummaryAddressAnalyzer::blocks() const
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
return keysInMap( m_blocks );
|
2019-08-05 14:53:48 -05:00
|
|
|
}
|
|
|
|
|
2020-11-10 07:49:43 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
std::set<int> RiaSummaryAddressAnalyzer::aquifers() const
|
2020-11-10 07:49:43 -06:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
return keysInMap( m_aquifers );
|
2020-11-10 07:49:43 -06:00
|
|
|
}
|
|
|
|
|
2017-11-24 08:17:20 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
std::set<RifEclipseSummaryAddress::SummaryVarCategory> RiaSummaryAddressAnalyzer::categories() const
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
|
|
|
return m_categories;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
std::vector<std::vector<RifEclipseSummaryAddress>> RiaSummaryAddressAnalyzer::addressesGroupedByObject() const
|
|
|
|
{
|
|
|
|
auto wellAdr = valuesInMap( m_wellNames );
|
|
|
|
auto wellGroupAdr = valuesInMap( m_wellGroupNames );
|
|
|
|
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(), wellGroupAdr.begin(), wellGroupAdr.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() );
|
|
|
|
|
|
|
|
return groupedByObject;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<QString> RiaSummaryAddressAnalyzer::identifierTexts( RifEclipseSummaryAddress::SummaryVarCategory category,
|
|
|
|
const std::string& secondaryIdentifier ) const
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2019-08-05 14:53:48 -05:00
|
|
|
std::vector<QString> identifierStrings;
|
2017-11-24 08:17:20 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( category == RifEclipseSummaryAddress::SUMMARY_REGION )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
auto keys = keysInMap( m_regionNumbers );
|
|
|
|
for ( const auto& key : keys )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
identifierStrings.push_back( QString::number( key ) );
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
auto keys = keysInMap( m_wellNames );
|
|
|
|
for ( const auto& key : keys )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
identifierStrings.push_back( QString::fromStdString( key ) );
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
auto keys = keysInMap( m_wellGroupNames );
|
|
|
|
for ( const auto& key : keys )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
identifierStrings.push_back( QString::fromStdString( key ) );
|
2019-08-05 14:53:48 -05:00
|
|
|
}
|
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( category == RifEclipseSummaryAddress::SUMMARY_BLOCK )
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
auto keys = keysInMap( m_blocks );
|
|
|
|
for ( const auto& key : keys )
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
identifierStrings.push_back( QString::fromStdString( key ) );
|
2019-08-05 14:53:48 -05:00
|
|
|
}
|
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT )
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto segmentNumbers = wellSegmentNumbers( secondaryIdentifier );
|
|
|
|
for ( const auto& segment : segmentNumbers )
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
identifierStrings.push_back( QString::number( segment ) );
|
2019-08-05 14:53:48 -05:00
|
|
|
}
|
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION )
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto connections = wellCompletions( secondaryIdentifier );
|
|
|
|
for ( const auto& conn : connections )
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
identifierStrings.push_back( QString::fromStdString( conn ) );
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
}
|
2020-11-10 07:49:43 -06:00
|
|
|
else if ( category == RifEclipseSummaryAddress::SUMMARY_AQUIFER )
|
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
auto keys = keysInMap( m_aquifers );
|
|
|
|
for ( const auto& key : keys )
|
2020-11-10 07:49:43 -06:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
identifierStrings.push_back( QString::number( key ) );
|
2020-11-10 07:49:43 -06:00
|
|
|
}
|
|
|
|
}
|
2017-11-24 08:17:20 -06:00
|
|
|
|
2019-08-05 14:53:48 -05:00
|
|
|
return identifierStrings;
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-12-01 06:22:41 -06:00
|
|
|
///
|
2017-11-24 08:17:20 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-12-01 06:22:41 -06:00
|
|
|
std::vector<RifEclipseSummaryAddress>
|
2022-01-10 07:51:31 -06:00
|
|
|
RiaSummaryAddressAnalyzer::addressesForCategory( const std::set<RifEclipseSummaryAddress>& addresses,
|
|
|
|
RifEclipseSummaryAddress::SummaryVarCategory category )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
|
|
|
std::vector<RifEclipseSummaryAddress> filteredAddresses;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( const auto& adr : addresses )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( adr.category() == category )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
filteredAddresses.push_back( adr );
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return filteredAddresses;
|
|
|
|
}
|
|
|
|
|
2018-12-19 03:07:17 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
std::string RiaSummaryAddressAnalyzer::correspondingHistorySummaryCurveName( const std::string& curveName )
|
2018-12-19 03:07:17 -06:00
|
|
|
{
|
|
|
|
static std::string historyIdentifier = "H";
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( RiaStdStringTools::endsWith( curveName, historyIdentifier ) )
|
2018-12-19 03:07:17 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
std::string candidate = curveName.substr( 0, curveName.size() - 1 );
|
2018-12-19 03:07:17 -06:00
|
|
|
return candidate;
|
|
|
|
}
|
2022-01-10 07:51:31 -06:00
|
|
|
|
|
|
|
return curveName + historyIdentifier;
|
2018-12-19 03:07:17 -06:00
|
|
|
}
|
|
|
|
|
2017-11-24 08:17:20 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
void RiaSummaryAddressAnalyzer::clear()
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
|
|
|
m_quantities.clear();
|
|
|
|
m_wellNames.clear();
|
|
|
|
m_wellGroupNames.clear();
|
|
|
|
m_regionNumbers.clear();
|
|
|
|
m_categories.clear();
|
2019-08-05 14:53:48 -05:00
|
|
|
m_wellCompletions.clear();
|
|
|
|
m_wellSegmentNumbers.clear();
|
|
|
|
m_blocks.clear();
|
2020-11-10 07:49:43 -06:00
|
|
|
m_aquifers.clear();
|
2019-09-10 03:41:10 -05:00
|
|
|
|
|
|
|
m_quantitiesNoMatchingHistory.clear();
|
|
|
|
m_quantitiesWithMatchingHistory.clear();
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
|
2018-12-17 08:45:37 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
void RiaSummaryAddressAnalyzer::assignCategoryToQuantities() const
|
2018-12-17 08:45:37 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !m_quantities.empty() )
|
2018-12-17 08:45:37 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_quantitiesWithMatchingHistory.empty() && m_quantitiesNoMatchingHistory.empty() )
|
2018-12-17 08:45:37 -06:00
|
|
|
{
|
|
|
|
computeQuantityNamesWithHistory();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
void RiaSummaryAddressAnalyzer::computeQuantityNamesWithHistory() const
|
2018-12-17 08:45:37 -06:00
|
|
|
{
|
|
|
|
m_quantitiesNoMatchingHistory.clear();
|
|
|
|
m_quantitiesWithMatchingHistory.clear();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
const std::string historyIdentifier( "H" );
|
2018-12-17 08:45:37 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( const auto& s : m_quantities )
|
2018-12-17 08:45:37 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
std::string correspondingHistoryCurve = correspondingHistorySummaryCurveName( s );
|
2018-12-17 08:45:37 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_quantities.find( correspondingHistoryCurve ) != m_quantities.end() )
|
2018-12-19 03:08:10 -06:00
|
|
|
{
|
|
|
|
// Insert the curve name without H
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( RiaStdStringTools::endsWith( s, historyIdentifier ) )
|
2018-12-17 08:45:37 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_quantitiesWithMatchingHistory.insert( correspondingHistoryCurve );
|
2018-12-17 08:45:37 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_quantitiesWithMatchingHistory.insert( s );
|
2018-12-17 08:45:37 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_quantitiesNoMatchingHistory.insert( s );
|
2018-12-17 08:45:37 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-24 08:17:20 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-10 07:51:31 -06:00
|
|
|
void RiaSummaryAddressAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAddress& address )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2019-08-05 14:53:48 -05:00
|
|
|
const std::string& wellName = address.wellName();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !wellName.empty() )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
m_wellNames.insert( { wellName, address } );
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !address.quantityName().empty() )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_quantities.insert( address.quantityName() );
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !address.wellGroupName().empty() )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
m_wellGroupNames.insert( { address.wellGroupName(), address } );
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( address.regionNumber() != -1 )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
m_regionNumbers.insert( { address.regionNumber(), address } );
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( address.category() == RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION )
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto wellNameAndCompletion = std::make_pair( wellName, address.blockAsString() );
|
|
|
|
m_wellCompletions.insert( wellNameAndCompletion );
|
2019-08-05 14:53:48 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( address.category() == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT )
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto wellNameAndSegment = std::make_pair( wellName, address.wellSegmentNumber() );
|
|
|
|
m_wellSegmentNumbers.insert( wellNameAndSegment );
|
2019-08-05 14:53:48 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( address.category() == RifEclipseSummaryAddress::SUMMARY_BLOCK )
|
2019-08-05 14:53:48 -05:00
|
|
|
{
|
|
|
|
auto text = address.blockAsString();
|
2022-01-10 07:51:31 -06:00
|
|
|
|
|
|
|
m_blocks.insert( { text, address } );
|
2019-08-05 14:53:48 -05:00
|
|
|
}
|
2020-11-10 07:49:43 -06:00
|
|
|
else if ( address.category() == RifEclipseSummaryAddress::SUMMARY_AQUIFER )
|
|
|
|
{
|
2022-01-10 07:51:31 -06:00
|
|
|
m_aquifers.insert( { address.aquiferNumber(), address } );
|
2020-11-10 07:49:43 -06:00
|
|
|
}
|
2019-08-05 14:53:48 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( address.category() != RifEclipseSummaryAddress::SUMMARY_INVALID )
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_categories.insert( address.category() );
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
}
|
2022-01-10 07:51:31 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::set<std::string> RiaSummaryAddressAnalyzer::keysInMap( const std::multimap<std::string, RifEclipseSummaryAddress>& map )
|
|
|
|
{
|
|
|
|
std::set<std::string> keys;
|
|
|
|
for ( const auto& [key, value] : map )
|
|
|
|
{
|
|
|
|
keys.insert( key );
|
|
|
|
}
|
|
|
|
return keys;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::set<int> RiaSummaryAddressAnalyzer::keysInMap( const std::multimap<int, RifEclipseSummaryAddress>& map )
|
|
|
|
{
|
|
|
|
std::set<int> keys;
|
|
|
|
for ( const auto& [key, value] : map )
|
|
|
|
{
|
|
|
|
keys.insert( key );
|
|
|
|
}
|
|
|
|
return keys;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<std::vector<RifEclipseSummaryAddress>>
|
|
|
|
RiaSummaryAddressAnalyzer::valuesInMap( const std::multimap<std::string, RifEclipseSummaryAddress>& map )
|
|
|
|
{
|
|
|
|
std::vector<std::vector<RifEclipseSummaryAddress>> groupedAddresses;
|
|
|
|
|
|
|
|
auto uniqueKeys = keysInMap( map );
|
|
|
|
for ( const auto& key : uniqueKeys )
|
|
|
|
{
|
|
|
|
auto range = map.equal_range( key );
|
|
|
|
|
|
|
|
std::vector<RifEclipseSummaryAddress> addresses;
|
|
|
|
for ( auto i = range.first; i != range.second; ++i )
|
|
|
|
{
|
|
|
|
addresses.push_back( i->second );
|
|
|
|
}
|
|
|
|
groupedAddresses.push_back( addresses );
|
|
|
|
}
|
|
|
|
|
|
|
|
return groupedAddresses;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<std::vector<RifEclipseSummaryAddress>>
|
|
|
|
RiaSummaryAddressAnalyzer::valuesInMap( const std::multimap<int, RifEclipseSummaryAddress>& map )
|
|
|
|
{
|
|
|
|
std::vector<std::vector<RifEclipseSummaryAddress>> groupedAddresses;
|
|
|
|
|
|
|
|
auto uniqueKeys = keysInMap( map );
|
|
|
|
for ( const auto& key : uniqueKeys )
|
|
|
|
{
|
|
|
|
auto range = map.equal_range( key );
|
|
|
|
|
|
|
|
std::vector<RifEclipseSummaryAddress> addresses;
|
|
|
|
for ( auto i = range.first; i != range.second; ++i )
|
|
|
|
{
|
|
|
|
addresses.push_back( i->second );
|
|
|
|
}
|
|
|
|
groupedAddresses.push_back( addresses );
|
|
|
|
}
|
|
|
|
|
|
|
|
return groupedAddresses;
|
|
|
|
}
|