From 1eb44e519e190bad860c3359d16e79f9e78b1a58 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 5 Dec 2022 18:36:21 +0100 Subject: [PATCH] RFT plot: Fix stepping on well * Rft: Store segment and connection count per well * Update the segment branch index combo box when well changes * Bump version number --- .../FileInterface/RifReaderOpmRft.cpp | 31 +++++++++++-------- .../FileInterface/RifReaderOpmRft.h | 4 +-- .../RimWellLogCurveCommonDataSource.cpp | 7 +++++ ResInsightVersion.cmake | 2 +- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp index 36cfd45c67..ca9eca32a1 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp @@ -39,9 +39,7 @@ /// //-------------------------------------------------------------------------------------------------- RifReaderOpmRft::RifReaderOpmRft( const QString& fileName, const QString& dataDeckFileName ) - : m_segmentResultItemCount( 0 ) - , m_connectionResultItemCount( 0 ) - , m_fileName( fileName ) + : m_fileName( fileName ) , m_dataDeckFileName( dataDeckFileName ) , m_detectedErrorWhenOpeningRftFile( false ) { @@ -51,9 +49,7 @@ RifReaderOpmRft::RifReaderOpmRft( const QString& fileName, const QString& dataDe /// //-------------------------------------------------------------------------------------------------- RifReaderOpmRft::RifReaderOpmRft( const QString& fileName ) - : m_segmentResultItemCount( 0 ) - , m_connectionResultItemCount( 0 ) - , m_fileName( fileName ) + : m_fileName( fileName ) , m_detectedErrorWhenOpeningRftFile( false ) { } @@ -128,7 +124,7 @@ void RifReaderOpmRft::values( const RifEclipseRftAddress& rftAddress, std::vecto auto key = std::make_pair( wellName, RftDate{ y, m, d } ); auto segment = m_rftWellDateSegments[key]; - if ( data.size() == m_connectionResultItemCount ) + if ( m_connectionResultItemCount.count( wellName ) && data.size() == m_connectionResultItemCount[wellName] ) { // Connection results with size equal to length of result CONSEGNO. CONSEGNO defines the segment // numbers the connection is connected to. @@ -534,21 +530,30 @@ void RifReaderOpmRft::buildSegmentData() for ( const auto& [name, arrayType, size] : results ) { - if ( ( name.find( "SEG" ) == 0 ) && m_segmentResultItemCount == 0 ) + if ( ( name.find( "SEG" ) == 0 ) && m_segmentResultItemCount.count( wellName ) == 0 ) { - m_segmentResultItemCount = size; + m_segmentResultItemCount[wellName] = size; } - if ( name.find( "CON" ) == 0 && m_connectionResultItemCount == 0 ) + if ( name.find( "CON" ) == 0 && m_connectionResultItemCount.count( wellName ) == 0 ) { - m_connectionResultItemCount = size; + m_connectionResultItemCount[wellName] = size; } } for ( const auto& rftResultMetaData : results ) { const auto& [name, arrayType, size] = rftResultMetaData; - if ( size == static_cast( m_segmentResultItemCount ) || - size == static_cast( m_connectionResultItemCount ) ) + + bool isResultItemCountValid = false; + if ( m_segmentResultItemCount.count( wellName ) && + size == static_cast( m_segmentResultItemCount[wellName] ) ) + isResultItemCountValid = true; + + if ( m_connectionResultItemCount.count( wellName ) && + size == static_cast( m_connectionResultItemCount[wellName] ) ) + isResultItemCountValid = true; + + if ( isResultItemCountValid ) { segment.addResultNameAndSize( rftResultMetaData ); } diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmRft.h b/ApplicationLibCode/FileInterface/RifReaderOpmRft.h index 346b7b83fa..d694c077dc 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmRft.h +++ b/ApplicationLibCode/FileInterface/RifReaderOpmRft.h @@ -104,8 +104,8 @@ private: std::map m_rftWellDateSegments; std::set m_rftSegmentTimeSteps; - size_t m_segmentResultItemCount; - size_t m_connectionResultItemCount; + std::map m_segmentResultItemCount; + std::map m_connectionResultItemCount; std::map>> m_wseglink; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp index ed5eb0f091..07e0156d34 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp @@ -864,6 +864,13 @@ void RimWellLogCurveCommonDataSource::fieldChangedByUi( const caf::PdmFieldHandl } this->applyDataSourceChanges(); + + if ( changedField == &m_rftWellName ) + { + // The segment branch index is depending on the well name. Make sure that the combo box for branch index is + // updated. + m_rftSegmentBranchIndex.uiCapability()->updateConnectedEditors(); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 9a487f1fc0..a879520beb 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".06") +set(RESINSIGHT_DEV_VERSION ".07") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f")