mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-12 16:32:12 -05:00
#5131 : Calculated curves : Use find in RimSummaryCalculationCollection
This commit is contained in:
1 parent
532d5899de
commit
1628f01939
5 files changed
+38
-20
No files matched your search
@@ -102,8 +102,9 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked )
|
|||||||
if ( summaryAddressY.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED &&
|
if ( summaryAddressY.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED &&
|
||||||
ids.find( summaryAddressY.id() ) != ids.end() )
|
ids.find( summaryAddressY.id() ) != ids.end() )
|
||||||
{
|
{
|
||||||
RifCalculatedSummaryCurveReader reader( calcColl );
|
if ( calcColl )
|
||||||
RimSummaryCalculation* calculation = reader.findCalculationByName( summaryAddressY );
|
{
|
||||||
|
RimSummaryCalculation* calculation = calcColl->findCalculationById( summaryAddressY.id() );
|
||||||
QString description = calculation->description();
|
QString description = calculation->description();
|
||||||
|
|
||||||
RifEclipseSummaryAddress updatedAdr =
|
RifEclipseSummaryAddress updatedAdr =
|
||||||
@@ -112,6 +113,7 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked )
|
|||||||
summaryCurve->loadDataAndUpdate( true );
|
summaryCurve->loadDataAndUpdate( true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
summaryPlot->loadDataAndUpdate();
|
summaryPlot->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
@@ -127,8 +129,9 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked )
|
|||||||
if ( summaryAddressX.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED &&
|
if ( summaryAddressX.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED &&
|
||||||
ids.find( summaryAddressX.id() ) != ids.end() )
|
ids.find( summaryAddressX.id() ) != ids.end() )
|
||||||
{
|
{
|
||||||
RifCalculatedSummaryCurveReader reader( calcColl );
|
if ( calcColl )
|
||||||
RimSummaryCalculation* calculation = reader.findCalculationByName( summaryAddressX );
|
{
|
||||||
|
RimSummaryCalculation* calculation = calcColl->findCalculationById( summaryAddressX.id() );
|
||||||
QString description = calculation->description();
|
QString description = calculation->description();
|
||||||
|
|
||||||
RifEclipseSummaryAddress updatedAdr =
|
RifEclipseSummaryAddress updatedAdr =
|
||||||
@@ -136,13 +139,15 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked )
|
|||||||
summaryCurve->setSummaryAddressX( updatedAdr );
|
summaryCurve->setSummaryAddressX( updatedAdr );
|
||||||
summaryCurve->loadDataAndUpdate( true );
|
summaryCurve->loadDataAndUpdate( true );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RifEclipseSummaryAddress summaryAddressY = summaryCurve->summaryAddressY();
|
RifEclipseSummaryAddress summaryAddressY = summaryCurve->summaryAddressY();
|
||||||
if ( summaryAddressY.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED &&
|
if ( summaryAddressY.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED &&
|
||||||
ids.find( summaryAddressY.id() ) != ids.end() )
|
ids.find( summaryAddressY.id() ) != ids.end() )
|
||||||
{
|
{
|
||||||
RifCalculatedSummaryCurveReader reader( calcColl );
|
if ( calcColl )
|
||||||
RimSummaryCalculation* calculation = reader.findCalculationByName( summaryAddressY );
|
{
|
||||||
|
RimSummaryCalculation* calculation = calcColl->findCalculationById( summaryAddressX.id() );
|
||||||
QString description = calculation->description();
|
QString description = calculation->description();
|
||||||
|
|
||||||
RifEclipseSummaryAddress updatedAdr =
|
RifEclipseSummaryAddress updatedAdr =
|
||||||
@@ -151,6 +156,7 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked )
|
|||||||
summaryCurve->loadDataAndUpdate( true );
|
summaryCurve->loadDataAndUpdate( true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
summaryPlot->loadDataAndUpdate();
|
summaryPlot->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-4
@@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#include "RifEclipseSummaryAddress.h"
|
#include "RifEclipseSummaryAddress.h"
|
||||||
|
|
||||||
#include "RimCalculatedSummaryCurveReader.h"
|
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimSummaryCalculation.h"
|
#include "RimSummaryCalculation.h"
|
||||||
#include "RimSummaryCalculationCollection.h"
|
#include "RimSummaryCalculationCollection.h"
|
||||||
@@ -65,9 +64,12 @@ void RicEditSummaryCurveCalculationFeature::onActionTriggered( bool isChecked )
|
|||||||
RifEclipseSummaryAddress selectedAddress = selectedCurves.front()->summaryAddressY();
|
RifEclipseSummaryAddress selectedAddress = selectedCurves.front()->summaryAddressY();
|
||||||
|
|
||||||
RimProject* proj = RiaApplication::instance()->project();
|
RimProject* proj = RiaApplication::instance()->project();
|
||||||
RifCalculatedSummaryCurveReader* reader = dynamic_cast<RifCalculatedSummaryCurveReader*>(
|
RimSummaryCalculationCollection* calculationColl = proj->calculationCollection();
|
||||||
proj->calculationCollection->calculationSummaryCase()->summaryReader() );
|
|
||||||
calculation = reader != nullptr ? reader->findCalculationByName( selectedAddress ) : nullptr;
|
if ( calculationColl )
|
||||||
|
{
|
||||||
|
calculation = calculationColl->findCalculationById( selectedAddress.id() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RicSummaryCurveCalculatorDialog* dialog = RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog();
|
RicSummaryCurveCalculatorDialog* dialog = RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog();
|
||||||
|
|||||||
@@ -98,14 +98,7 @@ RimSummaryCalculation*
|
|||||||
{
|
{
|
||||||
if ( m_calculationCollection && resultAddress.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED )
|
if ( m_calculationCollection && resultAddress.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED )
|
||||||
{
|
{
|
||||||
int id = resultAddress.id();
|
return m_calculationCollection->findCalculationById( resultAddress.id() );
|
||||||
for ( RimSummaryCalculation* calc : m_calculationCollection->calculations() )
|
|
||||||
{
|
|
||||||
if ( calc->id() == id )
|
|
||||||
{
|
|
||||||
return calc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@@ -41,10 +41,11 @@ public:
|
|||||||
|
|
||||||
void buildMetaData();
|
void buildMetaData();
|
||||||
|
|
||||||
RimSummaryCalculation* findCalculationByName( const RifEclipseSummaryAddress& resultAddress ) const;
|
|
||||||
|
|
||||||
RiaEclipseUnitTools::UnitSystem unitSystem() const override;
|
RiaEclipseUnitTools::UnitSystem unitSystem() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
RimSummaryCalculation* findCalculationByName( const RifEclipseSummaryAddress& resultAddress ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmPointer<RimSummaryCalculationCollection> m_calculationCollection;
|
caf::PdmPointer<RimSummaryCalculationCollection> m_calculationCollection;
|
||||||
};
|
};
|
||||||
@@ -18,11 +18,15 @@
|
|||||||
|
|
||||||
#include "RimSummaryCurveAutoName.h"
|
#include "RimSummaryCurveAutoName.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
#include "RiaStatisticsTools.h"
|
#include "RiaStatisticsTools.h"
|
||||||
|
|
||||||
#include "RifEclipseSummaryAddress.h"
|
#include "RifEclipseSummaryAddress.h"
|
||||||
|
|
||||||
#include "RimEnsembleCurveSet.h"
|
#include "RimEnsembleCurveSet.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimSummaryCalculation.h"
|
||||||
|
#include "RimSummaryCalculationCollection.h"
|
||||||
#include "RimSummaryCase.h"
|
#include "RimSummaryCase.h"
|
||||||
#include "RimSummaryCaseCollection.h"
|
#include "RimSummaryCaseCollection.h"
|
||||||
#include "RimSummaryCurve.h"
|
#include "RimSummaryCurve.h"
|
||||||
@@ -197,6 +201,18 @@ QString RimSummaryCurveAutoName::buildCurveName( const RifEclipseSummaryAddress&
|
|||||||
QString::fromStdString( summaryAddress.quantityName() ) )
|
QString::fromStdString( summaryAddress.quantityName() ) )
|
||||||
.toStdString();
|
.toStdString();
|
||||||
}
|
}
|
||||||
|
else if ( summaryAddress.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED )
|
||||||
|
{
|
||||||
|
// Need to add case name for calculated summary
|
||||||
|
RimProject* proj = RiaApplication::instance()->project();
|
||||||
|
RimSummaryCalculationCollection* calcColl = proj->calculationCollection();
|
||||||
|
|
||||||
|
RimSummaryCalculation* calculation = calcColl->findCalculationById( summaryAddress.id() );
|
||||||
|
if ( calculation )
|
||||||
|
{
|
||||||
|
text = calculation->description().toStdString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( m_unit && !unitText.empty() )
|
if ( m_unit && !unitText.empty() )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user