mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Assign calculation ID to existing addresses (#5304)
#5278 Assign calculation ID to existing addresses
This commit is contained in:
parent
4811cfb28f
commit
15dc0e974b
@ -71,7 +71,6 @@
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimSummaryCrossPlotCollection.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimTextAnnotationInView.h"
|
||||
#include "RimViewLinker.h"
|
||||
@ -499,6 +498,12 @@ bool RiaApplication::loadProject( const QString& projectFileName,
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
RimMainPlotCollection* mainPlotColl = m_project->mainPlotCollection();
|
||||
|
||||
mainPlotColl->ensureCalculationIdsAreAssigned();
|
||||
}
|
||||
|
||||
for ( RimOilField* oilField : m_project->oilFields )
|
||||
{
|
||||
if ( oilField == nullptr ) continue;
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimRftPlotCollection.h"
|
||||
#include "RimSaturationPressurePlotCollection.h"
|
||||
#include "RimSummaryAddress.h"
|
||||
#include "RimSummaryCrossPlotCollection.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimViewWindow.h"
|
||||
@ -307,3 +308,17 @@ void RimMainPlotCollection::ensureDefaultFlowPlotsAreCreated()
|
||||
{
|
||||
m_flowPlotCollection()->ensureDefaultFlowPlotsAreCreated();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMainPlotCollection::ensureCalculationIdsAreAssigned()
|
||||
{
|
||||
std::vector<RimSummaryAddress*> allAddresses;
|
||||
this->descendantsIncludingThisOfType( allAddresses );
|
||||
|
||||
for ( RimSummaryAddress* adr : allAddresses )
|
||||
{
|
||||
adr->ensureIdIsAssigned();
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ public:
|
||||
void updatePlotsWithCompletions();
|
||||
void deleteAllCachedData();
|
||||
void ensureDefaultFlowPlotsAreCreated();
|
||||
void ensureCalculationIdsAreAssigned();
|
||||
|
||||
private:
|
||||
// Overridden PDM methods
|
||||
|
@ -18,6 +18,12 @@
|
||||
|
||||
#include "RimSummaryAddress.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCalculation.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
@ -126,3 +132,24 @@ RifEclipseSummaryAddress RimSummaryAddress::address()
|
||||
m_isErrorResult,
|
||||
m_calculationId );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryAddress::ensureIdIsAssigned()
|
||||
{
|
||||
if ( m_category == RifEclipseSummaryAddress::SUMMARY_CALCULATED && m_calculationId == -1 )
|
||||
{
|
||||
RimSummaryCalculationCollection* calcColl = RiaApplication::instance()->project()->calculationCollection();
|
||||
|
||||
for ( const RimSummaryCalculation* c : calcColl->calculations() )
|
||||
{
|
||||
QString description = c->description();
|
||||
|
||||
if ( description == m_quantityName )
|
||||
{
|
||||
m_calculationId = c->id();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,12 +42,13 @@ class RimSummaryAddress : public caf::PdmObject
|
||||
|
||||
public:
|
||||
RimSummaryAddress();
|
||||
;
|
||||
~RimSummaryAddress() override;
|
||||
|
||||
void setAddress( const RifEclipseSummaryAddress& addr );
|
||||
RifEclipseSummaryAddress address();
|
||||
|
||||
void ensureIdIsAssigned();
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>> m_category;
|
||||
caf::PdmField<QString> m_quantityName;
|
||||
|
Loading…
Reference in New Issue
Block a user