mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-20 11:48:35 -06:00
#7589 MSW : Always connect to segment with lower measured depth
This commit is contained in:
parent
9c4ba8144d
commit
b2d475dde2
@ -158,9 +158,9 @@ std::vector<RicMswSegment*> RicMswBranch::segments()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
/// TODO: Marked as obsolete, delete if lowerMD variant works as expected
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicMswSegment* RicMswBranch::findClosestSegmentByMidpoint( double measuredDepthLocation )
|
||||
RicMswSegment* RicMswBranch::findClosestSegmentByMidpoint_obsolete( double measuredDepthLocation )
|
||||
{
|
||||
if ( measuredDepthLocation < startMD() )
|
||||
{
|
||||
@ -177,6 +177,7 @@ RicMswSegment* RicMswBranch::findClosestSegmentByMidpoint( double measuredDepthL
|
||||
|
||||
for ( auto seg : segments() )
|
||||
{
|
||||
// WELSEGS is reported as the midpoint of the segment
|
||||
double midpointMD = 0.5 * ( seg->startMD() + seg->endMD() );
|
||||
|
||||
double candidateDistance = std::abs( midpointMD - measuredDepthLocation );
|
||||
@ -190,6 +191,40 @@ RicMswSegment* RicMswBranch::findClosestSegmentByMidpoint( double measuredDepthL
|
||||
return closestSegment;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicMswSegment* RicMswBranch::findClosestSegmentWithLowerMD( double measuredDepthLocation )
|
||||
{
|
||||
if ( measuredDepthLocation < startMD() )
|
||||
{
|
||||
return segmentCount() > 0 ? segments().front() : nullptr;
|
||||
}
|
||||
|
||||
if ( measuredDepthLocation > endMD() )
|
||||
{
|
||||
return segmentCount() > 0 ? segments().back() : nullptr;
|
||||
}
|
||||
|
||||
RicMswSegment* closestSegment = nullptr;
|
||||
double smallestDistance = std::numeric_limits<double>::infinity();
|
||||
|
||||
for ( auto seg : segments() )
|
||||
{
|
||||
// WELSEGS is reported as the midpoint of the segment
|
||||
double midpointMD = 0.5 * ( seg->startMD() + seg->endMD() );
|
||||
|
||||
double candidateDistance = measuredDepthLocation - midpointMD;
|
||||
if ( candidateDistance > 0.0 && candidateDistance < smallestDistance )
|
||||
{
|
||||
closestSegment = seg;
|
||||
smallestDistance = candidateDistance;
|
||||
}
|
||||
}
|
||||
|
||||
return closestSegment;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -53,7 +53,8 @@ public:
|
||||
std::vector<const RicMswSegment*> segments() const;
|
||||
std::vector<RicMswSegment*> segments();
|
||||
|
||||
RicMswSegment* findClosestSegmentByMidpoint( double measuredDepth );
|
||||
RicMswSegment* findClosestSegmentByMidpoint_obsolete( double measuredDepthLocation );
|
||||
RicMswSegment* findClosestSegmentWithLowerMD( double measuredDepthLocation );
|
||||
|
||||
size_t segmentCount() const;
|
||||
|
||||
|
@ -160,7 +160,7 @@ void RicMswTableFormatterTools::writeWelsegsSegmentsRecursively( RifTextDataTabl
|
||||
{
|
||||
RicMswSegment* outletSegmentForChildBranch = outletSegment;
|
||||
|
||||
RicMswSegment* tieInSegmentOnParentBranch = branch->findClosestSegmentByMidpoint( childBranch->startMD() );
|
||||
RicMswSegment* tieInSegmentOnParentBranch = branch->findClosestSegmentWithLowerMD( childBranch->startMD() );
|
||||
if ( tieInSegmentOnParentBranch ) outletSegmentForChildBranch = tieInSegmentOnParentBranch;
|
||||
|
||||
writeWelsegsSegmentsRecursively( formatter,
|
||||
|
@ -509,7 +509,7 @@ void RicWellPathExportMswCompletionsImpl::generateFishbonesMswExportInfo(
|
||||
|
||||
icdCompletion->addSegment( std::move( icdSegment ) );
|
||||
|
||||
RicMswSegment* segmentOnParentBranch = branch->findClosestSegmentByMidpoint( subEndMD );
|
||||
RicMswSegment* segmentOnParentBranch = branch->findClosestSegmentWithLowerMD( subEndMD );
|
||||
if ( segmentOnParentBranch )
|
||||
{
|
||||
segmentOnParentBranch->addCompletion( std::move( icdCompletion ) );
|
||||
|
Loading…
Reference in New Issue
Block a user