From 59f0112f2ec46b2e8bd10fff66b66700cc5c41cd Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 19 Oct 2018 15:15:03 +0200 Subject: [PATCH] #3534 Completion Export : Guard for missing width values --- .../RigEclipseToStimPlanCalculator.cpp | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/ApplicationCode/ReservoirDataModel/Completions/RigEclipseToStimPlanCalculator.cpp b/ApplicationCode/ReservoirDataModel/Completions/RigEclipseToStimPlanCalculator.cpp index cb1b1bf1c6..710cb1dd64 100644 --- a/ApplicationCode/ReservoirDataModel/Completions/RigEclipseToStimPlanCalculator.cpp +++ b/ApplicationCode/ReservoirDataModel/Completions/RigEclipseToStimPlanCalculator.cpp @@ -174,21 +174,27 @@ double RigEclipseToStimPlanCalculator::areaWeightedWidth() const auto stimPlanFractureTemplate = dynamic_cast(m_fracture->fractureTemplate()); if (stimPlanFractureTemplate) { - RiaWeightedMeanCalculator calc; - auto widthValues = stimPlanFractureTemplate->widthResultValues(); - - for (const auto& singleCellCalc : m_singleFractureCellCalculators) + if (!widthValues.empty()) { - double cellArea = singleCellCalc.second.areaOpenForFlow(); + RiaWeightedMeanCalculator calc; - size_t globalStimPlanCellIndex = singleCellCalc.first; - double widthValue = widthValues[globalStimPlanCellIndex]; + for (const auto& singleCellCalc : m_singleFractureCellCalculators) + { + double cellArea = singleCellCalc.second.areaOpenForFlow(); - calc.addValueAndWeight(widthValue, cellArea); + size_t globalStimPlanCellIndex = singleCellCalc.first; + double widthValue = widthValues[globalStimPlanCellIndex]; + + calc.addValueAndWeight(widthValue, cellArea); + } + + width = calc.weightedMean(); + } + else + { + width = stimPlanFractureTemplate->computeFractureWidth(m_fracture); } - - width = calc.weightedMean(); } return width;