#1288 Added defaultFlowDiagSolution to RimEclipseResultCase

This commit is contained in:
Magne Sjaastad 2017-03-09 22:45:47 +01:00
parent 7e4906fced
commit 40a5f8dc02
6 changed files with 22 additions and 8 deletions

View File

@ -48,8 +48,8 @@ bool RicShowWellAllocationPlotFeature::isCommandEnabled()
activeView->firstAncestorOrThisOfType(eclCase); activeView->firstAncestorOrThisOfType(eclCase);
if (eclCase) if (eclCase)
{ {
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions(); RimFlowDiagSolution* defaultFlowDiagSolution = eclCase->defaultFlowDiagSolution();
if (flowSols.size() > 0) if (defaultFlowDiagSolution)
{ {
return true; return true;
} }

View File

@ -138,8 +138,7 @@ void RimWellAllocationPlot::setFromSimulationWell(RimEclipseWell* simWell)
m_flowDiagSolution = eclView->cellResult()->flowDiagSolution(); m_flowDiagSolution = eclView->cellResult()->flowDiagSolution();
if ( !m_flowDiagSolution ) if ( !m_flowDiagSolution )
{ {
std::vector<RimFlowDiagSolution*> flowSolutions = m_case->flowDiagSolutions(); m_flowDiagSolution = m_case->defaultFlowDiagSolution();
if ( flowSolutions.size() ) m_flowDiagSolution = flowSolutions.front();
} }
loadDataAndUpdate(); loadDataAndUpdate();

View File

@ -354,6 +354,19 @@ void RimEclipseResultCase::updateFilePathsFromProjectPath(const QString& newProj
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution* RimEclipseResultCase::defaultFlowDiagSolution()
{
if (m_flowDiagSolutions.size() > 0)
{
return m_flowDiagSolutions[0];
}
return nullptr;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -52,6 +52,7 @@ public:
virtual QString gridFileName() const { return caseFileName();} virtual QString gridFileName() const { return caseFileName();}
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath); virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
RimFlowDiagSolution* defaultFlowDiagSolution();
std::vector<RimFlowDiagSolution*> flowDiagSolutions(); std::vector<RimFlowDiagSolution*> flowDiagSolutions();
RigFlowDiagSolverInterface* flowDiagSolverInterface(); RigFlowDiagSolverInterface* flowDiagSolverInterface();

View File

@ -278,10 +278,10 @@ void RimEclipseResultDefinition::assignFlowSolutionFromCase()
this->firstAncestorOrThisOfType(eclCase); this->firstAncestorOrThisOfType(eclCase);
if (eclCase) if (eclCase)
{ {
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions(); RimFlowDiagSolution* defaultFlowDiagSolution = eclCase->defaultFlowDiagSolution();
if (flowSols.size() > 0) if (defaultFlowDiagSolution)
{ {
this->setFlowSolution(flowSols[0]); this->setFlowSolution(defaultFlowDiagSolution);
} }
} }
} }

View File

@ -68,6 +68,8 @@ public:
void setPorosityModel(RimDefines::PorosityModelType val); void setPorosityModel(RimDefines::PorosityModelType val);
QString resultVariable() const { return m_resultVariable(); } QString resultVariable() const { return m_resultVariable(); }
virtual void setResultVariable(const QString& val); virtual void setResultVariable(const QString& val);
void setFlowSolution(RimFlowDiagSolution* flowSol);
RimFlowDiagSolution* flowDiagSolution(); RimFlowDiagSolution* flowDiagSolution();
RigFlowDiagResultAddress flowDiagResAddress() const; RigFlowDiagResultAddress flowDiagResAddress() const;
@ -125,7 +127,6 @@ protected:
caf::PdmPointer<RimEclipseCase> m_eclipseCase; caf::PdmPointer<RimEclipseCase> m_eclipseCase;
private: private:
void setFlowSolution(RimFlowDiagSolution* flowSol);
void setSelectedTracers(const std::vector<QString>& selectedTracers); void setSelectedTracers(const std::vector<QString>& selectedTracers);
void assignFlowSolutionFromCase(); void assignFlowSolutionFromCase();