Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCurve.h"
#include "RimParameterResultCrossPlot.h"
#include "RimParameterRftCrossPlot.h"
#include "RimPlotWindow.h"
#include "RimProject.h"
#include "RimRftCorrelationReportPlot.h"
#include "RimRftTornadoPlot.h"
#include "RimSummaryPlot.h"
#include "RimWellAllocationOverTimePlot.h"
#include "RimWellLogPlot.h"
Expand Down Expand Up @@ -190,7 +193,7 @@ bool RicShowPlotDataFeature::isCommandEnabled() const
dynamic_cast<RimGridCrossPlot*>( plot ) || dynamic_cast<RimCustomVfpPlot*>( plot ) ||
dynamic_cast<RimWellAllocationOverTimePlot*>( plot ) || dynamic_cast<RimAnalysisPlot*>( plot ) ||
dynamic_cast<RimCorrelationMatrixPlot*>( plot ) || dynamic_cast<RimAbstractCorrelationPlot*>( plot ) ||
dynamic_cast<RimCorrelationReportPlot*>( plot ) )
dynamic_cast<RimCorrelationReportPlot*>( plot ) || dynamic_cast<RimRftCorrelationReportPlot*>( plot ) )
{
validPlots++;
}
Expand Down Expand Up @@ -265,6 +268,13 @@ void RicShowPlotDataFeature::onActionTriggered( bool isChecked )
continue;
}

if ( auto rftReportPlot = dynamic_cast<RimRftCorrelationReportPlot*>( plot ) )
{
rimPlots.push_back( rftReportPlot->crossPlot() );
rimPlots.push_back( rftReportPlot->correlationPlot() );
continue;
}

if ( auto rimPlot = dynamic_cast<RimPlot*>( plot ) )
{
rimPlots.push_back( rimPlot );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogCalculatedCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateRftPlotsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateRftPlotsFeatureUi.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateRftCorrelationReportFeature.h
)

set(SOURCE_GROUP_SOURCE_FILES
Expand Down Expand Up @@ -70,6 +71,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogCalculatedCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateRftPlotsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateRftPlotsFeatureUi.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateRftCorrelationReportFeature.cpp
)

list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026 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 "RicCreateRftCorrelationReportFeature.h"

#include "RimCorrelationPlotCollection.h"
#include "RimMainPlotCollection.h"
#include "RimRftCorrelationReportPlot.h"
#include "RimWellRftPlot.h"

#include "RiuPlotMainWindowTools.h"

#include "cafSelectionManager.h"

#include <QAction>

