From dcb1c40414c3d144a13195b58b3bf9004640588e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Wed, 11 Oct 2017 13:52:29 +0200 Subject: [PATCH] #1976 RFT/PLT Plot. Associate sim well and well path. RFT branch index impl --- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 75 ++++++++------ .../ProjectDataModel/Flow/RimWellRftPlot.h | 7 +- .../ProjectDataModel/RimProject.cpp | 79 +++++++++++++++ ApplicationCode/ProjectDataModel/RimProject.h | 10 +- .../ProjectDataModel/RimWellPath.cpp | 98 ++++++++++++++++++- .../ProjectDataModel/RimWellPath.h | 14 ++- .../ReservoirDataModel/RigEclipseCaseData.cpp | 70 ++++++++++++- .../ReservoirDataModel/RigEclipseCaseData.h | 7 +- 8 files changed, 321 insertions(+), 39 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index 8eb6bafadc..cf7c56345a 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -65,6 +65,9 @@ #include "RiaColorTables.h" #include "RifReaderEclipseRft.h" #include "RimWellLogRftCurve.h" +#include "RigWellPath.h" +#include "RimWellLogPlotCollection.h" +#include "RimMainPlotCollection.h" #include CAF_PDM_SOURCE_INIT(RimWellRftPlot, "WellRftPlot"); @@ -93,7 +96,6 @@ RimWellRftPlot::RimWellRftPlot() CAF_PDM_InitFieldNoDefault(&m_wellName, "WellName", "WellName", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_branchIndex, "BranchIndex", "BranchIndex", "", "", ""); - m_branchIndex = 0; CAF_PDM_InitFieldNoDefault(&m_selectedSources, "Sources", "Sources", "", "", ""); m_selectedSources.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName()); @@ -351,7 +353,7 @@ std::vector RimWellRftPlot::getPressureChannelsFromWellP //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimEclipseResultCase* RimWellRftPlot::eclipseCaseFromCaseId(int caseId) +RimEclipseCase* RimWellRftPlot::eclipseCaseFromCaseId(int caseId) { const std::vector>& eclipseCases = eclipseCasesContainingPressure(m_wellName); auto itr = std::find_if(eclipseCases.begin(), eclipseCases.end(), @@ -461,7 +463,7 @@ std::vector RimWellRftPlot::timeStepsFromRftCase(RimEclipseResultCase //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimWellRftPlot::timeStepsFromGridCase(const RimEclipseResultCase* gridCase) const +std::vector RimWellRftPlot::timeStepsFromGridCase(const RimEclipseCase* gridCase) const { auto eclipseCaseData = gridCase->eclipseCaseData(); size_t resultIndex = eclipseCaseData->results(RiaDefines::MATRIX_MODEL)-> @@ -608,7 +610,7 @@ void RimWellRftPlot::updateCurvesInPlot(const std::setaddCurve(curve); auto rftCase = eclipseCaseFromCaseId(curveDefToAdd.first.caseId()); - curve->setEclipseResultCase(rftCase); + curve->setEclipseResultCase(dynamic_cast(rftCase)); RifEclipseRftAddress address(m_wellName, curveDefToAdd.second, RifEclipseRftAddress::PRESSURE); curve->setRftAddress(address); @@ -795,6 +797,22 @@ QList RimWellRftPlot::calculateValueOptions(const caf::P { calculateValueOptionsForTimeSteps(m_wellName, options); } + else if (fieldNeedingOptions == &m_branchIndex) + { + RimProject* proj = RiaApplication::instance()->project(); + + size_t branchCount = proj->simulationWellBranches(m_wellName).size(); + + for (int bIdx = 0; bIdx < static_cast(branchCount); ++bIdx) + { + options.push_back(caf::PdmOptionItemInfo("Branch " + QString::number(bIdx + 1), QVariant::fromValue(bIdx))); + } + + if (options.size() == 0) + { + options.push_front(caf::PdmOptionItemInfo("None", -1)); + } + } return options; } @@ -810,11 +828,9 @@ void RimWellRftPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c { setDescription(QString(plotNameFormatString()).arg(m_wellName)); } - else if (changedField == &m_selectedSources) - { - syncCurvesFromUiSelection(); - } - else if (changedField == &m_selectedTimeSteps) + else if (changedField == &m_selectedSources || + changedField == &m_selectedTimeSteps || + changedField == &m_branchIndex) { syncCurvesFromUiSelection(); } @@ -847,7 +863,12 @@ void RimWellRftPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& { uiOrdering.add(&m_userName); uiOrdering.add(&m_wellName); - uiOrdering.add(&m_branchIndex); + + RimProject* proj = RiaApplication::instance()->project(); + if (proj->simulationWellBranches(m_wellName).size() > 1) + { + uiOrdering.add(&m_branchIndex); + } caf::PdmUiGroup* sourcesGroup = uiOrdering.addNewGroupWithKeyword("Sources", "Sources"); sourcesGroup->add(&m_selectedSources); @@ -863,38 +884,28 @@ void RimWellRftPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& //-------------------------------------------------------------------------------------------------- void RimWellRftPlot::calculateValueOptionsForWells(QList& options) { - std::set wellNames; - auto project = RiaApplication::instance()->project(); + RimProject * proj = RiaApplication::instance()->project(); - for (RimOilField* oilField : project->oilFields) + if (proj != nullptr) { - // RFT/Grid wells - auto gridCaseColl = oilField->analysisModels(); - for (RimEclipseCase* gCase : gridCaseColl->cases()) + const auto simWellNames = proj->simulationWellNames(); + std::set wellNames = std::set(simWellNames.begin(), simWellNames.end()); + + // Observed wells + for (const auto& oilField : proj->oilFields()) { - auto gridCase = dynamic_cast(gCase); - if (gridCase != nullptr) + auto wellPathColl = oilField->wellPathCollection(); + for (const auto& wellPath : wellPathColl->wellPaths) { - auto eclipseCaseData = gridCase->eclipseCaseData(); - for (const auto& wellResult : eclipseCaseData->wellResults()) - { - wellNames.insert(wellResult->m_wellName); - } + wellNames.insert(wellPath->name()); } } - // Observed wells - auto wellPathColl = oilField->wellPathCollection(); - for (const auto& wellPath : wellPathColl->wellPaths) + for (const auto& wellName : wellNames) { - wellNames.insert(wellPath->name()); + options.push_back(caf::PdmOptionItemInfo(wellName, wellName)); } } - - for (const auto& wellName : wellNames) - { - options.push_back(caf::PdmOptionItemInfo(wellName, wellName)); - } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.h b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.h index 7084d20301..d8bb3d41d0 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.h +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.h @@ -24,6 +24,7 @@ #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmPtrField.h" +#include "cvfCollection.h" #include "RimWellRftAddress.h" #include "RimPlotCurve.h" #include @@ -31,6 +32,7 @@ #include class RimEclipseResultCase; +class RimEclipseCase; class RimEclipseWell; class RimFlowDiagSolution; class RimTotalWellAllocationPlot; @@ -42,6 +44,7 @@ class RigSingleWellResultsData; class RimWellLogFileChannel; class RimWellPath; class RimWellLogCurve; +class RigWellPath; namespace cvf { class Color3f; @@ -108,7 +111,7 @@ private: std::vector wellPathsContainingPressure(const QString& wellName) const; std::vector getPressureChannelsFromWellPath(const RimWellPath* wellPath) const; - RimEclipseResultCase* eclipseCaseFromCaseId(int caseId); + RimEclipseCase* eclipseCaseFromCaseId(int caseId); RimWellPath* wellPathForObservedData(const QString& wellName, const QDateTime& date) const; @@ -116,7 +119,7 @@ private: std::vector gridCasesFromEclipseCases(const std::vector>& eclipseCases) const; std::vector rftCasesFromEclipseCases(const std::vector>& eclipseCases) const; std::vector timeStepsFromRftCase(RimEclipseResultCase* gridCase) const; - std::vector timeStepsFromGridCase(const RimEclipseResultCase* gridCase) const; + std::vector timeStepsFromGridCase(const RimEclipseCase* gridCase) const; std::set> selectedCurveDefs() const; std::set> curveDefsFromCurves() const; diff --git a/ApplicationCode/ProjectDataModel/RimProject.cpp b/ApplicationCode/ProjectDataModel/RimProject.cpp index 3d45850efd..fdd24024a0 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationCode/ProjectDataModel/RimProject.cpp @@ -25,6 +25,9 @@ #include "RigEclipseCaseData.h" #include "RigGridBase.h" +#include "RigSimulationWellCenterLineCalculator.h" +#include "RigSimulationWellCoordsAndMD.h" +#include "RigWellPath.h" #include "RimCalcScript.h" #include "RimCase.h" @@ -59,6 +62,7 @@ #include "RimRftPlotCollection.h" #include "RimWellPathCollection.h" #include "RimWellPathImport.h" +#include "RimWellPath.h" #include "RiuMainWindow.h" #include "RiuMainPlotWindow.h" @@ -834,6 +838,81 @@ RimDialogData* RimProject::dialogData() const return m_dialogData; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimProject::eclipseCases() const +{ + std::vector allCases; + for (const auto& oilField : oilFields) + { + const auto& cases = oilField->analysisModels->cases; + allCases.insert(allCases.end(), cases.begin(), cases.end()); + } + return allCases; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimProject::simulationWellNames() const +{ + std::set wellNames; + + for (RimOilField* oilField : oilFields) + { + auto analysisCaseColl = oilField->analysisModels(); + for (RimEclipseCase* eclCase : analysisCaseColl->cases()) + { + const auto& eclData = eclCase->eclipseCaseData(); + if (eclData == nullptr) continue; + + const auto names = eclData->simulationWellNames(); + wellNames.insert(names.begin(), names.end()); + } + } + return std::vector(wellNames.begin(), wellNames.end()); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimProject::simulationWellBranches(const QString& simWellName) +{ + // Find first case containing the specified simulation well + auto simCases = eclipseCases(); + auto caseItr = std::find_if(simCases.begin(), simCases.end(), [&simWellName](const RimEclipseCase* eclCase) { + const auto& eclData = eclCase->eclipseCaseData(); + return eclData != nullptr && eclData->hasSimulationWell(simWellName); + }); + RimEclipseCase* eclipseCase = caseItr != simCases.end() ? *caseItr : nullptr; + RigEclipseCaseData* eclCaseData = eclipseCase != nullptr ? eclipseCase->eclipseCaseData() : nullptr; + return eclCaseData != nullptr ? + eclCaseData->simulationWellBranches(simWellName) : + std::vector(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimWellPath* RimProject::wellPathFromSimulationWell(const QString& simWellName, int branchIndex) +{ + std::vector paths; + for (const auto& oilField : oilFields()) + { + auto wellPathColl = oilField->wellPathCollection(); + for (const auto& path : wellPathColl->wellPaths) + { + if (QString::compare(path->relatedSimulationWell(), simWellName) == 0 && + (branchIndex < 0 || path->relatedSimulationWellBranch() == branchIndex)) + { + return path; + } + } + } + return nullptr; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimProject.h b/ApplicationCode/ProjectDataModel/RimProject.h index 282427a70d..9a2d812c5e 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.h +++ b/ApplicationCode/ProjectDataModel/RimProject.h @@ -25,12 +25,14 @@ #include "cafPdmChildArrayField.h" #include "cafPdmChildField.h" #include "cafPdmDocument.h" +#include "cvfCollection.h" #include class RigEclipseCaseData; class RigGridManager; class RigMainGrid; +class RigWellPath; class RimCase; class RimCommandObject; @@ -47,6 +49,7 @@ class RimView; class RimViewLinker; class RimViewLinkerCollection; class RimWellPathImport; +class RimWellPath; namespace caf { @@ -115,7 +118,12 @@ public: void reloadCompletionTypeResultsInAllViews(); void reloadCompletionTypeResultsForEclipseCase(RimEclipseCase* eclipseCase); - RimDialogData* dialogData() const; + RimDialogData* dialogData() const; + + std::vector eclipseCases() const; + std::vector simulationWellNames() const; + std::vector simulationWellBranches(const QString& simWellName); + RimWellPath* wellPathFromSimulationWell(const QString& simWellName, int branchIndex = -1); protected: // Overridden methods diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.cpp b/ApplicationCode/ProjectDataModel/RimWellPath.cpp index a7410a045a..4eacb50036 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPath.cpp @@ -47,9 +47,15 @@ #include #include #include +#include "RiaApplication.h" CAF_PDM_SOURCE_INIT(RimWellPath, "WellPath"); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const char RimWellPath::SIM_WELL_NONE_NAME[] = "None"; + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -100,6 +106,9 @@ RimWellPath::RimWellPath() CAF_PDM_InitField(&wellPathIndexInFile, "WellPathNumberInFile", -1, "Well Number in file", "", "", ""); wellPathIndexInFile.uiCapability()->setUiReadOnly(true); + CAF_PDM_InitField(&m_simWellName, "SimWellName", QString(""), "Well", "", "", ""); + CAF_PDM_InitField(&m_branchIndex, "SimBranchIndex", 0, "Branch", "", "", ""); + CAF_PDM_InitField(&showWellPathLabel, "ShowWellPathLabel", true, "Show well path label", "", "", ""); CAF_PDM_InitField(&showWellPath, "ShowWellPath", true, "Show well path", "", "", ""); @@ -285,6 +294,42 @@ void RimWellPath::fieldChangedByUi(const caf::PdmFieldHandle* changedField, cons } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimWellPath::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) +{ + QList options; + + if (fieldNeedingOptions == &m_simWellName) + { + RimProject* proj = RiaApplication::instance()->project(); + options.push_back(caf::PdmOptionItemInfo(SIM_WELL_NONE_NAME, SIM_WELL_NONE_NAME)); + for (const auto& wellName : proj->simulationWellNames()) + { + options.push_back(caf::PdmOptionItemInfo(wellName, wellName)); + } + } + else if (fieldNeedingOptions == &m_branchIndex) + { + RimProject* proj = RiaApplication::instance()->project(); + + size_t branchCount = proj->simulationWellBranches(m_simWellName).size(); + if (branchCount == 0) + branchCount = 1; + + int index = 0; + while(index < branchCount) + { + QString uiText = QString("Branch %1").arg(QString::number(index + 1)); + options.push_back(caf::PdmOptionItemInfo(uiText, QVariant::fromValue(index))); + index++; + } + } + + return options; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -360,6 +405,16 @@ void RimWellPath::setWellPathGeometry(RigWellPath* wellPathModel) //-------------------------------------------------------------------------------------------------- void RimWellPath::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) { + if (m_simWellName().isEmpty()) + { + // Try to set default simulation well name + auto simWellName = tryFindSimulationWellFromWellPathName(m_name); + if (!simWellName.isEmpty()) + { + m_simWellName = simWellName; + } + } + caf::PdmUiGroup* appGroup = uiOrdering.addNewGroup("Appearance"); appGroup->add(&showWellPathLabel); appGroup->add(&wellPathColor); @@ -369,6 +424,13 @@ void RimWellPath::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiO fileInfoGroup->add(&filepath); fileInfoGroup->add(&wellPathIndexInFile); + caf::PdmUiGroup* simWellGroup = uiOrdering.addNewGroup("Simulation Well"); + simWellGroup->add(&m_simWellName); + + RimProject* proj = RiaApplication::instance()->project(); + if(proj->simulationWellBranches(m_simWellName).size() > 1) + simWellGroup->add(&m_branchIndex); + caf::PdmUiGroup* ssihubGroup = uiOrdering.addNewGroup("Well Info"); ssihubGroup->add(&id); ssihubGroup->add(&sourceSystem); @@ -388,6 +450,8 @@ void RimWellPath::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiO { m_datumElevation.uiCapability()->setUiHidden(true); } + + uiOrdering.skipRemainingFields(true); } //-------------------------------------------------------------------------------------------------- @@ -556,4 +620,36 @@ RimWellPath* RimWellPath::fromFilePath(QString filePath) return wellPath; } return nullptr; -} \ No newline at end of file +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const QString RimWellPath::relatedSimulationWell() const +{ + return m_simWellName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimWellPath::relatedSimulationWellBranch() const +{ + return m_branchIndex; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const QString RimWellPath::tryFindSimulationWellFromWellPathName(const QString& wellPathName) +{ + RimProject* proj = RiaApplication::instance()->project(); + for (const auto& simWellName : proj->simulationWellNames()) + { + if (QString::compare(simWellName, wellPathName) == 0) + { + return simWellName; + } + } + return ""; +} diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.h b/ApplicationCode/ProjectDataModel/RimWellPath.h index 773b637c04..bf3b1213e2 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.h +++ b/ApplicationCode/ProjectDataModel/RimWellPath.h @@ -56,6 +56,9 @@ class RimWellPathFractureCollection; class RimWellPath : public caf::PdmObject { CAF_PDM_HEADER_INIT; + + static const char SIM_WELL_NONE_NAME[]; + public: RimWellPath(); @@ -67,7 +70,8 @@ public: virtual caf::PdmFieldHandle* objectToggleField(); virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ); - + virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; + QString name() const; void setName(const QString& name); @@ -76,6 +80,9 @@ public: caf::PdmField filepath; caf::PdmField wellPathIndexInFile; // -1 means none. + caf::PdmField m_simWellName; + caf::PdmField m_branchIndex; + caf::PdmField showWellPathLabel; caf::PdmField showWellPath; @@ -107,6 +114,10 @@ public: RiaEclipseUnitTools::UnitSystem unitSystem() const; static RimWellPath* fromFilePath(QString filePath); + const QString relatedSimulationWell() const; + int relatedSimulationWellBranch() const; + static const QString tryFindSimulationWellFromWellPathName(const QString& wellPathName); + private: void setWellPathGeometry(RigWellPath* wellPathModel); @@ -121,6 +132,7 @@ private: QString getCacheDirectoryPath(); virtual void setupBeforeSave(); + caf::PdmField id; caf::PdmField sourceSystem; caf::PdmField utmZone; diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp index 88009ea32d..a769030140 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp @@ -28,6 +28,9 @@ #include "RigSingleWellResultsData.h" #include +#include "RigSimulationWellCenterLineCalculator.h" +#include "RigSimulationWellCoordsAndMD.h" +#include "RigWellPath.h" //-------------------------------------------------------------------------------------------------- /// @@ -319,7 +322,9 @@ const RigCell& RigEclipseCaseData::cellFromWellResultCell(const RigWellResultPoi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RigEclipseCaseData::findSharedSourceFace(cvf::StructGridInterface::FaceType& sharedSourceFace,const RigWellResultPoint& sourceWellCellResult, const RigWellResultPoint& otherWellCellResult) const +bool RigEclipseCaseData::findSharedSourceFace(cvf::StructGridInterface::FaceType& sharedSourceFace, + const RigWellResultPoint& sourceWellCellResult, + const RigWellResultPoint& otherWellCellResult) const { size_t gridIndex = sourceWellCellResult.m_gridIndex; size_t gridCellIndex = sourceWellCellResult.m_gridCellIndex; @@ -432,6 +437,69 @@ void RigEclipseCaseData::computeActiveCellBoundingBoxes() computeActiveCellsGeometryBoundingBox(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigEclipseCaseData::simulationWellNames() const +{ + std::vector wellNames; + for (const auto& wellResult : wellResults()) + { + wellNames.push_back(wellResult->m_wellName); + } + return wellNames; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigEclipseCaseData::hasSimulationWell(const QString& simWellName) const +{ + const auto wellNames = simulationWellNames(); + return std::find(wellNames.begin(), wellNames.end(), simWellName) != wellNames.end(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigEclipseCaseData::simulationWellBranches(const QString& simWellName) +{ + std::vector branches; + + if (!(!simWellName.isEmpty() && simWellName != "None")) + { + return std::vector(); + } + + const RigSingleWellResultsData* wellResults = findWellResult(simWellName); + + if (!wellResults) return std::vector(); + + std::vector< std::vector > pipeBranchesCLCoords; + std::vector< std::vector > pipeBranchesCellIds; + + RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(this, + wellResults, + -1, + true, + true, + pipeBranchesCLCoords, + pipeBranchesCellIds); + + for (size_t brIdx = 0; brIdx < pipeBranchesCLCoords.size(); ++brIdx) + { + auto wellMdCalculator = RigSimulationWellCoordsAndMD(pipeBranchesCLCoords[brIdx]); + + cvf::ref newWellPath = new RigWellPath(); + newWellPath->m_measuredDepths = wellMdCalculator.measuredDepths(); + newWellPath->m_wellPathPoints = wellMdCalculator.wellPathPoints(); + + branches.push_back(newWellPath.p()); + } + + return branches; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.h b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.h index a9ca08dc30..c2f019c991 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.h +++ b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.h @@ -42,6 +42,7 @@ class RigCaseCellResultsData; class RigActiveCellInfo; class RigSingleWellResultsData; class RigCell; +class RigWellPath; class RimEclipseCase; struct RigWellResultPoint; @@ -78,7 +79,7 @@ public: RigFormationNames* activeFormationNames(); void setWellResults(const cvf::Collection& data); - const cvf::Collection& wellResults() { return m_wellResults; } + const cvf::Collection& wellResults() const { return m_wellResults; } const RigSingleWellResultsData* findWellResult(QString wellName) const; const cvf::UByteArray* wellCellsInGrid(size_t gridIndex); @@ -92,6 +93,10 @@ public: RiaEclipseUnitTools::UnitSystem unitsType() const { return m_unitsType; } void setUnitsType(RiaEclipseUnitTools::UnitSystem unitsType) { m_unitsType = unitsType; } + std::vector simulationWellNames() const; + bool hasSimulationWell(const QString& simWellName) const; + std::vector simulationWellBranches(const QString& simWellName); + private: void computeActiveCellIJKBBox(); void computeWellCellsPrGrid();