#3534 Completion Export : Guard for missing width values

This commit is contained in:
Magne Sjaastad 2018-10-19 15:15:03 +02:00
parent 5cddab62ac
commit 59f0112f2e

View File

@ -174,21 +174,27 @@ double RigEclipseToStimPlanCalculator::areaWeightedWidth() const
auto stimPlanFractureTemplate = dynamic_cast<const RimStimPlanFractureTemplate*>(m_fracture->fractureTemplate()); auto stimPlanFractureTemplate = dynamic_cast<const RimStimPlanFractureTemplate*>(m_fracture->fractureTemplate());
if (stimPlanFractureTemplate) if (stimPlanFractureTemplate)
{ {
RiaWeightedMeanCalculator<double> calc;
auto widthValues = stimPlanFractureTemplate->widthResultValues(); auto widthValues = stimPlanFractureTemplate->widthResultValues();
if (!widthValues.empty())
for (const auto& singleCellCalc : m_singleFractureCellCalculators)
{ {
double cellArea = singleCellCalc.second.areaOpenForFlow(); RiaWeightedMeanCalculator<double> calc;
size_t globalStimPlanCellIndex = singleCellCalc.first; for (const auto& singleCellCalc : m_singleFractureCellCalculators)
double widthValue = widthValues[globalStimPlanCellIndex]; {
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; return width;