Regression Test: Make sure the grid is opened when reading time steps

No grid case curves was seen for  ProjectFilesSmallTests\TestCase_RFT_PLT\RegressionTest.rsp
This commit is contained in:
Magne Sjaastad committed 2025-07-20 18:39:28 +02:00
1 parent 54fdf026f4
commit 63fcc8a29f
3 files changed
+21 -6

No files matched your search

@@ -579,6 +579,12 @@ std::vector<RimPressureDepthData*> pressureDepthData()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::map<QDateTime, std::set<RifDataSourceForRftPlt>> timeStepsMapFromGridCase( RimEclipseCase* gridCase ) std::map<QDateTime, std::set<RifDataSourceForRftPlt>> timeStepsMapFromGridCase( RimEclipseCase* gridCase )
{ {
if ( !gridCase ) return {};
// Make sure the grid model is opened. This is required to read out time step dates. If no 3D views are present, the grid model is not
// yet opened.
gridCase->openEclipseGridFile();
const RigEclipseCaseData* const eclipseCaseData = gridCase->eclipseCaseData(); const RigEclipseCaseData* const eclipseCaseData = gridCase->eclipseCaseData();
std::pair<RigEclipseResultAddress, QString> resultDataInfo = pressureResultDataInfo( eclipseCaseData ); std::pair<RigEclipseResultAddress, QString> resultDataInfo = pressureResultDataInfo( eclipseCaseData );
@@ -1194,6 +1194,20 @@ std::map<QString, QStringList> RimWellRftPlot::findWellSources()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellRftPlot::onLoadDataAndUpdate() void RimWellRftPlot::onLoadDataAndUpdate()
{ {
if ( !m_isInitialized )
{
// TODO: m_selectedSources and m_selectedTimeSteps are not stored in the project file, so we need to set them here
// to ensure that the plot is initialized with the correct sources and time steps. Refactor m_selectedSources and
// m_selectedTimeSteps to be stored in the project file, and disable storing of curves to the project file. This is a temporary
// solution to ensure that the plot is initialized correctly setSelectedSourcesFromCurves();
//
// This function call was previously in initAfterRead, and triggered opening of the grid model. Moved here to allow 3D views to
// trigger open of grid model
setSelectedSourcesFromCurves();
m_isInitialized = true;
}
if ( m_isOnLoad ) if ( m_isOnLoad )
{ {
if ( plotCount() > 0 ) if ( plotCount() > 0 )
@@ -1246,12 +1260,6 @@ void RimWellRftPlot::initAfterRead()
m_wellLogPlot_OBSOLETE = nullptr; m_wellLogPlot_OBSOLETE = nullptr;
} }
// TODO: m_selectedSources and m_selectedTimeSteps are not stored in the project file, so we need to set them here
// to ensure that the plot is initialized with the correct sources and time steps. Refactor m_selectedSources and m_selectedTimeSteps to
// be stored in the project file, and disable storing of curves to the project file. This is a temporary solution to ensure that the
// plot is initialized correctly
setSelectedSourcesFromCurves();
RimWellLogPlot::initAfterRead(); RimWellLogPlot::initAfterRead();
} }
@@ -169,4 +169,5 @@ private:
bool m_isOnLoad; bool m_isOnLoad;
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE; caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE;
bool m_isInitialized = false;
}; };