#1976 RFT/PLT Plot. Associate well path and sim well when loading models and files

This commit is contained in:
Bjørn Erik Jensen
2017-10-11 15:23:14 +02:00
parent dcb1c40414
commit 6c51938000
3 changed files with 34 additions and 11 deletions

View File

@@ -49,6 +49,9 @@
#include "RimWellAllocationPlot.h" #include "RimWellAllocationPlot.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h" #include "RimWellLogPlotCollection.h"
#include "RimOilField.h"
#include "RimWellPathCollection.h"
#include "RimWellPath.h"
#include "cafPdmDocument.h" #include "cafPdmDocument.h"
#include "cafProgressInfo.h" #include "cafProgressInfo.h"
@@ -616,6 +619,18 @@ bool RimEclipseCase::openReserviorCase()
createTimeStepFormatString(); createTimeStepFormatString();
// Associate existing well paths with simulation wells
RimProject* proj = RiaApplication::instance()->project();
for (const auto& oilField : proj->oilFields())
{
for (const auto& wellPath : oilField->wellPathCollection()->wellPaths())
{
if (!wellPath->isAssociatedWithSimulationWell())
{
wellPath->tryAssociateWithSimulationWell();
}
}
}
return true; return true;
} }

View File

@@ -40,6 +40,8 @@
#include "RivWellPathPartMgr.h" #include "RivWellPathPartMgr.h"
#include "RiaApplication.h"
#include "cafPdmUiTreeOrdering.h" #include "cafPdmUiTreeOrdering.h"
#include "cafUtils.h" #include "cafUtils.h"
@@ -47,7 +49,6 @@
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
#include <QMessageBox> #include <QMessageBox>
#include "RiaApplication.h"
CAF_PDM_SOURCE_INIT(RimWellPath, "WellPath"); CAF_PDM_SOURCE_INIT(RimWellPath, "WellPath");
@@ -345,6 +346,7 @@ void RimWellPath::setName(const QString& name)
{ {
m_name = name; m_name = name;
m_completions->setWellNameForExport(name); m_completions->setWellNameForExport(name);
tryAssociateWithSimulationWell();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -408,11 +410,7 @@ void RimWellPath::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiO
if (m_simWellName().isEmpty()) if (m_simWellName().isEmpty())
{ {
// Try to set default simulation well name // Try to set default simulation well name
auto simWellName = tryFindSimulationWellFromWellPathName(m_name); tryAssociateWithSimulationWell();
if (!simWellName.isEmpty())
{
m_simWellName = simWellName;
}
} }
caf::PdmUiGroup* appGroup = uiOrdering.addNewGroup("Appearance"); caf::PdmUiGroup* appGroup = uiOrdering.addNewGroup("Appearance");
@@ -641,15 +639,24 @@ int RimWellPath::relatedSimulationWellBranch() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const QString RimWellPath::tryFindSimulationWellFromWellPathName(const QString& wellPathName) bool RimWellPath::tryAssociateWithSimulationWell()
{ {
RimProject* proj = RiaApplication::instance()->project(); RimProject* proj = RiaApplication::instance()->project();
for (const auto& simWellName : proj->simulationWellNames()) for (const auto& simWellName : proj->simulationWellNames())
{ {
if (QString::compare(simWellName, wellPathName) == 0) if (QString::compare(simWellName, m_name) == 0)
{ {
return simWellName; m_simWellName = simWellName;
return true;
} }
} }
return ""; return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellPath::isAssociatedWithSimulationWell() const
{
return !m_simWellName().isEmpty() && QString::compare(m_simWellName, SIM_WELL_NONE_NAME) != 0;
} }

View File

@@ -116,7 +116,8 @@ public:
const QString relatedSimulationWell() const; const QString relatedSimulationWell() const;
int relatedSimulationWellBranch() const; int relatedSimulationWellBranch() const;
static const QString tryFindSimulationWellFromWellPathName(const QString& wellPathName); bool tryAssociateWithSimulationWell();
bool isAssociatedWithSimulationWell() const;
private: private: