From 7bb705b1b7e6b2339db199351299d82d1690b7e4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 16 Mar 2018 15:33:57 +0100 Subject: [PATCH] #2600 Well CF Visualization: Add picking on connection factor objects --- ...vWellConnectionFactorGeometryGenerator.cpp | 4 ++ .../UserInterface/RiuViewerCommands.cpp | 59 ++++++++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/ModelVisualization/RivWellConnectionFactorGeometryGenerator.cpp b/ApplicationCode/ModelVisualization/RivWellConnectionFactorGeometryGenerator.cpp index cf65996a71..3eb91b5aed 100644 --- a/ApplicationCode/ModelVisualization/RivWellConnectionFactorGeometryGenerator.cpp +++ b/ApplicationCode/ModelVisualization/RivWellConnectionFactorGeometryGenerator.cpp @@ -154,6 +154,8 @@ cvf::ref RivWellConnectionFactorGeometryGenerator::createPipeS RivWellConnectionFactorGeometryGenerator::createStarGeometry( &verticesForOneObject, &indicesForOneObject, m_radius, m_radius * 0.3f); + m_trianglesPerConnection = indicesForOneObject.size() / 3; + cvf::ref vertices = new cvf::Vec3fArray; cvf::ref indices = new cvf::UIntArray; @@ -195,6 +197,8 @@ cvf::ref RivWellConnectionFactorGeometryGenerator::createPipeS //-------------------------------------------------------------------------------------------------- size_t RivWellConnectionFactorGeometryGenerator::globalCellIndexFromTriangleIndex(cvf::uint triangleIndex) const { + if (m_trianglesPerConnection == 0) return 0; + size_t connectionIndex = triangleIndex / m_trianglesPerConnection; return m_centerColorPairs[connectionIndex].m_globalCellIndex; diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index 4a164d69a7..e4d0812e2d 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -34,6 +34,7 @@ #include "RigFemPartGrid.h" #include "RigGeoMechCaseData.h" #include "RigMainGrid.h" +#include "RigVirtualPerforationTransmissibilities.h" #include "RiaDefines.h" #include "RimCellEdgeColors.h" @@ -72,8 +73,9 @@ #include "RivSimWellPipeSourceInfo.h" #include "RivSourceInfo.h" #include "RivTernarySaturationOverlayItem.h" -#include "RivWellPathSourceInfo.h" +#include "RivWellConnectionSourceInfo.h" #include "RivWellFracturePartMgr.h" +#include "RivWellPathSourceInfo.h" #include "cafCmdExecCommandManager.h" #include "cafCmdFeatureManager.h" @@ -528,6 +530,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM const RivIntersectionSourceInfo* crossSectionSourceInfo = dynamic_cast(firstHitPart->sourceInfo()); const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo = dynamic_cast(firstHitPart->sourceInfo()); const RivSimWellPipeSourceInfo* eclipseWellSourceInfo = dynamic_cast(firstHitPart->sourceInfo()); + const RivWellConnectionSourceInfo* wellConnectionSourceInfo = dynamic_cast(firstHitPart->sourceInfo()); if (rivObjectSourceInfo) { @@ -626,6 +629,60 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM RiuMainWindow::instance()->selectAsCurrentItem(eclipseWellSourceInfo->well(), allowActiveViewChange); } + else if (wellConnectionSourceInfo) + { + bool allowActiveViewChange = dynamic_cast(m_viewer->ownerViewWindow()) == nullptr; + + size_t globalCellIndex = wellConnectionSourceInfo->globalCellIndexFromTriangleIndex(firstPartTriangleIndex); + + RimEclipseView* eclipseView = dynamic_cast(m_reservoirView.p()); + if (eclipseView) + { + RimEclipseCase* eclipseCase = nullptr; + eclipseView->firstAncestorOrThisOfTypeAsserted(eclipseCase); + + if (eclipseCase->eclipseCaseData() && eclipseCase->eclipseCaseData()->virtualPerforationTransmissibilities()) + { + auto connectionFactors = eclipseCase->eclipseCaseData()->virtualPerforationTransmissibilities(); + size_t timeStep = eclipseView->currentTimeStep(); + + const auto& completionData = connectionFactors->multipleCompletionsPerEclipseCell(wellConnectionSourceInfo->wellPath(), timeStep); + + for (const auto& compData : completionData) + { + if (compData.first.globalCellIndex() == globalCellIndex) + { + auto completionDataItems = compData.second; + + if (!completionDataItems.empty()) + { + QString resultInfoText; + + // For now, only report the fist completion and not the combined completion if more than one + // completion contributes into a cell + + resultInfoText += QString("Well Connection Factor : %1").arg(completionDataItems[0].transmissibility()); + resultInfoText += "

Details :
"; + + for (const auto& completionData : completionDataItems) + { + for (const auto& metaData : completionData.metadata()) + { + resultInfoText += QString("Name %1 Description %2
").arg(metaData.name).arg(metaData.comment); + } + } + + RiuMainWindow::instance()->setResultInfo(resultInfoText); + } + + break; + } + } + } + } + + RiuMainWindow::instance()->selectAsCurrentItem(wellConnectionSourceInfo->wellPath(), allowActiveViewChange); + } } if (firstNncHitPart && firstNncHitPart->sourceInfo())