mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5612 Saturation Pressure Plots : Add support for user defined time step
This commit is contained in:
@@ -49,7 +49,7 @@ CAF_CMD_SOURCE_INIT( RicCreateSaturationPressurePlotsFeature, "RicCreateSaturati
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSaturationPressurePlot*>
|
||||
RicCreateSaturationPressurePlotsFeature::createPlots( RimEclipseResultCase* eclipseResultCase )
|
||||
RicCreateSaturationPressurePlotsFeature::createPlots( RimEclipseResultCase* eclipseResultCase, int timeStep )
|
||||
{
|
||||
std::vector<RimSaturationPressurePlot*> plots;
|
||||
|
||||
@@ -99,7 +99,7 @@ std::vector<RimSaturationPressurePlot*>
|
||||
}
|
||||
}
|
||||
|
||||
plots = collection->createSaturationPressurePlots( eclipseResultCase );
|
||||
plots = collection->createSaturationPressurePlots( eclipseResultCase, timeStep );
|
||||
for ( auto plot : plots )
|
||||
{
|
||||
plot->loadDataAndUpdate();
|
||||
@@ -143,6 +143,7 @@ void RicCreateSaturationPressurePlotsFeature::onActionTriggered( bool isChecked
|
||||
}
|
||||
|
||||
RimEclipseResultCase* eclipseResultCase = nullptr;
|
||||
int timeStep = 0;
|
||||
|
||||
if ( !eclipseCases.empty() )
|
||||
{
|
||||
@@ -150,7 +151,8 @@ void RicCreateSaturationPressurePlotsFeature::onActionTriggered( bool isChecked
|
||||
{
|
||||
eclipseResultCase = eclipseCases[0];
|
||||
}
|
||||
else
|
||||
|
||||
if ( !eclipseResultCase || eclipseResultCase->timeStepDates().size() > 1 )
|
||||
{
|
||||
RicSaturationPressureUi saturationPressureUi;
|
||||
saturationPressureUi.setSelectedCase( eclipseCases[0] );
|
||||
@@ -165,13 +167,14 @@ void RicCreateSaturationPressurePlotsFeature::onActionTriggered( bool isChecked
|
||||
if ( propertyDialog.exec() == QDialog::Accepted )
|
||||
{
|
||||
eclipseResultCase = dynamic_cast<RimEclipseResultCase*>( saturationPressureUi.selectedCase() );
|
||||
timeStep = saturationPressureUi.selectedTimeStep();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
caf::PdmObject* objectToSelect = nullptr;
|
||||
|
||||
std::vector<RimSaturationPressurePlot*> plots = createPlots( eclipseResultCase );
|
||||
std::vector<RimSaturationPressurePlot*> plots = createPlots( eclipseResultCase, timeStep );
|
||||
if ( plots.empty() )
|
||||
{
|
||||
QString text = "No plots generated.\n\n";
|
||||
|
||||
@@ -31,7 +31,7 @@ class RicCreateSaturationPressurePlotsFeature : public caf::CmdFeature
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static std::vector<RimSaturationPressurePlot*> createPlots( RimEclipseResultCase* eclipseCase );
|
||||
static std::vector<RimSaturationPressurePlot*> createPlots( RimEclipseResultCase* eclipseCase, int timeStep );
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
|
||||
@@ -32,6 +32,7 @@ RicSaturationPressureUi::RicSaturationPressureUi()
|
||||
CAF_PDM_InitObject( "RicSaturationPressureUi", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_caseToApply, "CaseToApply", "Case to Apply", "", "", "" );
|
||||
CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -50,6 +51,14 @@ RimEclipseCase* RicSaturationPressureUi::selectedCase() const
|
||||
return m_caseToApply();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RicSaturationPressureUi::selectedTimeStep() const
|
||||
{
|
||||
return m_timeStep();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -62,6 +71,19 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
RimTools::caseOptionItems( &options );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_timeStep )
|
||||
{
|
||||
QStringList timeStepNames;
|
||||
|
||||
if ( m_caseToApply )
|
||||
{
|
||||
timeStepNames = m_caseToApply->timeStepStrings();
|
||||
}
|
||||
for ( int i = 0; i < timeStepNames.size(); i++ )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( timeStepNames[i], i ) );
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
|
||||
void setSelectedCase( RimEclipseCase* eclipseCase );
|
||||
RimEclipseCase* selectedCase() const;
|
||||
int selectedTimeStep() const;
|
||||
|
||||
protected:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
@@ -44,4 +45,5 @@ protected:
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseCase*> m_caseToApply;
|
||||
caf::PdmField<int> m_timeStep;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user