#1976 RFT/PLT Plot. Prevent multiple well paths from associate to the same sim well

This commit is contained in:
Bjørn Erik Jensen
2017-10-25 09:55:00 +02:00
parent 85e2a5d3f3
commit b62d4448d9
4 changed files with 37 additions and 6 deletions

View File

@@ -909,8 +909,8 @@ RimWellPath* RimProject::wellPathFromSimulationWell(const QString& simWellName,
auto wellPathColl = oilField->wellPathCollection(); auto wellPathColl = oilField->wellPathCollection();
for (const auto& path : wellPathColl->wellPaths) for (const auto& path : wellPathColl->wellPaths)
{ {
if (QString::compare(path->relatedSimulationWell(), simWellName) == 0 && if (QString::compare(path->associatedSimulationWell(), simWellName) == 0 &&
(branchIndex < 0 || path->relatedSimulationWellBranch() == branchIndex)) (branchIndex < 0 || path->associatedSimulationWellBranch() == branchIndex))
{ {
return path; return path;
} }
@@ -919,6 +919,23 @@ RimWellPath* RimProject::wellPathFromSimulationWell(const QString& simWellName,
return nullptr; return nullptr;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPath*> RimProject::allWellPaths() const
{
std::vector<RimWellPath*> paths;
for (const auto& oilField : oilFields())
{
auto wellPathColl = oilField->wellPathCollection();
for (const auto& path : wellPathColl->wellPaths)
{
paths.push_back(path);
}
}
return paths;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -127,6 +127,7 @@ public:
std::vector<QString> simulationWellNames() const; std::vector<QString> simulationWellNames() const;
std::vector<const RigWellPath*> simulationWellBranches(const QString& simWellName); std::vector<const RigWellPath*> simulationWellBranches(const QString& simWellName);
RimWellPath* wellPathFromSimulationWell(const QString& simWellName, int branchIndex = -1); RimWellPath* wellPathFromSimulationWell(const QString& simWellName, int branchIndex = -1);
std::vector<RimWellPath*> allWellPaths() const;
std::vector<RimGeoMechCase*> geoMechCases() const; std::vector<RimGeoMechCase*> geoMechCases() const;

View File

@@ -316,9 +316,22 @@ QList<caf::PdmOptionItemInfo> RimWellPath::calculateValueOptions(const caf::PdmF
if (fieldNeedingOptions == &m_simWellName) if (fieldNeedingOptions == &m_simWellName)
{ {
RimProject* proj = RiaApplication::instance()->project(); RimProject* proj = RiaApplication::instance()->project();
// Find simulation wells already assigned to a well path
std::set<QString> associatedSimWells;
for (const auto& wellPath : proj->allWellPaths())
{
if (wellPath->isAssociatedWithSimulationWell() && wellPath != this)
{
associatedSimWells.insert(wellPath->associatedSimulationWell());
}
}
options.push_back(caf::PdmOptionItemInfo(SIM_WELL_NONE_UI_TEXT, "")); options.push_back(caf::PdmOptionItemInfo(SIM_WELL_NONE_UI_TEXT, ""));
for (const auto& wellName : proj->simulationWellNames()) for (const auto& wellName : proj->simulationWellNames())
{ {
if (associatedSimWells.count(wellName) > 0) continue;
options.push_back(caf::PdmOptionItemInfo(wellName, wellName)); options.push_back(caf::PdmOptionItemInfo(wellName, wellName));
} }
} }
@@ -655,7 +668,7 @@ RimWellPath* RimWellPath::fromFilePath(QString filePath)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const QString RimWellPath::relatedSimulationWell() const const QString RimWellPath::associatedSimulationWell() const
{ {
return m_simWellName; return m_simWellName;
} }
@@ -663,7 +676,7 @@ const QString RimWellPath::relatedSimulationWell() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
int RimWellPath::relatedSimulationWellBranch() const int RimWellPath::associatedSimulationWellBranch() const
{ {
return m_branchIndex; return m_branchIndex;
} }

View File

@@ -115,8 +115,8 @@ public:
RiaEclipseUnitTools::UnitSystem unitSystem() const; RiaEclipseUnitTools::UnitSystem unitSystem() const;
static RimWellPath* fromFilePath(QString filePath); static RimWellPath* fromFilePath(QString filePath);
const QString relatedSimulationWell() const; const QString associatedSimulationWell() const;
int relatedSimulationWellBranch() const; int associatedSimulationWellBranch() const;
bool tryAssociateWithSimulationWell(); bool tryAssociateWithSimulationWell();
bool isAssociatedWithSimulationWell() const; bool isAssociatedWithSimulationWell() const;
bool tryMatchName(QString wellPathName, const std::vector<QString>& simWellNames); bool tryMatchName(QString wellPathName, const std::vector<QString>& simWellNames);