mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Make decent defaults for correlation plots
This commit is contained in:
@@ -58,6 +58,25 @@ RimAbstractCorrelationPlot::~RimAbstractCorrelationPlot()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAbstractCorrelationPlot::setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions )
|
||||
{
|
||||
m_analysisPlotDataSelection.deleteAllChildObjects();
|
||||
for ( auto curveDef : curveDefinitions )
|
||||
{
|
||||
auto dataEntry = new RimAnalysisPlotDataEntry();
|
||||
dataEntry->setFromCurveDefinition( curveDef );
|
||||
m_analysisPlotDataSelection.push_back( dataEntry );
|
||||
}
|
||||
auto timeSteps = allAvailableTimeSteps();
|
||||
if ( !timeSteps.empty() )
|
||||
{
|
||||
m_timeStep = QDateTime::fromTime_t( *timeSteps.rbegin() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -40,6 +40,10 @@ public:
|
||||
RimAbstractCorrelationPlot();
|
||||
~RimAbstractCorrelationPlot() override;
|
||||
|
||||
public:
|
||||
void setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions );
|
||||
std::set<RimSummaryCaseCollection*> ensembles();
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
|
||||
@@ -56,10 +60,9 @@ protected:
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefinitions() const;
|
||||
RiaSummaryCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser();
|
||||
|
||||
std::set<RifEclipseSummaryAddress> addresses();
|
||||
std::set<RimSummaryCaseCollection*> ensembles();
|
||||
std::set<EnsembleParameter> ensembleParameters();
|
||||
EnsembleParameter ensembleParameter( const QString& ensembleParameterName );
|
||||
std::set<RifEclipseSummaryAddress> addresses();
|
||||
std::set<EnsembleParameter> ensembleParameters();
|
||||
EnsembleParameter ensembleParameter( const QString& ensembleParameterName );
|
||||
|
||||
// RimViewWindow overrides
|
||||
QWidget* viewWidget() override;
|
||||
|
||||
@@ -18,9 +18,11 @@
|
||||
|
||||
#include "RimCorrelationPlotCollection.h"
|
||||
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
#include "RimCorrelationMatrixPlot.h"
|
||||
#include "RimCorrelationPlot.h"
|
||||
#include "RimParameterResultCrossPlot.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimCorrelationPlotCollection, "CorrelationPlotCollection" );
|
||||
|
||||
@@ -45,11 +47,13 @@ RimCorrelationPlotCollection::~RimCorrelationPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot()
|
||||
RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot( bool defaultToFirstEnsembleFopt )
|
||||
{
|
||||
RimCorrelationPlot* plot = new RimCorrelationPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToPlot( plot, "FOPT" );
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
|
||||
return plot;
|
||||
@@ -58,10 +62,11 @@ RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixPlot()
|
||||
RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixPlot( bool defaultToFirstEnsembleField )
|
||||
{
|
||||
RimCorrelationMatrixPlot* plot = new RimCorrelationMatrixPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
if ( defaultToFirstEnsembleField ) applyFirstEnsembleFieldAddressesToPlot( plot );
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
|
||||
@@ -71,10 +76,12 @@ RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixP
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResultCrossPlot()
|
||||
RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResultCrossPlot( bool defaultToFirstEnsembleFopt )
|
||||
{
|
||||
RimParameterResultCrossPlot* plot = new RimParameterResultCrossPlot;
|
||||
plot->setAsPlotMdiWindow();
|
||||
if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToPlot( plot, "FOPT" );
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
return plot;
|
||||
}
|
||||
@@ -102,3 +109,35 @@ void RimCorrelationPlotCollection::deleteAllChildObjects()
|
||||
{
|
||||
m_correlationPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToPlot( RimAbstractCorrelationPlot* plot,
|
||||
const std::string& quantityName /*= "FOPT" */ )
|
||||
{
|
||||
std::vector<RimSummaryCaseCollection*> ensembles;
|
||||
RimProject::current()->descendantsIncludingThisOfType( ensembles );
|
||||
if ( !ensembles.empty() )
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> allAddresses = ensembles.front()->ensembleSummaryAddresses();
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefs;
|
||||
for ( auto address : allAddresses )
|
||||
{
|
||||
if ( address.category() == RifEclipseSummaryAddress::SUMMARY_FIELD )
|
||||
{
|
||||
if ( quantityName.empty() || quantityName == address.quantityName() )
|
||||
{
|
||||
curveDefs.push_back( RiaSummaryCurveDefinition( nullptr, address, ensembles.front() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
plot->setCurveDefinitions( curveDefs );
|
||||
|
||||
auto crossPlot = dynamic_cast<RimParameterResultCrossPlot*>( plot );
|
||||
if ( crossPlot )
|
||||
{
|
||||
crossPlot->setEnsembleParameter( ensembles.front()->alphabeticEnsembleParameters().front().name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,15 +38,18 @@ public:
|
||||
RimCorrelationPlotCollection();
|
||||
~RimCorrelationPlotCollection() override;
|
||||
|
||||
RimCorrelationPlot* createCorrelationPlot();
|
||||
RimCorrelationMatrixPlot* createCorrelationMatrixPlot();
|
||||
RimParameterResultCrossPlot* createParameterResultCrossPlot();
|
||||
RimCorrelationPlot* createCorrelationPlot( bool defaultToFirstEnsembleFopt = true );
|
||||
RimCorrelationMatrixPlot* createCorrelationMatrixPlot( bool defaultToFirstEnsembleField = true );
|
||||
RimParameterResultCrossPlot* createParameterResultCrossPlot( bool defaultToFirstEnsembleFopt = true );
|
||||
void removePlot( RimAbstractCorrelationPlot* CorrelationPlot );
|
||||
|
||||
std::vector<RimAbstractCorrelationPlot*> plots();
|
||||
|
||||
void deleteAllChildObjects();
|
||||
|
||||
private:
|
||||
void applyFirstEnsembleFieldAddressesToPlot( RimAbstractCorrelationPlot* plot, const std::string& quantityName = "" );
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimAbstractCorrelationPlot*> m_correlationPlots;
|
||||
};
|
||||
|
||||
@@ -73,6 +73,14 @@ RimParameterResultCrossPlot::~RimParameterResultCrossPlot()
|
||||
cleanupBeforeClose();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimParameterResultCrossPlot::setEnsembleParameter( const QString& ensembleParameter )
|
||||
{
|
||||
m_ensembleParameter = ensembleParameter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -31,6 +31,7 @@ class RimParameterResultCrossPlot : public RimAbstractCorrelationPlot
|
||||
public:
|
||||
RimParameterResultCrossPlot();
|
||||
~RimParameterResultCrossPlot() override;
|
||||
void setEnsembleParameter( const QString& ensembleParameter );
|
||||
|
||||
private:
|
||||
// Overridden PDM methods
|
||||
|
||||
Reference in New Issue
Block a user