diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index ddadc56f74..303728c10f 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -649,44 +649,51 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM if (eclipseCase->eclipseCaseData() && eclipseCase->eclipseCaseData()->virtualPerforationTransmissibilities()) { - auto connectionFactors = eclipseCase->eclipseCaseData()->virtualPerforationTransmissibilities(); - size_t timeStep = eclipseView->currentTimeStep(); + std::vector completionsForOneCell; - const auto& completionData = connectionFactors->multipleCompletionsPerEclipseCell(wellConnectionSourceInfo->wellPath(), timeStep); - - for (const auto& compData : completionData) { - if (compData.first.globalCellIndex() == globalCellIndex) + auto connectionFactors = eclipseCase->eclipseCaseData()->virtualPerforationTransmissibilities(); + size_t timeStep = eclipseView->currentTimeStep(); + + const auto& multipleCompletions = connectionFactors->multipleCompletionsPerEclipseCell(wellConnectionSourceInfo->wellPath(), timeStep); + + RigCompletionDataGridCell completionGridCell(globalCellIndex, eclipseCase->eclipseCaseData()->mainGrid()); + auto completionDataIt = multipleCompletions.find(completionGridCell); + if (completionDataIt != multipleCompletions.end()) { - auto completionDataItems = compData.second; - - if (!completionDataItems.empty()) - { - QString resultInfoText; - resultInfoText += QString("Well Connection Factor : %1

").arg(connectionFactor); - - { - RiuResultTextBuilder textBuilder(eclipseView, globalCellIndex, eclipseView->currentTimeStep()); - - resultInfoText += textBuilder.geometrySelectionText("
"); - } - - 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; + completionsForOneCell = completionDataIt->second; } } + + if (!completionsForOneCell.empty()) + { + double aggregatedConnectionFactor = 0.0; + for (const auto& completionData : completionsForOneCell) + { + aggregatedConnectionFactor += completionData.transmissibility(); + } + + QString resultInfoText; + resultInfoText += QString("Well Connection Factor : %1

").arg(aggregatedConnectionFactor); + + { + RiuResultTextBuilder textBuilder(eclipseView, globalCellIndex, eclipseView->currentTimeStep()); + + resultInfoText += textBuilder.geometrySelectionText("
"); + } + + resultInfoText += "

Details :
"; + + for (const auto& completionData : completionsForOneCell) + { + for (const auto& metaData : completionData.metadata()) + { + resultInfoText += QString("Name %1 Description %2
").arg(metaData.name).arg(metaData.comment); + } + } + + RiuMainWindow::instance()->setResultInfo(resultInfoText); + } } }