From 8ce9f63487b02284b201248752c4b4ca45fe30a6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 26 Apr 2019 13:30:29 +0200 Subject: [PATCH] #4328 Stimulation wells in 3D-view: Render well head using pipe color If well head is a real connection, render as normal connection. If dummy connection, render as pipe color --- .../RivSimWellPipesPartMgr.cpp | 4 +- .../ReservoirDataModel/RigSimWellData.cpp | 38 +++++++++++++------ .../ReservoirDataModel/RigWellResultPoint.h | 4 +- .../UserInterface/RiuResultTextBuilder.cpp | 2 +- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.cpp b/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.cpp index 1a9759c4ca..40b8ea5d54 100644 --- a/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.cpp @@ -287,7 +287,7 @@ void RivSimWellPipesPartMgr::buildWellPipeParts(const caf::DisplayCoordTransform for (const auto& intersectionInfo : wellPathCellIntersections) { size_t globalCellIndex = intersectionInfo.globCellIndex; - const RigWellResultPoint* wResCell = wResFrame.findResultCell(0, globalCellIndex); + const RigWellResultPoint* wResCell = wResFrame.findResultCellWellHeadIncluded(0, globalCellIndex); if (!wResCell || !wResCell->isValid()) { @@ -415,7 +415,7 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex) if (cellIds[wcIdx].isCell()) { - wResCell = wResFrame.findResultCell(cellIds[wcIdx].m_gridIndex, cellIds[wcIdx].m_gridCellIndex); + wResCell = wResFrame.findResultCellWellHeadExcluded(cellIds[wcIdx].m_gridIndex, cellIds[wcIdx].m_gridCellIndex); } if (wResCell) diff --git a/ApplicationCode/ReservoirDataModel/RigSimWellData.cpp b/ApplicationCode/ReservoirDataModel/RigSimWellData.cpp index 1b3072a523..b95406aac6 100644 --- a/ApplicationCode/ReservoirDataModel/RigSimWellData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigSimWellData.cpp @@ -354,7 +354,30 @@ bool RigSimWellData::isOpen(size_t resultTimeStepIndex) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const RigWellResultPoint* RigWellResultFrame::findResultCell(size_t gridIndex, size_t gridCellIndex) const +const RigWellResultPoint* RigWellResultFrame::findResultCellWellHeadIncluded(size_t gridIndex, size_t gridCellIndex) const +{ + const RigWellResultPoint* wellResultPoint = findResultCellWellHeadExcluded(gridIndex, gridCellIndex); + if (wellResultPoint) return wellResultPoint; + + // If we could not find the cell among the real connections, we try the wellhead. + // The wellhead does however not have a real connection state, and is rendering using pipe color + // https://github.com/OPM/ResInsight/issues/4328 + + // This behavior was different prior to release 2019.04 and was rendered as a closed connection (gray) + // https://github.com/OPM/ResInsight/issues/712 + + if (m_wellHead.m_gridCellIndex == gridCellIndex && m_wellHead.m_gridIndex == gridIndex ) + { + return &m_wellHead; + } + + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RigWellResultPoint* RigWellResultFrame::findResultCellWellHeadExcluded(size_t gridIndex, size_t gridCellIndex) const { CVF_ASSERT(gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T); @@ -362,23 +385,14 @@ const RigWellResultPoint* RigWellResultFrame::findResultCell(size_t gridIndex, s { for (size_t wc = 0; wc < m_wellResultBranches[wb].m_branchResultPoints.size(); ++wc) { - if ( m_wellResultBranches[wb].m_branchResultPoints[wc].m_gridCellIndex == gridCellIndex - && m_wellResultBranches[wb].m_branchResultPoints[wc].m_gridIndex == gridIndex ) + if (m_wellResultBranches[wb].m_branchResultPoints[wc].m_gridCellIndex == gridCellIndex && + m_wellResultBranches[wb].m_branchResultPoints[wc].m_gridIndex == gridIndex) { return &(m_wellResultBranches[wb].m_branchResultPoints[wc]); } } } - // If we could not find the cell among the real connections, we try the wellhead. - // The wellhead does however not have a real connection state, and is thereby always rendered as closed - // If we have a real connection in the wellhead, we should not end here. See Github issue #712 - - if (m_wellHead.m_gridCellIndex == gridCellIndex && m_wellHead.m_gridIndex == gridIndex ) - { - return &m_wellHead; - } - return nullptr; } diff --git a/ApplicationCode/ReservoirDataModel/RigWellResultPoint.h b/ApplicationCode/ReservoirDataModel/RigWellResultPoint.h index 8cfe5255c1..f4afe01fa2 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellResultPoint.h +++ b/ApplicationCode/ReservoirDataModel/RigWellResultPoint.h @@ -101,7 +101,9 @@ public: { } - const RigWellResultPoint* findResultCell(size_t gridIndex, size_t gridCellIndex) const; + const RigWellResultPoint* findResultCellWellHeadIncluded(size_t gridIndex, size_t gridCellIndex) const; + const RigWellResultPoint* findResultCellWellHeadExcluded(size_t gridIndex, size_t gridCellIndex) const; + RigWellResultPoint wellHeadOrStartCell() const; WellProductionType m_productionType; diff --git a/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp b/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp index 93ffeadceb..9de8498c24 100644 --- a/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp +++ b/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp @@ -833,7 +833,7 @@ QString RiuResultTextBuilder::wellResultText() } const RigWellResultFrame& wellResultFrame = singleWellResultData->wellResultFrame(m_timeStepIndex); - const RigWellResultPoint* wellResultCell = wellResultFrame.findResultCell(m_gridIndex, m_cellIndex); + const RigWellResultPoint* wellResultCell = wellResultFrame.findResultCellWellHeadIncluded(m_gridIndex, m_cellIndex); if (wellResultCell) { text += QString("-- Well-cell connection info --\n Well Name: %1\n Branch Id: %2\n Segment Id: %3\n").arg(singleWellResultData->m_wellName).arg(wellResultCell->m_ertBranchId).arg(wellResultCell->m_ertSegmentId);