#8583 RFT Plots : Add support for data source management to well log plots

This commit is contained in:
Magne Sjaastad 2022-02-24 10:03:30 +01:00
parent 7f41349b5c
commit 10a01972f3
11 changed files with 396 additions and 139 deletions

View File

@ -368,6 +368,17 @@ RimWellLogRftCurve*
plotTrack->setFormationCase( resultCase );
plotTrack->setFormationSimWellName( simWell->name() );
}
else if ( resultCase )
{
curve->setEclipseResultCase( resultCase );
auto wellNames = resultCase->rftReader()->wellNames();
if ( !wellNames.empty() )
{
auto wellName = *( wellNames.begin() );
curve->setDefaultAddress( wellName );
}
}
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plotTrack->curveCount() );
curve->setColor( curveColor );

View File

@ -66,14 +66,14 @@ void RicChangeDataSourceFeature::onActionTriggered( bool isChecked )
if ( selectedTracksAndCurves( &curves, &tracks ) )
{
RimWellLogCurveCommonDataSource featureUi;
featureUi.updateDefaultOptions( curves, tracks );
featureUi.analyseCurvesAndTracks( curves, tracks );
caf::PdmUiPropertyViewDialog propertyDialog( nullptr, &featureUi, "Change Data Source for Multiple Curves", "" );
propertyDialog.resize( QSize( 500, 200 ) );
if ( propertyDialog.exec() == QDialog::Accepted )
{
featureUi.updateCurvesAndTracks( curves, tracks );
featureUi.applyDataSourceChanges( curves, tracks );
}
}
}

View File

@ -670,7 +670,7 @@ RimWellLogCurveCommonDataSource* RimDepthTrackPlot::commonDataSource() const
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::updateCommonDataSource()
{
m_commonDataSource->updateDefaultOptions();
m_commonDataSource->analyseCurvesAndTracks();
}
//--------------------------------------------------------------------------------------------------

View File

@ -23,6 +23,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogWbsCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimRftTools.h
)
set(SOURCE_GROUP_SOURCE_FILES
@ -50,6 +51,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogCurveSet.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogStatistics.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogStatisticsCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimRftTools.cpp
)
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@ -25,6 +25,7 @@
#include "RigWellLogCurveData.h"
#include "RimEclipseResultCase.h"
#include "RimRftTools.h"
#include "RimTools.h"
#include "RimWellLogCurve.h"
#include "RimWellLogRftCurve.h"
@ -174,23 +175,7 @@ QList<caf::PdmOptionItemInfo>
if ( m_eclipseResultCase )
{
RifReaderRftInterface* reader = m_eclipseResultCase()->rftReader();
if ( reader )
{
for ( const RifEclipseRftAddress::RftWellLogChannelType& channelName :
reader->availableWellLogChannels( wellName() ) )
{
options.push_back(
caf::PdmOptionItemInfo( caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(
channelName ),
channelName ) );
}
}
if ( options.empty() )
{
options.push_back( caf::PdmOptionItemInfo( caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(
RifEclipseRftAddress::RftWellLogChannelType::NONE ),
RifEclipseRftAddress::RftWellLogChannelType::NONE ) );
}
options = RimRftTools::wellLogChannelsOptions( reader, wellName() );
}
}
else if ( fieldNeedingOptions == &m_timeStep )
@ -200,17 +185,8 @@ QList<caf::PdmOptionItemInfo>
RifReaderRftInterface* reader = m_eclipseResultCase()->rftReader();
if ( reader )
{
QString dateFormat = "dd MMM yyyy";
std::set<QDateTime> timeStamps = reader->availableTimeSteps( wellName(), m_wellLogChannelName() );
for ( const QDateTime& dt : timeStamps )
{
QString dateString = RiaQDateTimeTools::toStringUsingApplicationLocale( dt, dateFormat );
options.push_back( caf::PdmOptionItemInfo( dateString, dt ) );
}
options = RimRftTools::timeStepOptions( reader, wellName(), m_wellLogChannelName() );
}
options.push_back( caf::PdmOptionItemInfo( "None", QDateTime() ) );
}
}
return options;

View File

