mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Support loading only last geomech frame (#9727)
Support option for loading only the last frame for each geomech timestep. Turn it default on for old projects.
This commit is contained in:
@@ -363,7 +363,9 @@ RimGeoMechCase::CaseOpenStatus RimGeoMechCase::openGeoMechCase( std::string* err
|
||||
}
|
||||
|
||||
// Continue reading the open file
|
||||
if ( !geoMechCaseData->readFemParts( errorMessage, m_timeStepFilter->filteredTimeSteps() ) )
|
||||
if ( !geoMechCaseData->readFemParts( errorMessage,
|
||||
m_timeStepFilter->filteredTimeSteps(),
|
||||
m_timeStepFilter->readOnlyLastFrame() ) )
|
||||
{
|
||||
return CASE_OPEN_ERROR;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,11 @@
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReloadCaseTools.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
@@ -84,10 +86,24 @@ RimTimeStepFilter::RimTimeStepFilter()
|
||||
m_filteredTimeStepsUi.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
|
||||
m_filteredTimeStepsUi.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitField( &m_readOnlyLastFrame, "OnlyLastFrame", false, "Load Only Last Frame Of Each Time Step" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_readOnlyLastFrame );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_applyReloadOfCase, "ApplyReloadOfCase", "" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField( &m_applyReloadOfCase );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTimeStepFilter::initAfterRead()
|
||||
{
|
||||
if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2023.1" ) )
|
||||
{
|
||||
m_readOnlyLastFrame = true;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -272,19 +288,18 @@ void RimTimeStepFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
|
||||
RimGeoMechCase* rimGeoMechCase = parentGeoMechCase();
|
||||
if ( changedField == &m_applyReloadOfCase )
|
||||
{
|
||||
if ( updateFilteredTimeStepsFromUi() )
|
||||
{
|
||||
if ( rimEclipseResultCase )
|
||||
{
|
||||
RimReloadCaseTools::reloadAllEclipseGridData( rimEclipseResultCase );
|
||||
}
|
||||
else if ( rimGeoMechCase )
|
||||
{
|
||||
rimGeoMechCase->reloadDataAndUpdate();
|
||||
}
|
||||
updateFilteredTimeStepsFromUi();
|
||||
|
||||
return;
|
||||
if ( rimEclipseResultCase )
|
||||
{
|
||||
RimReloadCaseTools::reloadAllEclipseGridData( rimEclipseResultCase );
|
||||
}
|
||||
else if ( rimGeoMechCase )
|
||||
{
|
||||
rimGeoMechCase->reloadDataAndUpdate();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( changedField == &m_filterType || changedField == &m_firstTimeStep || changedField == &m_lastTimeStep ||
|
||||
@@ -448,6 +463,8 @@ void RimTimeStepFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi
|
||||
else if ( geoMechCase )
|
||||
{
|
||||
caseLoaded = geoMechCase->geoMechData() != nullptr;
|
||||
|
||||
uiOrdering.add( &m_readOnlyLastFrame );
|
||||
}
|
||||
|
||||
if ( caseLoaded )
|
||||
@@ -459,3 +476,19 @@ void RimTimeStepFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTimeStepFilter::setReadOnlyLastFrame( bool onlyLast )
|
||||
{
|
||||
m_readOnlyLastFrame = onlyLast;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimTimeStepFilter::readOnlyLastFrame() const
|
||||
{
|
||||
return m_readOnlyLastFrame;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,12 @@ public:
|
||||
TimeStepFilterTypeEnum filterType,
|
||||
int interval );
|
||||
|
||||
void setReadOnlyLastFrame( bool onlyLast );
|
||||
bool readOnlyLastFrame() const;
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
|
||||
private:
|
||||
static QDateTime incrementDateTime( const QDateTime& dateTime, TimeStepFilterTypeEnum filterType, int interval );
|
||||
|
||||
@@ -89,4 +95,5 @@ private:
|
||||
caf::PdmField<bool> m_applyReloadOfCase;
|
||||
caf::PdmField<QString> m_dateFormat;
|
||||
caf::PdmField<std::vector<QString>> m_timeStepNamesFromFile;
|
||||
caf::PdmField<bool> m_readOnlyLastFrame;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user