mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 06:38:13 -05:00
#14980: Remove global max segment length from segment collection
The global max segment length no longer exists, so segment subdivision is defined only by the segment intervals.
This commit is contained in:
1 parent
81bcc2657d
commit
6e8e658f6d
14 files changed
+66
-140
No files matched your search
+2
-7
@@ -388,7 +388,6 @@ RigMswBranch buildMainBoreBranch( const RimWellPath*
|
||||
int branchNumber,
|
||||
int& segmentNumber,
|
||||
int outletSegmentNumber,
|
||||
double maxSegmentLength,
|
||||
const std::vector<std::pair<double, double>>& customSegmentIntervals,
|
||||
const RicMswTableDataTools::SegmentationSettings& segmentationSettings,
|
||||
const std::optional<QDateTime>& exportDate,
|
||||
@@ -475,8 +474,7 @@ RigMswBranch buildMainBoreBranch( const RimWellPath*
|
||||
|
||||
compsegsPerCell.push_back( collectCellCompsegs( cellInfo, compsegsContext ) );
|
||||
|
||||
const auto subSegs =
|
||||
RicMswTableDataTools::createSubSegmentMDPairs( cellInfo.startMD, cellInfo.endMD, maxSegmentLength, customSegmentIntervals );
|
||||
const auto subSegs = RicMswTableDataTools::createSubSegmentMDPairs( cellInfo.startMD, cellInfo.endMD, customSegmentIntervals );
|
||||
for ( const auto& [subStartMD, subEndMD] : subSegs )
|
||||
{
|
||||
cellPieces.push_back( { subStartMD, subEndMD } );
|
||||
@@ -621,7 +619,6 @@ std::vector<RigMswBranch> buildValveBranches( const RimWellPath*
|
||||
const std::string& wellNameForExport,
|
||||
int& segmentNumber,
|
||||
int& branchNumber,
|
||||
double maxSegmentLength,
|
||||
const std::vector<std::pair<double, double>>& customSegmentIntervals,
|
||||
const std::optional<QDateTime>& exportDate,
|
||||
RiaDefines::EclipseUnitSystem unitSystem )
|
||||
@@ -1032,7 +1029,6 @@ std::vector<RigMswBranch> buildFishbonesBranches( const RimEclipseCase*
|
||||
const std::string& wellNameForExport,
|
||||
int& segmentNumber,
|
||||
int& branchNumber,
|
||||
double maxSegmentLength,
|
||||
const std::vector<std::pair<double, double>>& customSegmentIntervals,
|
||||
RiaDefines::EclipseUnitSystem unitSystem,
|
||||
FishbonesExportContext& fishbonesContext )
|
||||
@@ -1207,8 +1203,7 @@ std::vector<RigMswBranch> buildFishbonesBranches( const RimEclipseCase*
|
||||
lateralSegmentContext.globalCellIndex = cellIntInfo.globCellIndex;
|
||||
lateralSegmentContext.equivalentDiameter = subs->equivalentDiameter( unitSystem );
|
||||
|
||||
const auto subSegs =
|
||||
RicMswTableDataTools::createSubSegmentMDPairs( startMD, endMD, maxSegmentLength, customSegmentIntervals );
|
||||
const auto subSegs = RicMswTableDataTools::createSubSegmentMDPairs( startMD, endMD, customSegmentIntervals );
|
||||
|
||||
bool firstSubSeg = true;
|
||||
for ( const auto& [subStartMD, subEndMD] : subSegs )
|
||||
|
||||
@@ -177,7 +177,6 @@ RigMswBranch buildMainBoreBranch( const RimWellPath*
|
||||
int branchNumber,
|
||||
int& segmentNumber,
|
||||
int outletSegmentNumber,
|
||||
double maxSegmentLength,
|
||||
const std::vector<std::pair<double, double>>& customSegmentIntervals,
|
||||
const RicMswTableDataTools::SegmentationSettings& segmentationSettings,
|
||||
const std::optional<QDateTime>& exportDate,
|
||||
@@ -198,7 +197,6 @@ std::vector<RigMswBranch> buildValveBranches( const RimWellPath*
|
||||
const std::string& wellNameForExport,
|
||||
int& segmentNumber,
|
||||
int& branchNumber,
|
||||
double maxSegmentLength,
|
||||
const std::vector<std::pair<double, double>>& customSegmentIntervals,
|
||||
const std::optional<QDateTime>& exportDate,
|
||||
RiaDefines::EclipseUnitSystem unitSystem );
|
||||
@@ -226,7 +224,6 @@ std::vector<RigMswBranch> buildFishbonesBranches( const RimEclipseCase*
|
||||
const std::string& wellNameForExport,
|
||||
int& segmentNumber,
|
||||
int& branchNumber,
|
||||
double maxSegmentLength,
|
||||
const std::vector<std::pair<double, double>>& customSegmentIntervals,
|
||||
RiaDefines::EclipseUnitSystem unitSystem,
|
||||
FishbonesExportContext& fishbonesContext );
|
||||
|
||||
-7
@@ -188,7 +188,6 @@ std::vector<RigMswBranch> buildLateralBranches( RimEclipseCase*
|
||||
lateralBranchNum,
|
||||
segmentNumber,
|
||||
childOutletSeg,
|
||||
mswParameters->maxSegmentLength(),
|
||||
segmentIntervals,
|
||||
RicMswTableDataTools::segmentationSettings( mswParameters, exportDate ),
|
||||
exportDate,
|
||||
@@ -237,7 +236,6 @@ std::vector<RigMswBranch> buildLateralBranches( RimEclipseCase*
|
||||
wellNameForExport,
|
||||
segmentNumber,
|
||||
completionBranchNumber,
|
||||
mswParameters->maxSegmentLength(),
|
||||
segmentIntervals,
|
||||
exportDate,
|
||||
unitSystem );
|
||||
@@ -266,7 +264,6 @@ std::vector<RigMswBranch> buildLateralBranches( RimEclipseCase*
|
||||
wellNameForExport,
|
||||
segmentNumber,
|
||||
completionBranchNumber,
|
||||
mswParameters->maxSegmentLength(),
|
||||
segmentIntervals,
|
||||
unitSystem,
|
||||
fishbonesContext );
|
||||
@@ -303,7 +300,6 @@ std::vector<RigMswBranch> buildLateralBranches( RimEclipseCase*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigMswWellExportData buildMswWellExportData( RimEclipseCase* eclipseCase,
|
||||
const RimWellPath* wellPath,
|
||||
double maxSegmentLength,
|
||||
const std::vector<std::pair<double, double>>& customSegmentIntervals,
|
||||
CompletionType completionType,
|
||||
const std::optional<QDateTime>& exportDate )
|
||||
@@ -381,7 +377,6 @@ RigMswWellExportData buildMswWellExportData( RimEclipseCase*
|
||||
lateralBranchNumber,
|
||||
segmentNumber,
|
||||
1, // outlet = heel (segment 1)
|
||||
maxSegmentLength,
|
||||
customSegmentIntervals,
|
||||
RicMswTableDataTools::segmentationSettings( mswParameters, exportDate ),
|
||||
exportDate,
|
||||
@@ -424,7 +419,6 @@ RigMswWellExportData buildMswWellExportData( RimEclipseCase*
|
||||
wellNameForExport,
|
||||
segmentNumber,
|
||||
completionBranchNumber,
|
||||
maxSegmentLength,
|
||||
customSegmentIntervals,
|
||||
exportDate,
|
||||
unitSystem );
|
||||
@@ -450,7 +444,6 @@ RigMswWellExportData buildMswWellExportData( RimEclipseCase*
|
||||
wellNameForExport,
|
||||
segmentNumber,
|
||||
completionBranchNumber,
|
||||
maxSegmentLength,
|
||||
customSegmentIntervals,
|
||||
unitSystem,
|
||||
fishbonesContext );
|
||||
|
||||
-1
@@ -60,7 +60,6 @@ std::vector<RigMswBranch> buildLateralBranches( RimEclipseCase*
|
||||
|
||||
RigMswWellExportData buildMswWellExportData( RimEclipseCase* eclipseCase,
|
||||
const RimWellPath* wellPath,
|
||||
double maxSegmentLength,
|
||||
const std::vector<std::pair<double, double>>& customSegmentIntervals,
|
||||
RicWellPathExportMswTableData::CompletionType completionType,
|
||||
const std::optional<QDateTime>& exportDate );
|
||||
|
||||
@@ -33,34 +33,20 @@
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Custom intervals define exact segment boundaries where specified
|
||||
/// Areas without custom intervals use max segment length subdivision (if maxSegmentLength > 0)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::pair<double, double>>
|
||||
RicMswTableDataTools::createSubSegmentMDPairs( double startMD,
|
||||
double endMD,
|
||||
double maxSegmentLength,
|
||||
const std::vector<std::pair<double, double>>& customSegmentIntervals )
|
||||
{
|
||||
std::vector<std::pair<double, double>> subSegmentMDPairs;
|
||||
|
||||
// If no custom intervals, use original logic with maxSegmentLength subdivision
|
||||
if ( customSegmentIntervals.empty() || maxSegmentLength <= 0.0 )
|
||||
if ( customSegmentIntervals.empty() )
|
||||
{
|
||||
int subSegmentCount = maxSegmentLength > 0.0 ? (int)( std::trunc( ( endMD - startMD ) / maxSegmentLength ) + 1 ) : 1;
|
||||
double subSegmentLength = ( endMD - startMD ) / subSegmentCount;
|
||||
|
||||
double subStartMD = startMD;
|
||||
double subEndMD = startMD + subSegmentLength;
|
||||
for ( int i = 0; i < subSegmentCount; ++i )
|
||||
{
|
||||
subSegmentMDPairs.push_back( std::make_pair( subStartMD, subEndMD ) );
|
||||
subStartMD += subSegmentLength;
|
||||
subEndMD = std::min( subEndMD + subSegmentLength, endMD );
|
||||
}
|
||||
subSegmentMDPairs.push_back( std::make_pair( startMD, endMD ) );
|
||||
return subSegmentMDPairs;
|
||||
}
|
||||
|
||||
// Combine custom intervals with maxSegmentLength subdivision
|
||||
// Collect all boundaries (start, end, custom interval boundaries) and sort them
|
||||
std::set<double> boundaries;
|
||||
boundaries.insert( startMD );
|
||||
@@ -87,51 +73,10 @@ std::vector<std::pair<double, double>>
|
||||
// Convert boundaries to sorted vector
|
||||
std::vector<double> sortedBoundaries( boundaries.begin(), boundaries.end() );
|
||||
|
||||
// For each gap between boundaries, either:
|
||||
// - Use exact boundary if it's from a custom interval
|
||||
// - Subdivide using maxSegmentLength if it's a gap
|
||||
// For each gap between boundaries, use the exact boundary pair
|
||||
for ( size_t i = 0; i + 1 < sortedBoundaries.size(); ++i )
|
||||
{
|
||||
double gapStart = sortedBoundaries[i];
|
||||
double gapEnd = sortedBoundaries[i + 1];
|
||||
|
||||
// Check if this gap is covered by a custom interval
|
||||
bool coveredByCustomInterval = false;
|
||||
for ( const auto& [customStart, customEnd] : customSegmentIntervals )
|
||||
{
|
||||
double clippedStart = std::max( customStart, startMD );
|
||||
double clippedEnd = std::min( customEnd, endMD );
|
||||
|
||||
// If the gap is fully within a custom interval, use exact boundaries
|
||||
if ( gapStart >= clippedStart && gapEnd <= clippedEnd && std::abs( gapStart - clippedStart ) < 1e-6 &&
|
||||
std::abs( gapEnd - clippedEnd ) < 1e-6 )
|
||||
{
|
||||
coveredByCustomInterval = true;
|
||||
subSegmentMDPairs.push_back( std::make_pair( gapStart, gapEnd ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If not covered by custom interval, subdivide using maxSegmentLength
|
||||
if ( !coveredByCustomInterval && maxSegmentLength > 0.0 )
|
||||
{
|
||||
double gapLength = gapEnd - gapStart;
|
||||
int subCount = (int)( std::trunc( gapLength / maxSegmentLength ) + 1 );
|
||||
double subLength = gapLength / subCount;
|
||||
|
||||
double subStart = gapStart;
|
||||
for ( int j = 0; j < subCount; ++j )
|
||||
{
|
||||
double subEnd = ( j == subCount - 1 ) ? gapEnd : subStart + subLength;
|
||||
subSegmentMDPairs.push_back( std::make_pair( subStart, subEnd ) );
|
||||
subStart = subEnd;
|
||||
}
|
||||
}
|
||||
else if ( !coveredByCustomInterval )
|
||||
{
|
||||
// No maxSegmentLength, use gap as-is
|
||||
subSegmentMDPairs.push_back( std::make_pair( gapStart, gapEnd ) );
|
||||
}
|
||||
subSegmentMDPairs.push_back( std::make_pair( sortedBoundaries[i], sortedBoundaries[i + 1] ) );
|
||||
}
|
||||
|
||||
return subSegmentMDPairs;
|
||||
|
||||
@@ -58,10 +58,8 @@ struct SegmentationSettings
|
||||
bool singleSegmentAfterLastPerforation = false;
|
||||
};
|
||||
|
||||
std::vector<std::pair<double, double>> createSubSegmentMDPairs( double startMD,
|
||||
double endMD,
|
||||
double maxSegmentLength,
|
||||
const std::vector<std::pair<double, double>>& customSegmentIntervals = {} );
|
||||
std::vector<std::pair<double, double>>
|
||||
createSubSegmentMDPairs( double startMD, double endMD, const std::vector<std::pair<double, double>>& customSegmentIntervals = {} );
|
||||
|
||||
std::vector<SegmentationInterval> segmentationIntervals( const RimSegmentCollection* segmentCollection,
|
||||
const std::optional<QDateTime>& exportDate );
|
||||
|
||||
+2
-6
@@ -76,12 +76,8 @@ std::expected<RigMswTableData, std::string> RicWellPathExportMswTableData::extra
|
||||
if ( !segmentCollection ) return std::unexpected( "Missing MSW completion parameters" );
|
||||
|
||||
const std::vector<std::pair<double, double>> customSegmentIntervals = segmentCollection->getSegmentIntervals();
|
||||
auto wellExportData = RicWellPathExportMswGeometryPath::buildMswWellExportData( eclipseCase,
|
||||
wellPath,
|
||||
segmentCollection->maxSegmentLength(),
|
||||
customSegmentIntervals,
|
||||
completionType,
|
||||
exportDate );
|
||||
auto wellExportData =
|
||||
RicWellPathExportMswGeometryPath::buildMswWellExportData( eclipseCase, wellPath, customSegmentIntervals, completionType, exportDate );
|
||||
|
||||
auto unitSystem = eclipseCase->eclipseCaseData()->unitsType();
|
||||
return RicWellPathExportMswGeometryPath::collectTableData( wellExportData, unitSystem, segmentCollection->exportCompsegsSegmentNumber() );
|
||||
|
||||
Reference in new issue
Block a user