mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improve support for network vectors
Show all text if summary address contains multiple : for network addresses Consolidate replace of tokens in summary address
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
#include "RimSummaryAddressModifier.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryEnsemble.h"
|
||||
|
||||
@@ -175,29 +176,19 @@ void RiaSummaryCurveDefinition::setIdentifierText( SummaryCategory category, con
|
||||
{
|
||||
if ( RifEclipseSummaryAddress::isDependentOnWellName( category ) )
|
||||
{
|
||||
m_summaryAddressY.setWellName( name );
|
||||
m_summaryAddressX.setWellName( name );
|
||||
m_summaryAddressX =
|
||||
RimSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressX,
|
||||
name,
|
||||
RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL );
|
||||
m_summaryAddressY =
|
||||
RimSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressY,
|
||||
name,
|
||||
RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL );
|
||||
}
|
||||
|
||||
int id = RiaStdStringTools::toInt( name );
|
||||
|
||||
switch ( category )
|
||||
else
|
||||
{
|
||||
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_AQUIFER:
|
||||
m_summaryAddressY.setAquiferNumber( id );
|
||||
m_summaryAddressX.setAquiferNumber( id );
|
||||
break;
|
||||
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_REGION:
|
||||
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_REGION_2_REGION:
|
||||
m_summaryAddressY.setRegion( id );
|
||||
m_summaryAddressX.setRegion( id );
|
||||
break;
|
||||
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_GROUP:
|
||||
m_summaryAddressY.setGroupName( name );
|
||||
m_summaryAddressX.setGroupName( name );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
m_summaryAddressX = RimSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressX, name, m_summaryAddressX.category() );
|
||||
m_summaryAddressY = RimSummaryAddressModifier::replaceTokenForCategory( m_summaryAddressY, name, m_summaryAddressY.category() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1032,8 +1032,19 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector
|
||||
break;
|
||||
|
||||
case SummaryCategory::SUMMARY_NETWORK:
|
||||
return networkAddress( vectorName, token1 );
|
||||
break;
|
||||
{
|
||||
auto aggregated = token1;
|
||||
if ( !token2.empty() )
|
||||
{
|
||||
// Network name can contain more than one token. Concatenate tokens using : as separator
|
||||
// https://github.com/OPM/ResInsight/issues/11785
|
||||
aggregated += ":";
|
||||
aggregated += token2;
|
||||
}
|
||||
|
||||
return networkAddress( vectorName, aggregated );
|
||||
}
|
||||
break;
|
||||
|
||||
case SummaryCategory::SUMMARY_MISC:
|
||||
return miscAddress( vectorName );
|
||||
|
@@ -59,6 +59,55 @@ void caf::AppEnum<RimSummaryAddressCollection::CollectionContentType>::setUp()
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimSummaryAddressCollection, "RimSummaryAddressCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddressDefines::SummaryCategory RimSummaryAddressCollection::contentTypeToSummaryCategory( CollectionContentType contentType )
|
||||
{
|
||||
switch ( contentType )
|
||||
{
|
||||
case CollectionContentType::WELL:
|
||||
return SummaryCategory::SUMMARY_WELL;
|
||||
case CollectionContentType::GROUP:
|
||||
return SummaryCategory::SUMMARY_GROUP;
|
||||
case CollectionContentType::REGION:
|
||||
return SummaryCategory::SUMMARY_REGION;
|
||||
case CollectionContentType::FIELD:
|
||||
return SummaryCategory::SUMMARY_FIELD;
|
||||
case CollectionContentType::MISC:
|
||||
return SummaryCategory::SUMMARY_MISC;
|
||||
case CollectionContentType::AQUIFER:
|
||||
return SummaryCategory::SUMMARY_AQUIFER;
|
||||
case CollectionContentType::NETWORK:
|
||||
return SummaryCategory::SUMMARY_NETWORK;
|
||||
case CollectionContentType::REGION_2_REGION:
|
||||
return SummaryCategory::SUMMARY_REGION_2_REGION;
|
||||
case CollectionContentType::WELL_COMPLETION:
|
||||
return SummaryCategory::SUMMARY_WELL_COMPLETION;
|
||||
case CollectionContentType::WELL_LGR:
|
||||
return SummaryCategory::SUMMARY_WELL_LGR;
|
||||
case CollectionContentType::WELL_COMPLETION_LGR:
|
||||
return SummaryCategory::SUMMARY_WELL_COMPLETION_LGR;
|
||||
case CollectionContentType::WELL_SEGMENT:
|
||||
return SummaryCategory::SUMMARY_WELL_SEGMENT;
|
||||
case CollectionContentType::BLOCK:
|
||||
return SummaryCategory::SUMMARY_BLOCK;
|
||||
case CollectionContentType::BLOCK_LGR:
|
||||
return SummaryCategory::SUMMARY_BLOCK_LGR;
|
||||
case CollectionContentType::IMPORTED:
|
||||
return SummaryCategory::SUMMARY_IMPORTED;
|
||||
case CollectionContentType::CALCULATED:
|
||||
case CollectionContentType::NOT_DEFINED:
|
||||
case CollectionContentType::WELL_FOLDER:
|
||||
case CollectionContentType::GROUP_FOLDER:
|
||||
case CollectionContentType::REGION_FOLDER:
|
||||
case CollectionContentType::NETWORK_FOLDER:
|
||||
case CollectionContentType::SUMMARY_CASE:
|
||||
default:
|
||||
return SummaryCategory::SUMMARY_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -19,6 +19,8 @@
|
||||
|
||||
#include "RimNamedObject.h"
|
||||
|
||||
#include "RifEclipseSummaryAddressDefines.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
|
||||
#include <QString>
|
||||
@@ -59,6 +61,8 @@ public:
|
||||
IMPORTED
|
||||
};
|
||||
|
||||
static RifEclipseSummaryAddressDefines::SummaryCategory contentTypeToSummaryCategory( CollectionContentType contentType );
|
||||
|
||||
public:
|
||||
RimSummaryAddressCollection();
|
||||
~RimSummaryAddressCollection() override;
|
||||
|
@@ -30,28 +30,32 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RimSummaryAddressModifier::replaceObjectName( const RifEclipseSummaryAddress& sourceAdr,
|
||||
std::string objectName,
|
||||
RimSummaryAddressCollection::CollectionContentType contentType )
|
||||
RifEclipseSummaryAddress RimSummaryAddressModifier::replaceTokenForCategory( const RifEclipseSummaryAddress& sourceAdr,
|
||||
const std::string& token,
|
||||
RifEclipseSummaryAddressDefines::SummaryCategory contentType )
|
||||
{
|
||||
auto adr = sourceAdr;
|
||||
|
||||
if ( contentType == RimSummaryAddressCollection::CollectionContentType::WELL )
|
||||
if ( contentType == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL )
|
||||
{
|
||||
adr.setWellName( objectName );
|
||||
adr.setWellName( token );
|
||||
}
|
||||
else if ( contentType == RimSummaryAddressCollection::CollectionContentType::GROUP )
|
||||
else if ( contentType == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_GROUP )
|
||||
{
|
||||
adr.setGroupName( objectName );
|
||||
adr.setGroupName( token );
|
||||
}
|
||||
else if ( contentType == RimSummaryAddressCollection::CollectionContentType::REGION )
|
||||
else if ( contentType == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_NETWORK )
|
||||
{
|
||||
int intValue = RiaStdStringTools::toInt( objectName );
|
||||
if ( intValue == -1 )
|
||||
adr.setNetworkName( token );
|
||||
}
|
||||
else if ( contentType == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_REGION )
|
||||
{
|
||||
int intValue = -1;
|
||||
if ( !RiaStdStringTools::toInt( token, intValue ) )
|
||||
{
|
||||
QString errorText = QString( "Failed to convert region text to region integer value "
|
||||
"for region text : %1" )
|
||||
.arg( QString::fromStdString( objectName ) );
|
||||
.arg( QString::fromStdString( token ) );
|
||||
|
||||
RiaLogging::error( errorText );
|
||||
}
|
||||
@@ -60,6 +64,38 @@ RifEclipseSummaryAddress RimSummaryAddressModifier::replaceObjectName( const Rif
|
||||
adr.setRegion( intValue );
|
||||
}
|
||||
}
|
||||
else if ( contentType == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_REGION_2_REGION )
|
||||
{
|
||||
int intValue = -1;
|
||||
if ( !RiaStdStringTools::toInt( token, intValue ) )
|
||||
{
|
||||
QString errorText = QString( "Failed to convert region text to region integer value "
|
||||
"for region text : %1" )
|
||||
.arg( QString::fromStdString( token ) );
|
||||
|
||||
RiaLogging::error( errorText );
|
||||
}
|
||||
else
|
||||
{
|
||||
adr.setRegion2( intValue );
|
||||
}
|
||||
}
|
||||
else if ( contentType == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_AQUIFER )
|
||||
{
|
||||
int intValue = -1;
|
||||
if ( !RiaStdStringTools::toInt( token, intValue ) )
|
||||
{
|
||||
QString errorText = QString( "Failed to convert aquifer text to aquifer integer value "
|
||||
"for aquifer text : %1" )
|
||||
.arg( QString::fromStdString( token ) );
|
||||
|
||||
RiaLogging::error( errorText );
|
||||
}
|
||||
else
|
||||
{
|
||||
adr.setAquiferNumber( intValue );
|
||||
}
|
||||
}
|
||||
|
||||
return adr;
|
||||
}
|
||||
@@ -151,18 +187,20 @@ void RimSummaryAddressModifier::updateAddressesByObjectName( const std::vector<C
|
||||
const std::string& objectName,
|
||||
RimSummaryAddressCollection::CollectionContentType contentType )
|
||||
{
|
||||
auto category = RimSummaryAddressCollection::contentTypeToSummaryCategory( contentType );
|
||||
|
||||
for ( auto& provider : curveAddressProviders )
|
||||
{
|
||||
std::visit(
|
||||
[objectName, contentType]( auto&& arg )
|
||||
[objectName, category]( auto&& arg )
|
||||
{
|
||||
const auto sourceAdr = RimSummaryAddressModifier::curveAddress( arg );
|
||||
|
||||
const auto sourceX = sourceAdr.summaryAddressX();
|
||||
const auto sourceY = sourceAdr.summaryAddressY();
|
||||
|
||||
const auto newAdrX = RimSummaryAddressModifier::replaceObjectName( sourceX, objectName, contentType );
|
||||
const auto newAdrY = RimSummaryAddressModifier::replaceObjectName( sourceY, objectName, contentType );
|
||||
const auto newAdrX = RimSummaryAddressModifier::replaceTokenForCategory( sourceX, objectName, category );
|
||||
const auto newAdrY = RimSummaryAddressModifier::replaceTokenForCategory( sourceY, objectName, category );
|
||||
|
||||
RimSummaryAddressModifier::setCurveAddress( arg, RiaSummaryCurveAddress( newAdrX, newAdrY ) );
|
||||
},
|
||||
|
@@ -50,12 +50,13 @@ public:
|
||||
const std::string& objectName,
|
||||
RimSummaryAddressCollection::CollectionContentType contentType );
|
||||
|
||||
static RifEclipseSummaryAddress replaceTokenForCategory( const RifEclipseSummaryAddress& sourceAdr,
|
||||
const std::string& token,
|
||||
RifEclipseSummaryAddressDefines::SummaryCategory contentType );
|
||||
|
||||
private:
|
||||
static RiaSummaryCurveAddress curveAddress( RimSummaryCurve* curve );
|
||||
static RiaSummaryCurveAddress curveAddress( RimEnsembleCurveSet* curveSet );
|
||||
static void setCurveAddress( RimEnsembleCurveSet* curveSet, const RiaSummaryCurveAddress& curveAdr );
|
||||
static void setCurveAddress( RimSummaryCurve* curve, const RiaSummaryCurveAddress& curveAdr );
|
||||
static RifEclipseSummaryAddress replaceObjectName( const RifEclipseSummaryAddress& sourceAdr,
|
||||
std::string objectName,
|
||||
RimSummaryAddressCollection::CollectionContentType contentType );
|
||||
static RiaSummaryCurveAddress curveAddress( RimSummaryCurve* curve );
|
||||
static RiaSummaryCurveAddress curveAddress( RimEnsembleCurveSet* curveSet );
|
||||
static void setCurveAddress( RimEnsembleCurveSet* curveSet, const RiaSummaryCurveAddress& curveAdr );
|
||||
static void setCurveAddress( RimSummaryCurve* curve, const RiaSummaryCurveAddress& curveAdr );
|
||||
};
|
||||
|
Reference in New Issue
Block a user