Fix crash in RimWellPathValve when perforation is larger than wellpath

* This is the case with the Completions_msw Regression test
This commit is contained in:
Gaute Lindkvist 2018-12-07 12:56:32 +01:00
parent c51b938d03
commit 539914a541
3 changed files with 11 additions and 5 deletions

View File

@ -144,9 +144,13 @@ void RimMultipleValveLocations::computeRangesAndLocations()
double firstWellPathMD = rigWellPathGeo->m_measuredDepths.front(); double firstWellPathMD = rigWellPathGeo->m_measuredDepths.front();
double lastWellPathMD = rigWellPathGeo->m_measuredDepths.back(); double lastWellPathMD = rigWellPathGeo->m_measuredDepths.back();
for (auto md : locationsFromStartSpacingAndCount(m_rangeStart, m_rangeValveSpacing, m_rangeValveCount)) double overlapStart = std::max(firstWellPathMD, m_rangeStart());
double overlapEnd = std::min(lastWellPathMD, m_rangeEnd());
double overlap = std::max(0.0, overlapEnd - overlapStart);
if (overlap)
{ {
if (md >= firstWellPathMD && md <= lastWellPathMD) for (auto md : locationsFromStartSpacingAndCount(overlapStart, m_rangeValveSpacing, m_rangeValveCount))
{ {
validMeasuredDepths.push_back(md); validMeasuredDepths.push_back(md);
} }
@ -333,7 +337,7 @@ void RimMultipleValveLocations::fieldChangedByUi(const caf::PdmFieldHandle* chan
} }
else if (valve) else if (valve)
{ {
valve->geometryUpdated(); valve->multipleValveGeometryUpdated();
} }
} }

View File

@ -84,8 +84,10 @@ void RimWellPathValve::setMeasuredDepthAndCount(double startMD, double spacing,
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellPathValve::geometryUpdated() void RimWellPathValve::multipleValveGeometryUpdated()
{ {
if (m_multipleValveLocations->valveLocations().empty()) return;
m_measuredDepth = m_multipleValveLocations->valveLocations().front(); m_measuredDepth = m_multipleValveLocations->valveLocations().front();
RimProject* proj; RimProject* proj;

View File

@ -45,7 +45,7 @@ public:
~RimWellPathValve() override; ~RimWellPathValve() override;
void setMeasuredDepthAndCount(double startMD, double spacing, int valveCount); void setMeasuredDepthAndCount(double startMD, double spacing, int valveCount);
void geometryUpdated(); void multipleValveGeometryUpdated();
std::vector<double> valveLocations() const; std::vector<double> valveLocations() const;
double orificeDiameter(RiaEclipseUnitTools::UnitSystem unitSystem) const; double orificeDiameter(RiaEclipseUnitTools::UnitSystem unitSystem) const;
double flowCoefficient() const; double flowCoefficient() const;