From 40a5f8dc0234c77b93b0b5495264c7107da3967a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 9 Mar 2017 22:45:47 +0100 Subject: [PATCH] #1288 Added defaultFlowDiagSolution to RimEclipseResultCase --- .../RicShowWellAllocationPlotFeature.cpp | 4 ++-- .../ProjectDataModel/Flow/RimWellAllocationPlot.cpp | 3 +-- .../ProjectDataModel/RimEclipseResultCase.cpp | 13 +++++++++++++ .../ProjectDataModel/RimEclipseResultCase.h | 1 + .../ProjectDataModel/RimEclipseResultDefinition.cpp | 6 +++--- .../ProjectDataModel/RimEclipseResultDefinition.h | 3 ++- 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp index c3251307f2..f1df0067cc 100644 --- a/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp +++ b/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp @@ -48,8 +48,8 @@ bool RicShowWellAllocationPlotFeature::isCommandEnabled() activeView->firstAncestorOrThisOfType(eclCase); if (eclCase) { - std::vector flowSols = eclCase->flowDiagSolutions(); - if (flowSols.size() > 0) + RimFlowDiagSolution* defaultFlowDiagSolution = eclCase->defaultFlowDiagSolution(); + if (defaultFlowDiagSolution) { return true; } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 1665122262..ef5f723b07 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -138,8 +138,7 @@ void RimWellAllocationPlot::setFromSimulationWell(RimEclipseWell* simWell) m_flowDiagSolution = eclView->cellResult()->flowDiagSolution(); if ( !m_flowDiagSolution ) { - std::vector flowSolutions = m_case->flowDiagSolutions(); - if ( flowSolutions.size() ) m_flowDiagSolution = flowSolutions.front(); + m_flowDiagSolution = m_case->defaultFlowDiagSolution(); } loadDataAndUpdate(); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp index bd02e2696a..03b8a07a1e 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -354,6 +354,19 @@ void RimEclipseResultCase::updateFilePathsFromProjectPath(const QString& newProj } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimFlowDiagSolution* RimEclipseResultCase::defaultFlowDiagSolution() +{ + if (m_flowDiagSolutions.size() > 0) + { + return m_flowDiagSolutions[0]; + } + + return nullptr; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h index cf9f7caddb..35243183b2 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h @@ -52,6 +52,7 @@ public: virtual QString gridFileName() const { return caseFileName();} virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath); + RimFlowDiagSolution* defaultFlowDiagSolution(); std::vector flowDiagSolutions(); RigFlowDiagSolverInterface* flowDiagSolverInterface(); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 1003d15c82..9c97e305bf 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -278,10 +278,10 @@ void RimEclipseResultDefinition::assignFlowSolutionFromCase() this->firstAncestorOrThisOfType(eclCase); if (eclCase) { - std::vector flowSols = eclCase->flowDiagSolutions(); - if (flowSols.size() > 0) + RimFlowDiagSolution* defaultFlowDiagSolution = eclCase->defaultFlowDiagSolution(); + if (defaultFlowDiagSolution) { - this->setFlowSolution(flowSols[0]); + this->setFlowSolution(defaultFlowDiagSolution); } } } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h index 3ef2a148a4..e3b5267810 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h @@ -68,6 +68,8 @@ public: void setPorosityModel(RimDefines::PorosityModelType val); QString resultVariable() const { return m_resultVariable(); } virtual void setResultVariable(const QString& val); + + void setFlowSolution(RimFlowDiagSolution* flowSol); RimFlowDiagSolution* flowDiagSolution(); RigFlowDiagResultAddress flowDiagResAddress() const; @@ -125,7 +127,6 @@ protected: caf::PdmPointer m_eclipseCase; private: - void setFlowSolution(RimFlowDiagSolution* flowSol); void setSelectedTracers(const std::vector& selectedTracers); void assignFlowSolutionFromCase();