#6479 Update analysis and correlation plots when closing derived cases

This commit is contained in:
Gaute Lindkvist 2020-09-11 13:55:04 +02:00
parent 81b2bd1720
commit b4aaaa98e9
22 changed files with 269 additions and 60 deletions

View File

@ -37,12 +37,23 @@ RiaSummaryCurveDefinition::RiaSummaryCurveDefinition()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaSummaryCurveDefinition::RiaSummaryCurveDefinition( RimSummaryCase* summaryCase,
const RifEclipseSummaryAddress& summaryAddress )
: m_summaryCase( summaryCase )
, m_ensemble( nullptr )
, m_summaryAddress( summaryAddress )
, m_treatAsSingleSummaryCurve( true )
{
}
RiaSummaryCurveDefinition::RiaSummaryCurveDefinition( RimSummaryCase* summaryCase,
const RifEclipseSummaryAddress& summaryAddress,
RimSummaryCaseCollection* ensemble )
RimSummaryCaseCollection* ensemble,
bool treatAsSingleSummaryCurve )
: m_summaryCase( summaryCase )
, m_ensemble( ensemble )
, m_summaryAddress( summaryAddress )
, m_treatAsSingleSummaryCurve( treatAsSingleSummaryCurve )
{
}
@ -75,7 +86,7 @@ const RifEclipseSummaryAddress& RiaSummaryCurveDefinition::summaryAddress() cons
//--------------------------------------------------------------------------------------------------
bool RiaSummaryCurveDefinition::isEnsembleCurve() const
{
return m_ensemble != nullptr;
return m_ensemble != nullptr && !m_treatAsSingleSummaryCurve;
}
//--------------------------------------------------------------------------------------------------
@ -210,7 +221,12 @@ void RiaSummaryCurveDefinitionAnalyser::setCurveDefinitions( const std::vector<R
for ( const auto& curveDef : curveDefs )
{
bool valid = false;
if ( curveDef.summaryCase() )
if ( curveDef.ensemble() && curveDef.isEnsembleCurve() )
{
m_ensembles.insert( curveDef.ensemble() );
valid = true;
}
else if ( curveDef.summaryCase() )
{
m_singleSummaryCases.insert( curveDef.summaryCase() );
@ -220,11 +236,6 @@ void RiaSummaryCurveDefinitionAnalyser::setCurveDefinitions( const std::vector<R
valid = true;
}
}
else if ( curveDef.ensemble() )
{
m_ensembles.insert( curveDef.ensemble() );
valid = true;
}
if ( valid )
{
RifEclipseSummaryAddress address = curveDef.summaryAddress();

View File

@ -35,9 +35,11 @@ class RiaSummaryCurveDefinition
{
public:
RiaSummaryCurveDefinition();
explicit RiaSummaryCurveDefinition( RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& summaryAddress );
explicit RiaSummaryCurveDefinition( RimSummaryCase* summaryCase,
const RifEclipseSummaryAddress& summaryAddress,
RimSummaryCaseCollection* ensemble = nullptr );
RimSummaryCaseCollection* ensemble,
bool treatAsSingleSummaryCurve );
RimSummaryCase* summaryCase() const;
const RifEclipseSummaryAddress& summaryAddress() const;
@ -58,6 +60,7 @@ private:
RimSummaryCase* m_summaryCase;
RifEclipseSummaryAddress m_summaryAddress;
RimSummaryCaseCollection* m_ensemble;
bool m_treatAsSingleSummaryCurve;
};
class RiaSummaryCurveDefinitionAnalyser

View File

@ -89,7 +89,7 @@ void RicNewDerivedEnsembleFeature::onActionTriggered( bool isChecked )
if ( ensembles.size() == 2 )
{
newEnsemble->setEnsemble2( ensembles[1] );
newEnsemble->updateDerivedEnsembleCases();
newEnsemble->createDerivedEnsembleCases();
if ( newEnsemble->allSummaryCases().empty() )
{

View File

@ -355,8 +355,10 @@ void RicSummaryPlotEditorUi::syncPreviewCurvesFromUiSelection()
for ( const auto& curve : currentCurvesInPreviewPlot )
{
RimSummaryCase* sumCase = curve->summaryCaseY();
currentCurveDefs.insert(
RiaSummaryCurveDefinition( sumCase, curve->summaryAddressY(), sumCase ? sumCase->ensemble() : nullptr ) );
currentCurveDefs.insert( RiaSummaryCurveDefinition( sumCase,
curve->summaryAddressY(),
sumCase ? sumCase->ensemble() : nullptr,
sumCase && sumCase->ensemble() ) );
}
{
@ -373,7 +375,8 @@ void RicSummaryPlotEditorUi::syncPreviewCurvesFromUiSelection()
RimSummaryCase* sumCase = curve->summaryCaseY();
if ( sumCase && sumCase->ensemble() ) continue;
RiaSummaryCurveDefinition curveDef = RiaSummaryCurveDefinition( sumCase, curve->summaryAddressY() );
RiaSummaryCurveDefinition curveDef =
RiaSummaryCurveDefinition( sumCase, curve->summaryAddressY(), nullptr, false );
if ( deleteCurveDefs.count( curveDef ) > 0 ) curvesToDelete.insert( curve );
}
}
@ -594,7 +597,7 @@ void RicSummaryPlotEditorUi::populateCurveCreator( const RimSummaryPlot& sourceS
for ( const auto& curve : sourceSummaryPlot.summaryCurves() )
{
curveDefs.push_back( RiaSummaryCurveDefinition( curve->summaryCaseY(), curve->summaryAddressY() ) );
curveDefs.push_back( RiaSummaryCurveDefinition( curve->summaryCaseY(), curve->summaryAddressY(), nullptr, false ) );
// Copy curve object to the preview plot
copyCurveAndAddToPlot( curve, m_previewPlot.get(), true );
@ -610,7 +613,8 @@ void RicSummaryPlotEditorUi::populateCurveCreator( const RimSummaryPlot& sourceS
RimSummaryCaseCollection* ensemble = curveSet->summaryCaseCollection();
for ( const auto& curve : curveSet->curves() )
{
curveDefs.push_back( RiaSummaryCurveDefinition( curve->summaryCaseY(), curve->summaryAddressY(), ensemble ) );
curveDefs.push_back(
RiaSummaryCurveDefinition( curve->summaryCaseY(), curve->summaryAddressY(), ensemble, true ) );
}
}

View File

@ -202,6 +202,7 @@ RimPlotDataFilterCollection* RimAnalysisPlot::plotDataFilterCollection() const
//--------------------------------------------------------------------------------------------------
void RimAnalysisPlot::setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions )
{
disconnectAllCaseSignals();
m_analysisPlotDataSelection.deleteAllChildObjects();
for ( auto curveDef : curveDefinitions )
{
@ -209,6 +210,8 @@ void RimAnalysisPlot::setCurveDefinitions( const std::vector<RiaSummaryCurveDefi
dataEntry->setFromCurveDefinition( curveDef );
m_analysisPlotDataSelection.push_back( dataEntry );
}
connectAllCaseSignals();
auto timeSteps = allAvailableTimeSteps();
if ( m_selectedTimeSteps().empty() && !timeSteps.empty() )
{
@ -456,13 +459,16 @@ void RimAnalysisPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
if ( dlg.exec() == QDialog::Accepted )
{
std::vector<RiaSummaryCurveDefinition> summaryVectorDefinitions = dlg.curveSelection();
disconnectAllCaseSignals();
m_analysisPlotDataSelection.deleteAllChildObjects();
for ( const RiaSummaryCurveDefinition& vectorDef : summaryVectorDefinitions )
{
auto plotEntry = new RimAnalysisPlotDataEntry();
plotEntry->setFromCurveDefinition( vectorDef );
m_analysisPlotDataSelection.push_back( plotEntry );
auto dataEntry = new RimAnalysisPlotDataEntry();
dataEntry->setFromCurveDefinition( vectorDef );
m_analysisPlotDataSelection.push_back( dataEntry );
}
connectAllCaseSignals();
}
m_selectVariablesButtonField = false;
@ -1673,7 +1679,10 @@ std::vector<RiaSummaryCurveDefinition> RimAnalysisPlot::curveDefinitionsWithoutE
std::vector<RiaSummaryCurveDefinition> curveDefs;
for ( auto dataEntry : m_analysisPlotDataSelection )
{
curveDefs.push_back( dataEntry->curveDefinition() );
if ( dataEntry->isEnsembleCurve() )
{
curveDefs.push_back( dataEntry->curveDefinition() );
}
}
return curveDefs;
@ -1694,7 +1703,8 @@ std::vector<RiaSummaryCurveDefinition> RimAnalysisPlot::curveDefinitionsWithEmbe
{
barDataDefinitions.push_back( RiaSummaryCurveDefinition( orgBarDataEntry.summaryCase(),
orgBarDataEntry.summaryAddress(),
orgBarDataEntry.summaryCase()->ensemble() ) );
orgBarDataEntry.summaryCase()->ensemble(),
orgBarDataEntry.isEnsembleCurve() ) );
}
else
{
@ -1796,3 +1806,57 @@ int RimAnalysisPlot::barTextFontSize() const
{
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), m_barTextFontSize() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnalysisPlot::initAfterRead()
{
connectAllCaseSignals();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnalysisPlot::onCaseRemoved( const SignalEmitter* emitter, RimSummaryCase* summaryCase )
{
for ( auto existingEntry : m_analysisPlotDataSelection )
{
if ( existingEntry->summaryCase() == summaryCase )
{
m_analysisPlotDataSelection.removeChildObject( existingEntry );
delete existingEntry;
break;
}
}
loadDataAndUpdate();
if ( m_plotWidget ) m_plotWidget->scheduleReplot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnalysisPlot::connectAllCaseSignals()
{
for ( auto dataEntry : m_analysisPlotDataSelection )
{
if ( dataEntry->ensemble() )
{
dataEntry->ensemble()->caseRemoved.connect( this, &RimAnalysisPlot::onCaseRemoved );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnalysisPlot::disconnectAllCaseSignals()
{
for ( auto dataEntry : m_analysisPlotDataSelection )
{
if ( dataEntry->ensemble() )
{
dataEntry->ensemble()->caseRemoved.disconnect( this );
}
}
}

View File

@ -176,7 +176,13 @@ private:
void buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder );
int barTextFontSize() const;
int barTextFontSize() const;
void initAfterRead();
private:
void onCaseRemoved( const SignalEmitter* emitter, RimSummaryCase* summaryCase );
void connectAllCaseSignals();
void disconnectAllCaseSignals();
private:
std::unique_ptr<RiaSummaryCurveDefinitionAnalyser> m_analyserOfSelectedCurveDefs;

View File

@ -147,7 +147,7 @@ void RimAnalysisPlotCollection::applyFirstEnsembleFieldAddressesToPlot( RimAnaly
{
for ( auto summaryCase : ensembles.front()->allSummaryCases() )
{
curveDefs.push_back( RiaSummaryCurveDefinition( summaryCase, address, nullptr ) );
curveDefs.push_back( RiaSummaryCurveDefinition( summaryCase, address, ensembles.front(), false ) );
}
}
}
@ -173,7 +173,7 @@ void RimAnalysisPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAnalysis
{
for ( auto summaryCase : ensemble->allSummaryCases() )
{
curveDefs.push_back( RiaSummaryCurveDefinition( summaryCase, address, nullptr ) );
curveDefs.push_back( RiaSummaryCurveDefinition( summaryCase, address, ensemble, false ) );
}
}
}

View File

@ -47,6 +47,8 @@ RimAnalysisPlotDataEntry::RimAnalysisPlotDataEntry()
m_summaryAddress.uiCapability()->setUiHidden( true );
m_summaryAddress.uiCapability()->setUiTreeChildrenHidden( true );
m_summaryAddress = new RimSummaryAddress;
CAF_PDM_InitField( &m_isEnsembleCurve, "IsEnsembleCurve", false, "Is Ensemble Curve", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
@ -66,10 +68,8 @@ void RimAnalysisPlotDataEntry::setFromCurveDefinition( const RiaSummaryCurveDefi
{
m_ensemble = curveDef.ensemble();
}
else
{
m_summaryCase = curveDef.summaryCase();
}
m_summaryCase = curveDef.summaryCase();
m_isEnsembleCurve = curveDef.isEnsembleCurve();
}
//--------------------------------------------------------------------------------------------------
@ -79,9 +79,9 @@ RiaSummaryCurveDefinition RimAnalysisPlotDataEntry::curveDefinition() const
{
if ( m_ensemble )
{
return RiaSummaryCurveDefinition( nullptr, m_summaryAddress->address(), m_ensemble() );
return RiaSummaryCurveDefinition( m_summaryCase(), m_summaryAddress->address(), m_ensemble(), m_isEnsembleCurve );
}
return RiaSummaryCurveDefinition( m_summaryCase(), m_summaryAddress->address(), nullptr );
return RiaSummaryCurveDefinition( m_summaryCase(), m_summaryAddress->address() );
}
//--------------------------------------------------------------------------------------------------
@ -107,3 +107,11 @@ RifEclipseSummaryAddress RimAnalysisPlotDataEntry::summaryAddress() const
{
return m_summaryAddress->address();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimAnalysisPlotDataEntry::isEnsembleCurve() const
{
return m_isEnsembleCurve;
}

View File

@ -21,6 +21,7 @@
#include "RiaSummaryCurveDefinition.h"
#include "RifEclipseSummaryAddress.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
@ -42,9 +43,11 @@ public:
RimSummaryCase* summaryCase() const;
RimSummaryCaseCollection* ensemble() const;
RifEclipseSummaryAddress summaryAddress() const;
bool isEnsembleCurve() const;
private:
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble;
caf::PdmChildField<RimSummaryAddress*> m_summaryAddress;
caf::PdmField<bool> m_isEnsembleCurve;
};

View File

@ -76,6 +76,7 @@ RimAbstractCorrelationPlot::~RimAbstractCorrelationPlot()
//--------------------------------------------------------------------------------------------------
void RimAbstractCorrelationPlot::setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions )
{
disconnectAllCaseSignals();
m_analysisPlotDataSelection.deleteAllChildObjects();
for ( auto curveDef : curveDefinitions )
{
@ -83,6 +84,8 @@ void RimAbstractCorrelationPlot::setCurveDefinitions( const std::vector<RiaSumma
dataEntry->setFromCurveDefinition( curveDef );
m_analysisPlotDataSelection.push_back( dataEntry );
}
connectAllCaseSignals();
auto timeSteps = allAvailableTimeSteps();
if ( m_timeStep().isNull() && !timeSteps.empty() )
{
@ -124,6 +127,7 @@ void RimAbstractCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch
if ( !curveSelection.empty() )
{
std::vector<RiaSummaryCurveDefinition> summaryVectorDefinitions = dlg.curveSelection();
disconnectAllCaseSignals();
m_analysisPlotDataSelection.deleteAllChildObjects();
for ( const RiaSummaryCurveDefinition& vectorDef : summaryVectorDefinitions )
{
@ -131,6 +135,7 @@ void RimAbstractCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch
plotEntry->setFromCurveDefinition( vectorDef );
m_analysisPlotDataSelection.push_back( plotEntry );
}
connectAllCaseSignals();
this->loadDataAndUpdate();
this->updateConnectedEditors();
}
@ -577,3 +582,48 @@ QString RimAbstractCorrelationPlot::selectedVarsText()
return vectorNames;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAbstractCorrelationPlot::initAfterRead()
{
connectAllCaseSignals();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAbstractCorrelationPlot::onCaseRemoved( const SignalEmitter* emitter, RimSummaryCase* summaryCase )
{
loadDataAndUpdate();
if ( m_plotWidget ) m_plotWidget->scheduleReplot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAbstractCorrelationPlot::connectAllCaseSignals()
{
for ( auto dataEntry : m_analysisPlotDataSelection )
{
if ( dataEntry->ensemble() )
{
dataEntry->ensemble()->caseRemoved.connect( this, &RimAbstractCorrelationPlot::onCaseRemoved );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAbstractCorrelationPlot::disconnectAllCaseSignals()
{
for ( auto dataEntry : m_analysisPlotDataSelection )
{
if ( dataEntry->ensemble() )
{
dataEntry->ensemble()->caseRemoved.disconnect( this );
}
}
}

View File

@ -115,6 +115,13 @@ protected:
QString selectedVarsText();
void initAfterRead() final;
private:
void onCaseRemoved( const SignalEmitter* emitter, RimSummaryCase* summaryCase );
void connectAllCaseSignals();
void disconnectAllCaseSignals();
protected:
std::unique_ptr<RiaSummaryCurveDefinitionAnalyser> m_analyserOfSelectedCurveDefs;
QPointer<RiuQwtPlotWidget> m_plotWidget;

View File

@ -228,7 +228,7 @@ void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToPlot( RimAb
auto it = std::find( quantityNames.begin(), quantityNames.end(), QString::fromStdString( address.uiText() ) );
if ( it != quantityNames.end() || quantityNames.empty() )
{
curveDefs.push_back( RiaSummaryCurveDefinition( nullptr, address, ensembles.front() ) );
curveDefs.push_back( RiaSummaryCurveDefinition( nullptr, address, ensembles.front(), true ) );
}
}
plot->setCurveDefinitions( curveDefs );
@ -258,7 +258,7 @@ void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAbstr
auto it = std::find( quantityNames.begin(), quantityNames.end(), QString::fromStdString( address.uiText() ) );
if ( it != quantityNames.end() || quantityNames.empty() )
{
curveDefs.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble ) );
curveDefs.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble, true ) );
}
}
plot->setCurveDefinitions( curveDefs );
@ -287,13 +287,14 @@ void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToReport( Rim
QString::fromStdString( address.uiText() ) );
if ( it != matrixQuantityNames.end() || matrixQuantityNames.empty() )
{
curveDefsMatrix.push_back( RiaSummaryCurveDefinition( nullptr, address, ensembles.front() ) );
curveDefsMatrix.push_back( RiaSummaryCurveDefinition( nullptr, address, ensembles.front(), true ) );
}
if ( tornadoAndCrossPlotQuantityName.isEmpty() ||
tornadoAndCrossPlotQuantityName == QString::fromStdString( address.uiText() ) )
{
curveDefsTornadoAndCrossPlot.push_back( RiaSummaryCurveDefinition( nullptr, address, ensembles.front() ) );
curveDefsTornadoAndCrossPlot.push_back(
RiaSummaryCurveDefinition( nullptr, address, ensembles.front(), true ) );
}
}
@ -325,13 +326,13 @@ void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToReport( RimCor
QString::fromStdString( address.uiText() ) );
if ( it != matrixQuantityNames.end() || matrixQuantityNames.empty() )
{
curveDefsMatrix.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble ) );
curveDefsMatrix.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble, true ) );
}
if ( tornadoAndCrossPlotQuantityName.isEmpty() ||
tornadoAndCrossPlotQuantityName == QString::fromStdString( address.uiText() ) )
{
curveDefsTornadoAndCrossPlot.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble ) );
curveDefsTornadoAndCrossPlot.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble, true ) );
}
}
plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix );

View File

@ -144,7 +144,7 @@ std::set<RifEclipseSummaryAddress> RimDerivedEnsembleCaseCollection::ensembleSum
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDerivedEnsembleCaseCollection::updateDerivedEnsembleCases()
void RimDerivedEnsembleCaseCollection::createDerivedEnsembleCases()
{
if ( !m_ensemble1 || !m_ensemble2 ) return;
@ -194,7 +194,7 @@ void RimDerivedEnsembleCaseCollection::updateDerivedEnsembleCases()
// If other derived ensembles are referring to this ensemble, update their cases as well
for ( auto referring : findReferringEnsembles() )
{
referring->updateDerivedEnsembleCases();
referring->createDerivedEnsembleCases();
}
deleteCasesNoInUse();
@ -343,7 +343,7 @@ void RimDerivedEnsembleCaseCollection::fieldChangedByUi( const caf::PdmFieldHand
if ( doUpdateCases )
{
updateDerivedEnsembleCases();
createDerivedEnsembleCases();
updateConnectedEditors();
if ( doShowDialog && m_ensemble1 != nullptr && m_ensemble2 != nullptr && allSummaryCases().empty() )
@ -521,6 +521,27 @@ void RimDerivedEnsembleCaseCollection::updateAutoName()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDerivedEnsembleCaseCollection::updateDerivedEnsembleCases()
{
for ( auto& derivedCase : allDerivedCases( true ) )
{
derivedCase->createSummaryReaderInterface();
auto crp = derivedCase->summaryCase1()->caseRealizationParameters();
if ( !crp ) continue;
derivedCase->setCaseRealizationParameters( crp );
}
// If other derived ensembles are referring to this ensemble, update their cases as well
for ( auto referring : findReferringEnsembles() )
{
referring->updateDerivedEnsembleCases();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -62,8 +62,10 @@ public:
std::vector<RimSummaryCase*> allSummaryCases() const override;
std::set<RifEclipseSummaryAddress> ensembleSummaryAddresses() const override;
void createDerivedEnsembleCases();
void updateDerivedEnsembleCases();
bool hasCaseReference( const RimSummaryCase* sumCase ) const;
bool hasCaseReference( const RimSummaryCase* sumCase ) const;
void onLoadDataAndUpdate() override;

View File

@ -71,10 +71,9 @@ RimDerivedSummaryCase::RimDerivedSummaryCase()
CAF_PDM_InitFieldNoDefault( &m_useFixedTimeStep, "UseFixedTimeStep", "Use Fixed Time Step", "", "", "" );
CAF_PDM_InitField( &m_fixedTimeStepIndex, "FixedTimeStepIndex", 0, "Time Step", "", "", "" );
CAF_PDM_InitField( &m_inUse, "InUse", false, "In Use", "", "", "" );
m_fixedTimeStepIndex.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
m_fixedTimeStepIndex.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
m_inUse = false;
}
//--------------------------------------------------------------------------------------------------
@ -427,6 +426,22 @@ void RimDerivedSummaryCase::updateDisplayNameFromCases()
m_displayName = name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCase* RimDerivedSummaryCase::summaryCase1() const
{
return m_summaryCase1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCase* RimDerivedSummaryCase::summaryCase2() const
{
return m_summaryCase2;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -83,6 +83,9 @@ public:
void updateDisplayNameFromCases();
RimSummaryCase* summaryCase1() const;
RimSummaryCase* summaryCase2() const;
protected:
QString caseName() const override;
@ -107,7 +110,7 @@ private:
caf::PdmField<caf::AppEnum<FixedTimeStepMode>> m_useFixedTimeStep;
caf::PdmField<int> m_fixedTimeStepIndex;
bool m_inUse;
caf::PdmField<bool> m_inUse;
std::unique_ptr<RifDerivedEnsembleReader> m_reader;
std::map<RifEclipseSummaryAddress, std::pair<std::vector<time_t>, std::vector<double>>> m_dataCache;

View File

@ -24,6 +24,7 @@
#include "RicfCommandObject.h"
#include "RimAnalysisPlotDataEntry.h"
#include "RimDerivedEnsembleCaseCollection.h"
#include "RimEnsembleCurveSet.h"
#include "RimGridSummaryCase.h"
@ -187,6 +188,7 @@ QString EnsembleParameter::uiName() const
//--------------------------------------------------------------------------------------------------
RimSummaryCaseCollection::RimSummaryCaseCollection()
: caseNameChanged( this )
, caseRemoved( this )
{
CAF_PDM_InitScriptableObject( "Summary Case Group", ":/SummaryGroup16x16.png", "", "" );
@ -233,6 +235,8 @@ void RimSummaryCaseCollection::removeCase( RimSummaryCase* summaryCase )
m_cachedSortedEnsembleParameters.clear();
caseRemoved.send( summaryCase );
updateReferringCurveSets();
if ( m_isEnsemble && m_cases.size() != caseCountBeforeRemove )
@ -245,7 +249,7 @@ void RimSummaryCaseCollection::removeCase( RimSummaryCase* summaryCase )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCaseCollection::addCase( RimSummaryCase* summaryCase, bool updateCurveSets )
void RimSummaryCaseCollection::addCase( RimSummaryCase* summaryCase )
{
summaryCase->nameChanged.connect( this, &RimSummaryCaseCollection::onCaseNameChanged );
@ -255,12 +259,12 @@ void RimSummaryCaseCollection::addCase( RimSummaryCase* summaryCase, bool update
// Update derived ensemble cases (if any)
std::vector<RimDerivedEnsembleCaseCollection*> referringObjects;
objectsWithReferringPtrFieldsOfType( referringObjects );
for ( auto derEnsemble : referringObjects )
for ( auto derivedEnsemble : referringObjects )
{
if ( !derEnsemble ) continue;
if ( !derivedEnsemble ) continue;
derEnsemble->updateDerivedEnsembleCases();
if ( updateCurveSets ) derEnsemble->updateReferringCurveSets();
derivedEnsemble->createDerivedEnsembleCases();
derivedEnsemble->updateReferringCurveSets();
}
if ( m_isEnsemble )
@ -269,7 +273,7 @@ void RimSummaryCaseCollection::addCase( RimSummaryCase* summaryCase, bool update
calculateEnsembleParametersIntersectionHash();
}
if ( updateCurveSets ) updateReferringCurveSets();
updateReferringCurveSets();
}
//--------------------------------------------------------------------------------------------------
@ -924,13 +928,18 @@ void RimSummaryCaseCollection::onLoadDataAndUpdate()
void RimSummaryCaseCollection::updateReferringCurveSets()
{
// Update curve set referring to this group
std::vector<RimEnsembleCurveSet*> referringObjects;
std::vector<caf::PdmObject*> referringObjects;
objectsWithReferringPtrFieldsOfType( referringObjects );
for ( auto curveSet : referringObjects )
for ( auto object : referringObjects )
{
RimEnsembleCurveSet* curveSet = dynamic_cast<RimEnsembleCurveSet*>( object );
bool updateParentPlot = true;
if ( curveSet ) curveSet->loadDataAndUpdate( updateParentPlot );
if ( curveSet )
{
curveSet->loadDataAndUpdate( updateParentPlot );
}
}
}

View File

@ -92,14 +92,15 @@ class RimSummaryCaseCollection : public caf::PdmObject
CAF_PDM_HEADER_INIT;
public:
caf::Signal<> caseNameChanged;
caf::Signal<> caseNameChanged;
caf::Signal<RimSummaryCase*> caseRemoved;
public:
RimSummaryCaseCollection();
~RimSummaryCaseCollection() override;
void removeCase( RimSummaryCase* summaryCase );
void addCase( RimSummaryCase* summaryCase, bool updateCurveSets = true );
void addCase( RimSummaryCase* summaryCase );
virtual std::vector<RimSummaryCase*> allSummaryCases() const;
void setName( const QString& name );
QString name() const;

View File

@ -251,7 +251,7 @@ void RimSummaryCaseMainCollection::removeCase( RimSummaryCase* summaryCase )
// Update derived ensemble cases (if any)
for ( auto derEnsemble : derivedEnsembles )
{
derEnsemble->updateDerivedEnsembleCases();
derEnsemble->createDerivedEnsembleCases();
}
}

View File

@ -263,7 +263,7 @@ void RimSummaryPlotFilterTextCurveSetEditor::fieldChangedByUi( const caf::PdmFie
for ( const auto& filteredAddress : filteredAddressesFromSource )
{
curveDefinitions.insert( RiaSummaryCurveDefinition( sumCase, filteredAddress, ensemble ) );
curveDefinitions.insert( RiaSummaryCurveDefinition( sumCase, filteredAddress, ensemble, true ) );
}
}

View File

@ -96,7 +96,7 @@ void RiuSummaryVectorSelectionDialog::setEnsembleAndAddress( RimSummaryCaseColle
if ( ensemble )
{
std::vector<RiaSummaryCurveDefinition> curveDefs;
curveDefs.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble ) );
curveDefs.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble, true ) );
setCurveSelection( curveDefs );
}
}

View File

@ -444,7 +444,8 @@ std::vector<RiaSummaryCurveDefinition> RiuSummaryVectorSelectionUi::allCurveDefi
{
if ( selectedAddressesFromUi.count( addressFromSource ) > 0 )
{
curveDefinitions.insert( RiaSummaryCurveDefinition( caseFromSource, addressFromSource, ensemble ) );
curveDefinitions.insert(
RiaSummaryCurveDefinition( caseFromSource, addressFromSource, ensemble, false ) );
}
}
}
@ -511,7 +512,7 @@ std::vector<RiaSummaryCurveDefinition> RiuSummaryVectorSelectionUi::selection()
{
if ( addressUnion.count( addr ) )
{
curveDefSelection.push_back( RiaSummaryCurveDefinition( nullptr, addr, ensemble ) );
curveDefSelection.push_back( RiaSummaryCurveDefinition( nullptr, addr, ensemble, true ) );
}
}
}
@ -524,7 +525,7 @@ std::vector<RiaSummaryCurveDefinition> RiuSummaryVectorSelectionUi::selection()
{
if ( readerAddresses.count( addr ) )
{
curveDefSelection.push_back( RiaSummaryCurveDefinition( sourceCase, addr, nullptr ) );
curveDefSelection.push_back( RiaSummaryCurveDefinition( sourceCase, addr ) );
}
}
}
@ -594,7 +595,7 @@ void RiuSummaryVectorSelectionUi::setDefaultSelection( const std::vector<Summary
RimSummaryCase* sumCase = dynamic_cast<RimSummaryCase*>( s );
RimSummaryCaseCollection* ensemble = dynamic_cast<RimSummaryCaseCollection*>( s );
RiaSummaryCurveDefinition curveDef( sumCase, defaultAddress, ensemble );
RiaSummaryCurveDefinition curveDef( sumCase, defaultAddress, ensemble, true );
curveDefs.push_back( curveDef );
}