#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());
if (stimPlanFractureTemplate)
{
RiaWeightedMeanCalculator<double> calc;
auto widthValues = stimPlanFractureTemplate->widthResultValues();
for (const auto& singleCellCalc : m_singleFractureCellCalculators)
if (!widthValues.empty())
{
double cellArea = singleCellCalc.second.areaOpenForFlow();
RiaWeightedMeanCalculator<double> 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;