@ -0,0 +1,168 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022- Equinor 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimRftTools.h"
#include "RiaQDateTimeTools.h"
#include "RiaResultNames.h"
#include "RiaRftDefines.h"
#include "RifReaderRftInterface.h"
#include "cafPdmUiItem.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimRftTools::wellLogChannelsOptions( RifReaderRftInterface* readerRft, const QString& wellName )
{
QList<caf::PdmOptionItemInfo> options;
if ( readerRft )
{
for ( const RifEclipseRftAddress::RftWellLogChannelType& channelName :
readerRft->availableWellLogChannels( wellName ) )
{
options.push_back(
caf::PdmOptionItemInfo( caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText( channelName ),
channelName ) );
}
}
if ( options.empty() )
{
options.push_back( caf::PdmOptionItemInfo( caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(
RifEclipseRftAddress::RftWellLogChannelType::NONE ),
RifEclipseRftAddress::RftWellLogChannelType::NONE ) );
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimRftTools::wellNameOptions( RifReaderRftInterface* readerRft )
{
QList<caf::PdmOptionItemInfo> options;
options.push_back( caf::PdmOptionItemInfo( "None", "" ) );
if ( readerRft )
{
std::set<QString> wellNames = readerRft->wellNames();
for ( const QString& name : wellNames )
{
options.push_back( caf::PdmOptionItemInfo( name, name, false, caf::IconProvider( ":/Well.svg" ) ) );
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimRftTools::timeStepOptions( RifReaderRftInterface* readerRft,
const QString& wellName,
RifEclipseRftAddress::RftWellLogChannelType channelType )
{
QList<caf::PdmOptionItemInfo> options;
if ( readerRft )
{
QString dateFormat = "dd MMM yyyy";
std::set<QDateTime> timeStamps = readerRft->availableTimeSteps( wellName, channelType );
for ( const QDateTime& dt : timeStamps )
{
QString dateString = RiaQDateTimeTools::toStringUsingApplicationLocale( dt, dateFormat );
options.push_back( caf::PdmOptionItemInfo( dateString, dt ) );
}
}
options.push_back( caf::PdmOptionItemInfo( "None", QDateTime() ) );
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimRftTools::segmentTimeStepOptions( RifReaderRftInterface* readerRft, const QString& wellName )
{
return timeStepOptions( readerRft, wellName, RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimRftTools::segmentResultNameOptions( RifReaderRftInterface* readerRft,
const QString& wellName,
const QDateTime& timeStep )
{
QList<caf::PdmOptionItemInfo> options;
options.push_front(
caf::PdmOptionItemInfo( RiaResultNames::undefinedResultName(), RiaResultNames::undefinedResultName() ) );
if ( readerRft )
{
options.push_back(
caf::PdmOptionItemInfo( RiaDefines::segmentNumberResultName(), RiaDefines::segmentNumberResultName() ) );
for ( const auto& resultAdr : readerRft->eclipseRftAddresses( wellName, timeStep ) )
{
if ( resultAdr.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES )
{
options.push_back( caf::PdmOptionItemInfo( resultAdr.segmentResultName(), resultAdr.segmentResultName() ) );
}
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimRftTools::segmentBranchIdOptions( RifReaderRftInterface* readerRft,
const QString& wellName,
const QDateTime& timeStep )
{
QList<caf::PdmOptionItemInfo> options;
options.push_front( caf::PdmOptionItemInfo( RiaDefines::allBranches(), RiaDefines::allBranches() ) );
if ( readerRft )
{
std::vector<double> values;
auto adr =
RifEclipseRftAddress::createSegmentResult( wellName, timeStep, RiaDefines::segmentBranchNumberResultName() );
readerRft->values( adr, &values );
for ( const auto& v : values )
{
int intValue = v;
auto txt = QString::number( intValue );
options.push_back( caf::PdmOptionItemInfo( txt, txt ) );
}
}
return options;
}

View File

@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022- Equinor 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RifEclipseRftAddress.h"
#include <QList>
namespace caf
{
class PdmOptionItemInfo;
}
class RifReaderRftInterface;
class RimRftTools
{
public:
static QList<caf::PdmOptionItemInfo> wellLogChannelsOptions( RifReaderRftInterface* readerRft, const QString& wellName );
static QList<caf::PdmOptionItemInfo> wellNameOptions( RifReaderRftInterface* readerRft );
static QList<caf::PdmOptionItemInfo> timeStepOptions( RifReaderRftInterface* readerRft,
const QString& wellName,
RifEclipseRftAddress::RftWellLogChannelType channelType );
static QList<caf::PdmOptionItemInfo> segmentTimeStepOptions( RifReaderRftInterface* readerRft, const QString& wellName );
static QList<caf::PdmOptionItemInfo>
segmentResultNameOptions( RifReaderRftInterface* readerRft, const QString& wellName, const QDateTime& timeStep );
static QList<caf::PdmOptionItemInfo>
segmentBranchIdOptions( RifReaderRftInterface* readerRft, const QString& wellName, const QDateTime& timeStep );
};

View File

@ -25,12 +25,14 @@
#include "RimGeoMechCase.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimRftTools.h"
#include "RimTools.h"
#include "RimWellFlowRateCurve.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogFileCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellLogRftCurve.h"
#include "RimWellLogTrack.h"
#include "RimWellLogWbsCurve.h"
#include "RimWellMeasurementCurve.h"
@ -96,6 +98,10 @@ RimWellLogCurveCommonDataSource::RimWellLogCurveCommonDataSource()
CAF_PDM_InitField( &m_wbsSmoothingThreshold, "WBSSmoothingThreshold", -1.0, "Smoothing Threshold" );
CAF_PDM_InitFieldNoDefault( &m_rftTimeStep, "RftTimeStep", "RFT Time Step" );
CAF_PDM_InitFieldNoDefault( &m_rftWellName, "RftWellName", "RFT Well Name" );
CAF_PDM_InitFieldNoDefault( &m_rftSegmentBranchId, "SegmentBranchId", "RFT Segment Branch" );
m_case = nullptr;
m_wellPath = nullptr;
}
@ -276,13 +282,17 @@ void RimWellLogCurveCommonDataSource::resetDefaultOptions()
m_uniqueBranchDetection.clear();
m_uniqueWbsSmoothing.clear();
m_uniqueWbsSmoothingThreshold.clear();
m_uniqueRftTimeSteps.clear();
m_uniqueRftWellNames.clear();
m_uniqueRftBranchIds.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurveCommonDataSource::updateDefaultOptions( const std::vector<RimWellLogCurve*>& curves,
const std::vector<RimWellLogTrack*>& tracks )
void RimWellLogCurveCommonDataSource::analyseCurvesAndTracks( const std::vector<RimWellLogCurve*>& curves,
const std::vector<RimWellLogTrack*>& tracks )
{
// Reset all options in the UI
resetDefaultOptions();
@ -294,12 +304,14 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions( const std::vector<Ri
{
continue;
}
RimWellLogExtractionCurve* extractionCurve = dynamic_cast<RimWellLogExtractionCurve*>( curve );
RimWellLogFileCurve* fileCurve = dynamic_cast<RimWellLogFileCurve*>( curve );
RimWellFlowRateCurve* flowRateCurve = dynamic_cast<RimWellFlowRateCurve*>( curve );
auto* extractionCurve = dynamic_cast<RimWellLogExtractionCurve*>( curve );
auto* fileCurve = dynamic_cast<RimWellLogFileCurve*>( curve );
auto* flowRateCurve = dynamic_cast<RimWellFlowRateCurve*>( curve );
auto* rftCurve = dynamic_cast<RimWellLogRftCurve*>( curve );
if ( extractionCurve )
{
RimWellLogWbsCurve* wbsCurve = dynamic_cast<RimWellLogWbsCurve*>( extractionCurve );
auto* wbsCurve = dynamic_cast<RimWellLogWbsCurve*>( extractionCurve );
if ( wbsCurve )
{
m_uniqueWbsSmoothing.insert( wbsCurve->smoothCurve() );
@ -341,6 +353,16 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions( const std::vector<Ri
m_uniqueCases.insert( flowRateCurve->rimCase() );
m_uniqueTimeSteps.insert( flowRateCurve->timeStep() );
}
else if ( rftCurve )
{
m_uniqueWellNames.insert( rftCurve->wellName() );
m_uniqueCases.insert( rftCurve->eclipseResultCase() );
auto adr = rftCurve->rftAddress();
m_uniqueRftWellNames.insert( adr.wellName() );
m_uniqueRftTimeSteps.insert( adr.timeStep() );
m_uniqueRftBranchIds.insert( QString::number( adr.segmentBranchNumber() ) );
}
}
for ( RimWellLogTrack* track : tracks )
{
@ -411,12 +433,22 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions( const std::vector<Ri
{
setWbsSmoothingThreshold( *m_uniqueWbsSmoothingThreshold.begin() );
}
if ( m_uniqueRftWellNames.size() == 1u )
{
m_rftWellName = *( m_uniqueRftWellNames.begin() );
}
if ( m_uniqueRftTimeSteps.size() == 1u )
{
m_rftTimeStep = *( m_uniqueRftTimeSteps.begin() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurveCommonDataSource::updateDefaultOptions()
void RimWellLogCurveCommonDataSource::analyseCurvesAndTracks()
{
RimWellLogPlot* parentPlot = nullptr;
this->firstAncestorOrThisOfType( parentPlot );
@ -428,15 +460,15 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions()
std::vector<RimWellLogTrack*> tracks;
parentPlot->descendantsIncludingThisOfType( tracks );
this->updateDefaultOptions( curves, tracks );
this->analyseCurvesAndTracks( curves, tracks );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurveCommonDataSource::updateCurvesAndTracks( const std::vector<RimWellLogCurve*>& curves,
const std::vector<RimWellLogTrack*>& tracks )
void RimWellLogCurveCommonDataSource::applyDataSourceChanges( const std::vector<RimWellLogCurve*>& curves,
const std::vector<RimWellLogTrack*>& tracks )
{
std::set<RimWellLogPlot*> plots;
for ( RimWellLogCurve* curve : curves )
@ -445,9 +477,10 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks( const std::vector<R
{
continue;
}
RimWellLogFileCurve* fileCurve = dynamic_cast<RimWellLogFileCurve*>( curve );
RimWellLogExtractionCurve* extractionCurve = dynamic_cast<RimWellLogExtractionCurve*>( curve );
RimWellMeasurementCurve* measurementCurve = dynamic_cast<RimWellMeasurementCurve*>( curve );
auto* fileCurve = dynamic_cast<RimWellLogFileCurve*>( curve );
auto* extractionCurve = dynamic_cast<RimWellLogExtractionCurve*>( curve );
auto* measurementCurve = dynamic_cast<RimWellMeasurementCurve*>( curve );
auto* rftCurve = dynamic_cast<RimWellLogRftCurve*>( curve );
if ( fileCurve )
{
if ( wellPathToApply() != nullptr )
@ -512,7 +545,7 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks( const std::vector<R
updatedSomething = true;
}
RimWellLogWbsCurve* wbsCurve = dynamic_cast<RimWellLogWbsCurve*>( extractionCurve );
auto* wbsCurve = dynamic_cast<RimWellLogWbsCurve*>( extractionCurve );
if ( wbsCurve )
{
if ( !wbsSmoothingToApply().isPartiallyTrue() )
@ -542,6 +575,16 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks( const std::vector<R
measurementCurve->setWellPath( wellPathToApply() );
}
}
else if ( rftCurve )
{
rftCurve->setTimeStep( m_rftTimeStep() );
rftCurve->setWellName( m_rftWellName() );
rftCurve->setSegmentBranchId( m_rftSegmentBranchId() );
RimWellLogPlot* parentPlot = nullptr;
rftCurve->firstAncestorOrThisOfTypeAsserted( parentPlot );
plots.insert( parentPlot );
}
}
for ( RimWellLogTrack* track : tracks )
@ -607,7 +650,7 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks( const std::vector<R
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurveCommonDataSource::updateCurvesAndTracks()
void RimWellLogCurveCommonDataSource::applyDataSourceChanges()
{
RimWellLogPlot* parentPlot = nullptr;
this->firstAncestorOrThisOfType( parentPlot );
@ -619,7 +662,7 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks()
std::vector<RimWellLogTrack*> tracks;
parentPlot->descendantsIncludingThisOfType( tracks );
this->updateCurvesAndTracks( curves, tracks );
this->applyDataSourceChanges( curves, tracks );
}
}
@ -690,7 +733,7 @@ void RimWellLogCurveCommonDataSource::applyNextTimeStep()
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmFieldHandle*> RimWellLogCurveCommonDataSource::fieldsToShowInToolbar()
{
updateDefaultOptions();
analyseCurvesAndTracks();
std::vector<caf::PdmFieldHandle*> fieldsToDisplay;
fieldsToDisplay.push_back( &m_case );
@ -741,7 +784,7 @@ void RimWellLogCurveCommonDataSource::fieldChangedByUi( const caf::PdmFieldHandl
}
}
this->updateCurvesAndTracks();
this->applyDataSourceChanges();
}
//--------------------------------------------------------------------------------------------------
@ -753,7 +796,7 @@ QList<caf::PdmOptionItemInfo>
{
QList<caf::PdmOptionItemInfo> options;
this->updateDefaultOptions();
this->analyseCurvesAndTracks();
if ( fieldNeedingOptions == &m_case )
{
@ -840,7 +883,7 @@ QList<caf::PdmOptionItemInfo>
}
else if ( fieldNeedingOptions == &m_simWellName )
{
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case() );
auto* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case() );
if ( eclipseCase )
{
std::set<QString> sortedWellNames = eclipseCase->sortedSimWellNames();
@ -887,6 +930,30 @@ QList<caf::PdmOptionItemInfo>
}
}
}
else if ( fieldNeedingOptions == &m_rftTimeStep )
{
auto eclipseCase = dynamic_cast<RimEclipseResultCase*>( m_case() );
if ( eclipseCase && eclipseCase->rftReader() )
{
options = RimRftTools::segmentTimeStepOptions( eclipseCase->rftReader(), *( m_uniqueRftWellNames.begin() ) );
}
}
else if ( fieldNeedingOptions == &m_rftWellName )
{
auto eclipseCase = dynamic_cast<RimEclipseResultCase*>( m_case() );
if ( eclipseCase && eclipseCase->rftReader() )
{
options = RimRftTools::wellNameOptions( eclipseCase->rftReader() );
}
}
else if ( fieldNeedingOptions == &m_rftSegmentBranchId )
{
auto eclipseCase = dynamic_cast<RimEclipseResultCase*>( m_case() );
if ( eclipseCase && eclipseCase->rftReader() )
{
options = RimRftTools::segmentBranchIdOptions( eclipseCase->rftReader(), m_rftWellName(), m_rftTimeStep() );
}
}
return options;
}
@ -896,12 +963,12 @@ QList<caf::PdmOptionItemInfo>
//--------------------------------------------------------------------------------------------------
void RimWellLogCurveCommonDataSource::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
updateDefaultOptions();
analyseCurvesAndTracks();
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Data Source" );
group->add( &m_case );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case() );
auto* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case() );
if ( eclipseCase )
{
group->add( &m_trajectoryType );
@ -939,6 +1006,10 @@ void RimWellLogCurveCommonDataSource::defineUiOrdering( QString uiConfigName, ca
group->add( &m_wbsSmoothingThreshold );
}
group->add( &m_rftWellName );
group->add( &m_rftTimeStep );
group->add( &m_rftSegmentBranchId );
uiOrdering.skipRemainingFields( true );
}
@ -949,10 +1020,11 @@ void RimWellLogCurveCommonDataSource::defineEditorAttribute( const caf::PdmField
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
caf::PdmUiComboBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiComboBoxEditorAttribute*>( attribute );
auto* myAttr = dynamic_cast<caf::PdmUiComboBoxEditorAttribute*>( attribute );
if ( myAttr )
{
if ( field == &m_case || field == &m_simWellName || field == &m_wellPath || field == &m_timeStep )
if ( field == &m_case || field == &m_simWellName || field == &m_wellPath || field == &m_timeStep ||
field == &m_rftTimeStep || field == &m_rftSegmentBranchId )
{
myAttr->showPreviousAndNextButtons = true;
myAttr->nextIcon = QIcon( ":/ComboBoxDown.svg" );
@ -982,8 +1054,7 @@ void RimWellLogCurveCommonDataSource::defineEditorAttribute( const caf::PdmField
myAttr->prevButtonText = "Previous " + modifierText + "PgUp)";
}
}
caf::PdmUiLineEditorAttributeUiDisplayString* uiDisplayStringAttr =
dynamic_cast<caf::PdmUiLineEditorAttributeUiDisplayString*>( attribute );
auto* uiDisplayStringAttr = dynamic_cast<caf::PdmUiLineEditorAttributeUiDisplayString*>( attribute );
if ( uiDisplayStringAttr && wbsSmoothingThreshold() == -1.0 )
{
QString displayString = "Mixed";

View File

@ -26,6 +26,8 @@
#include "cafPdmUiOrdering.h"
#include "cafTristate.h"
#include <QDateTime>
class RimCase;
class RimWellLogCurve;
class RimWellLogPlot;
@ -75,10 +77,10 @@ public:
void setTimeStepToApply( int val );
void resetDefaultOptions();
void updateDefaultOptions( const std::vector<RimWellLogCurve*>& curves, const std::vector<RimWellLogTrack*>& tracks );
void updateDefaultOptions();
void updateCurvesAndTracks( const std::vector<RimWellLogCurve*>& curves, const std::vector<RimWellLogTrack*>& tracks );
void updateCurvesAndTracks();
void analyseCurvesAndTracks( const std::vector<RimWellLogCurve*>& curves, const std::vector<RimWellLogTrack*>& tracks );
void analyseCurvesAndTracks();
void applyDataSourceChanges( const std::vector<RimWellLogCurve*>& curves, const std::vector<RimWellLogTrack*>& tracks );
void applyDataSourceChanges();
void applyPrevCase();
void applyNextCase();
@ -114,6 +116,10 @@ private:
caf::PdmField<caf::Tristate> m_wbsSmoothing;
caf::PdmField<double> m_wbsSmoothingThreshold;
caf::PdmField<QDateTime> m_rftTimeStep;
caf::PdmField<QString> m_rftWellName;
caf::PdmField<QString> m_rftSegmentBranchId;
std::set<RimCase*> m_uniqueCases;
std::set<int> m_uniqueTrajectoryTypes;
std::set<RimWellPath*> m_uniqueWellPaths;
@ -123,4 +129,8 @@ private:
std::set<int> m_uniqueBranchIndices;
std::set<bool> m_uniqueWbsSmoothing;
std::set<double, DoubleComparator> m_uniqueWbsSmoothingThreshold;
std::set<QDateTime> m_uniqueRftTimeSteps;
std::set<QString> m_uniqueRftWellNames;
std::set<QString> m_uniqueRftBranchIds;
};

View File

@ -41,6 +41,7 @@
#include "RimMainPlotCollection.h"
#include "RimObservedFmuRftData.h"
#include "RimProject.h"
#include "RimRftTools.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
#include "RimTools.h"
@ -182,6 +183,14 @@ RimWellLogRftCurve::~RimWellLogRftCurve()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogRftCurve::setWellName( const QString& wellName )
{
m_wellName = wellName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -206,6 +215,30 @@ QString RimWellLogRftCurve::wellLogChannelUnits() const
return RiaWellLogUnitTools<double>::noUnitString();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogRftCurve::setTimeStep( const QDateTime& dateTime )
{
m_timeStep = dateTime;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QDateTime RimWellLogRftCurve::timeStep() const
{
return m_timeStep();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogRftCurve::setSegmentBranchId( const QString& branchId )
{
m_segmentBranchId = branchId;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -466,7 +499,12 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
RiaDefines::EclipseUnitSystem unitSystem = RiaDefines::EclipseUnitSystem::UNITS_METRIC;
if ( m_eclipseResultCase )
{
unitSystem = m_eclipseResultCase->eclipseCaseData()->unitsType();
// TODO: If no grid data, but only RFT data is loaded, we do not have any way to
// detect unit
if ( m_eclipseResultCase->eclipseCaseData() )
{
unitSystem = m_eclipseResultCase->eclipseCaseData()->unitsType();
}
}
else if ( m_summaryCase )
{
@ -668,6 +706,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogRftCurve::calculateValueOptions( const c
if ( !options.empty() ) return options;
RifReaderRftInterface* reader = rftReader();
if ( fieldNeedingOptions == &m_eclipseResultCase )
{
RimTools::caseOptionItems( &options );
@ -676,53 +715,15 @@ QList<caf::PdmOptionItemInfo> RimWellLogRftCurve::calculateValueOptions( const c
}
else if ( fieldNeedingOptions == &m_wellName )
{
options.push_back( caf::PdmOptionItemInfo( "None", "" ) );
RifReaderRftInterface* reader = rftReader();
if ( reader )
{
std::set<QString> wellNames = reader->wellNames();
for ( const QString& name : wellNames )
{
options.push_back( caf::PdmOptionItemInfo( name, name, false, caf::IconProvider( ":/Well.svg" ) ) );
}
}
options = RimRftTools::wellNameOptions( reader );
}
else if ( fieldNeedingOptions == &m_wellLogChannelName )
{
RifReaderRftInterface* reader = rftReader();
if ( reader )
{
for ( const RifEclipseRftAddress::RftWellLogChannelType& channelName :
reader->availableWellLogChannels( m_wellName ) )
{
options.push_back(
caf::PdmOptionItemInfo( caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText( channelName ),
channelName ) );
}
}
if ( options.empty() )
{
options.push_back( caf::PdmOptionItemInfo( caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(
RifEclipseRftAddress::RftWellLogChannelType::NONE ),
RifEclipseRftAddress::RftWellLogChannelType::NONE ) );
}
options = RimRftTools::wellLogChannelsOptions( reader, m_wellName() );
}
else if ( fieldNeedingOptions == &m_timeStep )
{
RifReaderRftInterface* reader = rftReader();
if ( reader )
{
QString dateFormat = "dd MMM yyyy";
std::set<QDateTime> timeStamps = reader->availableTimeSteps( m_wellName, m_wellLogChannelName() );
for ( const QDateTime& dt : timeStamps )
{
QString dateString = RiaQDateTimeTools::toStringUsingApplicationLocale( dt, dateFormat );
options.push_back( caf::PdmOptionItemInfo( dateString, dt ) );
}
}
options.push_back( caf::PdmOptionItemInfo( "None", QDateTime() ) );
options = RimRftTools::timeStepOptions( reader, m_wellName, m_wellLogChannelName() );
}
else if ( fieldNeedingOptions == &m_branchIndex )
{
@ -733,46 +734,11 @@ QList<caf::PdmOptionItemInfo> RimWellLogRftCurve::calculateValueOptions( const c
}
else if ( fieldNeedingOptions == &m_segmentResultName )
{
options.push_front(
caf::PdmOptionItemInfo( RiaResultNames::undefinedResultName(), RiaResultNames::undefinedResultName() ) );
RifReaderRftInterface* reader = rftReader();
if ( reader )
{
options.push_back( caf::PdmOptionItemInfo( RiaDefines::segmentNumberResultName(),
RiaDefines::segmentNumberResultName() ) );
for ( const auto& resultAdr : reader->eclipseRftAddresses( m_wellName(), m_timeStep() ) )
{
if ( resultAdr.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES )
{
options.push_back(
caf::PdmOptionItemInfo( resultAdr.segmentResultName(), resultAdr.segmentResultName() ) );
}
}
}
options = RimRftTools::segmentResultNameOptions( reader, m_wellName(), m_timeStep() );
}
else if ( fieldNeedingOptions == &m_segmentBranchId )
{
options.push_front( caf::PdmOptionItemInfo( RiaDefines::allBranches(), RiaDefines::allBranches() ) );
RifReaderRftInterface* reader = rftReader();
if ( reader )
{
std::vector<double> values;
auto adr = RifEclipseRftAddress::createSegmentResult( m_wellName(),
m_timeStep,
RiaDefines::segmentBranchNumberResultName() );
reader->values( adr, &values );
for ( const auto& v : values )
{
int intValue = v;
auto txt = QString::number( intValue );
options.push_back( caf::PdmOptionItemInfo( txt, txt ) );
}
}
options = RimRftTools::segmentBranchIdOptions( reader, m_wellName(), m_timeStep() );
}
return options;

View File

@ -67,10 +67,17 @@ public:
RimWellLogRftCurve();
~RimWellLogRftCurve() override;
void setWellName( const QString& wellName );
QString wellName() const override;
QString wellLogChannelUiName() const override;
QString wellLogChannelUnits() const override;
void setTimeStep( const QDateTime& dateTime );
QDateTime timeStep() const;
void setSegmentBranchId( const QString& branchId );
void setEclipseResultCase( RimEclipseResultCase* eclipseResultCase );
RimEclipseResultCase* eclipseResultCase() const;