CAF_CMD_SOURCE_INIT( RicCreateRftCorrelationReportFeature, "RicCreateRftCorrelationReportFeature" );

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateRftCorrelationReportFeature::isCommandEnabled() const
{
return dynamic_cast<RimWellRftPlot*>( caf::SelectionManager::instance()->selectedItem() ) != nullptr;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateRftCorrelationReportFeature::onActionTriggered( bool /*isChecked*/ )
{
auto* sourcePlot = dynamic_cast<RimWellRftPlot*>( caf::SelectionManager::instance()->selectedItem() );
if ( !sourcePlot ) return;

auto* correlationColl = RimMainPlotCollection::current()->correlationPlotCollection();
if ( !correlationColl ) return;

auto* report = correlationColl->createRftCorrelationReportPlot( sourcePlot );
if ( !report ) return;

report->loadDataAndUpdate();
correlationColl->updateConnectedEditors();

RiuPlotMainWindowTools::showPlotMainWindow();
RiuPlotMainWindowTools::onObjectAppended( report );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateRftCorrelationReportFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Create RFT Correlation Report" );
actionToSetup->setIcon( QIcon( ":/CorrelationReportPlot16x16.png" ) );
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026 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 "cafCmdFeature.h"

//==================================================================================================
/// Creates a RimRftCorrelationReportPlot from the context menu of a RimWellRftPlot.
//==================================================================================================
class RicCreateRftCorrelationReportFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;

private:
bool isCommandEnabled() const override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};
15 changes: 12 additions & 3 deletions ApplicationLibCode/FileInterface/RifReaderRftInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ std::vector<double>
auto cellIjk = cellIndices( wellName, timeStep );
for ( const caf::VecIjk0& ijk : cellIjk )
{
if ( ijk.i() >= mainGrid->cellCountI() || ijk.j() >= mainGrid->cellCountJ() || ijk.k() >= mainGrid->cellCountK() ) continue;

auto globalCellIndex = mainGrid->cellIndexFromIJK( ijk.i(), ijk.j(), ijk.k() );

auto avgMd = eclExtractor->averageMdForCell( globalCellIndex );
Expand All @@ -80,10 +82,17 @@ std::vector<double>
{
// The RFT cell is not part of cells intersected by well path
// Use the TVD of cell center to estimate measured depth

avgMeasuredDepthForCells.push_back( std::numeric_limits<double>::infinity() );
auto center = mainGrid->cell( globalCellIndex ).center();
tvdValuesToEstimate.push_back( -center.z() );

const RigCell& cell = mainGrid->cell( globalCellIndex );
if ( cell.isInvalid() )
{
tvdValuesToEstimate.push_back( std::numeric_limits<double>::infinity() );
}
else
{
tvdValuesToEstimate.push_back( -cell.center().z() );
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimCorrelationPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimCorrelationMatrixPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimParameterResultCrossPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimParameterRftCrossPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimCorrelationPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimCorrelationReportPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimRftCorrelationReportPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimRftTornadoPlot.h
)

set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimAbstractCorrelationPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimCorrelationPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimCorrelationMatrixPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimParameterResultCrossPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimParameterRftCrossPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimCorrelationPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimCorrelationReportPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimRftCorrelationReportPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimRftTornadoPlot.cpp
)

list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
#include "RimCorrelationPlot.h"
#include "RimCorrelationReportPlot.h"
#include "RimParameterResultCrossPlot.h"
#include "RimParameterRftCrossPlot.h"
#include "RimProject.h"
#include "RimRftCorrelationReportPlot.h"
#include "RimSummaryEnsemble.h"
#include "RimSummaryEnsembleTools.h"
#include "RimWellRftPlot.h"

CAF_PDM_SOURCE_INIT( RimCorrelationPlotCollection, "CorrelationPlotCollection" );

Expand All @@ -39,6 +42,7 @@ RimCorrelationPlotCollection::RimCorrelationPlotCollection()

CAF_PDM_InitFieldNoDefault( &m_correlationPlots, "CorrelationPlots", "Correlation Plots" );
CAF_PDM_InitFieldNoDefault( &m_correlationReports, "CorrelationReports", "Correlation Reports" );
CAF_PDM_InitFieldNoDefault( &m_rftCorrelationReports, "RftCorrelationReports", "RFT Correlation Reports" );
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -174,6 +178,52 @@ RimCorrelationReportPlot* RimCorrelationPlotCollection::createCorrelationReportP
return report;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimRftCorrelationReportPlot* RimCorrelationPlotCollection::createRftCorrelationReportPlot( RimWellRftPlot* source )
{
auto* report = new RimRftCorrelationReportPlot;
report->setAsPlotMdiWindow();

if ( source )
{
report->initializeFromSourcePlot( source );

const auto ensembles = source->selectedEnsembles();
if ( !ensembles.empty() )
{
auto* ensemble = ensembles.front();
report->crossPlot()->setEnsemble( ensemble );

// Pick the first numeric ensemble parameter as a default
for ( const auto& param : RimSummaryEnsembleTools::alphabeticEnsembleParameters( ensemble->allSummaryCases() ) )
{
if ( param.isNumeric() )
{
report->crossPlot()->setEnsembleParameter( param.name );
break;
}
}
}
report->crossPlot()->setWellName( source->simWellOrWellPathName() );

const auto timeSteps = source->selectedTimeSteps();
if ( !timeSteps.empty() ) report->crossPlot()->setTimeStep( timeSteps.front() );
}

m_rftCorrelationReports.push_back( report );
return report;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimRftCorrelationReportPlot*> RimCorrelationPlotCollection::rftReports() const
{
return m_rftCorrelationReports.childrenByType();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -222,6 +272,7 @@ void RimCorrelationPlotCollection::deleteAllPlots()
{
RimTypedPlotCollection<RimAbstractCorrelationPlot>::deleteAllPlots();
m_correlationReports.deleteChildren();
m_rftCorrelationReports.deleteChildren();
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -382,6 +433,9 @@ void RimCorrelationPlotCollection::loadDataAndUpdateAllPlots()
for ( const auto& corrPlot : m_correlationPlots )
corrPlot->loadDataAndUpdate();

for ( const auto& reports : m_correlationReports )
reports->loadDataAndUpdate();
for ( const auto& report : m_correlationReports )
report->loadDataAndUpdate();

for ( const auto& rftReport : m_rftCorrelationReports )
rftReport->loadDataAndUpdate();
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class RimCorrelationPlot;
class RimCorrelationMatrixPlot;
class RimCorrelationReportPlot;
class RimParameterResultCrossPlot;
class RimRftCorrelationReportPlot;
class RimSummaryEnsemble;
class RimWellRftPlot;

//==================================================================================================
///
Expand Down Expand Up @@ -66,14 +68,17 @@ class RimCorrelationPlotCollection : public caf::PdmObject, public RimTypedPlotC

void removeReport( RimCorrelationReportPlot* correlationReport );

RimRftCorrelationReportPlot* createRftCorrelationReportPlot( RimWellRftPlot* source );

std::vector<RimAbstractCorrelationPlot*> plots() const final;
size_t plotCount() const final;
void insertPlot( RimAbstractCorrelationPlot* plot, size_t index ) final;
void removePlot( RimAbstractCorrelationPlot* correlationPlot ) final;
void deleteAllPlots() final;
void loadDataAndUpdateAllPlots() override;

std::vector<RimCorrelationReportPlot*> reports() const;
std::vector<RimCorrelationReportPlot*> reports() const;
std::vector<RimRftCorrelationReportPlot*> rftReports() const;

private:
void applyFirstEnsembleFieldAddressesToPlot( RimAbstractCorrelationPlot* plot, const std::vector<QString>& quantityNames = {} );
Expand All @@ -91,6 +96,7 @@ class RimCorrelationPlotCollection : public caf::PdmObject, public RimTypedPlotC
std::time_t timeStep );

private:
caf::PdmChildArrayField<RimAbstractCorrelationPlot*> m_correlationPlots;
caf::PdmChildArrayField<RimCorrelationReportPlot*> m_correlationReports;
caf::PdmChildArrayField<RimAbstractCorrelationPlot*> m_correlationPlots;
caf::PdmChildArrayField<RimCorrelationReportPlot*> m_correlationReports;
caf::PdmChildArrayField<RimRftCorrelationReportPlot*> m_rftCorrelationReports;
};
Loading
Loading