Add MSW grouping options to RimWellPathCollection

Introduce "MSW Grouping" feature to allow users to control how multi-segmented wells are grouped by name. Adds a new enum for grouping mode (use preferences, custom, disabled), new fields for grouping mode and pattern, and updates UI and logic to support these options. This provides greater flexibility and user control over well path grouping, especially for multi-lateral wells.
This commit is contained in:
Magne Sjaastad committed 2026-01-12 09:32:42 +01:00
1 parent 3821434022
commit e79ff8e7a7
2 files changed
+78 -3

No files matched your search

@@ -89,6 +89,16 @@ void RimWellPathCollection::WellVisibilityEnum::setUp()
addItem( RimWellPathCollection::ALL_ON, "ALL_ON", "Individual" );
addItem( RimWellPathCollection::FORCE_ALL_ON, "FORCE_ALL_ON", "On" );
}
template <>
void RimWellPathCollection::MswGroupingEnum::setUp()
{
addItem( RimWellPathCollection::MswGroupingMode::USE_PREFERENCES, "USE_PREFERENCES", "Use Preferences" );
addItem( RimWellPathCollection::MswGroupingMode::CUSTOM, "CUSTOM", "Custom" );
addItem( RimWellPathCollection::MswGroupingMode::DISABLED, "DISABLED", "Disabled" );
setDefault( RimWellPathCollection::MswGroupingMode::USE_PREFERENCES );
}
} // namespace caf
CAF_PDM_SOURCE_INIT( RimWellPathCollection, "WellPaths" );
@@ -127,6 +137,9 @@ RimWellPathCollection::RimWellPathCollection()
CAF_PDM_InitFieldNoDefault( &m_wellPathNodes, "WellPathNodes", "Well Path Nodes" );
m_wellPathNodes.xmlCapability()->disableIO();
CAF_PDM_InitFieldNoDefault( &m_mswNameGrouping, "MswWellNameGrouping", "Grouping" );
CAF_PDM_InitFieldNoDefault( &m_mswNameGroupingPattern, "MswWellNameGroupingPattern", "Grouping Pattern" );
m_wellPathImporter = std::make_unique<RifWellPathImporter>();
m_wellPathFormationsImporter = std::make_unique<RifWellPathFormationsImporter>();
}
@@ -500,6 +513,19 @@ void RimWellPathCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
caf::PdmUiGroup* advancedGroup = uiOrdering.addNewGroup( "Clipping" );
advancedGroup->add( &wellPathClip );
advancedGroup->add( &wellPathClipZDistance );
caf::PdmUiGroup* mswGroupingGroup = uiOrdering.addNewGroup( "MSW Settings" );
mswGroupingGroup->add( &m_mswNameGrouping );
if ( m_mswNameGrouping() != MswGroupingMode::DISABLED )
{
if ( m_mswNameGrouping() == MswGroupingMode::USE_PREFERENCES )
{
m_mswNameGroupingPattern = RiaPreferences::current()->multiLateralWellNamePattern();
}
mswGroupingGroup->add( &m_mswNameGroupingPattern );
m_mswNameGroupingPattern.uiCapability()->setUiReadOnly( m_mswNameGrouping() == MswGroupingMode::USE_PREFERENCES );
}
uiOrdering.skipRemainingFields();
}
//--------------------------------------------------------------------------------------------------
@@ -613,6 +639,15 @@ void RimWellPathCollection::deleteWell( RimWellPath* wellPath )
delete wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::setMswWellPattern( const QString& pattern )
{
m_mswNameGrouping = MswGroupingMode::CUSTOM;
m_mswNameGroupingPattern = pattern;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -942,11 +977,27 @@ std::vector<RimWellPath*> RimWellPathCollection::connectedWellPathLaterals( cons
std::map<QString, std::vector<RimWellPath*>>
RimWellPathCollection::wellPathsForWellNameStem( const std::vector<RimWellPath*>& sourceWellPaths ) const
{
std::map<QString, std::vector<RimWellPath*>> rootWells;
auto getMultiLateralWellPathPattern = [this]() -> QString
{
if ( m_mswNameGrouping() == MswGroupingMode::DISABLED )
{
return "";
}
else if ( m_mswNameGrouping() == MswGroupingMode::USE_PREFERENCES )
{
return RiaPreferences::current()->multiLateralWellNamePattern();
}
else
{
return m_mswNameGroupingPattern();
}
};
QString multiLateralWellPathPattern = RiaPreferences::current()->multiLateralWellNamePattern();
QString regexPattern = QRegularExpression::wildcardToRegularExpression( multiLateralWellPathPattern );
QString multiLateralWellPathPattern = getMultiLateralWellPathPattern();
QString regexPattern = QRegularExpression::wildcardToRegularExpression( multiLateralWellPathPattern );
QRegularExpression re( regexPattern, QRegularExpression::CaseInsensitiveOption );
std::map<QString, std::vector<RimWellPath*>> rootWells;
for ( auto wellPath : sourceWellPaths )
{
@@ -1073,6 +1124,17 @@ std::pair<cvf::ref<RigWellPath>, QString> RimWellPathCollection::loadWellPathGeo
return RifOsduWellPathReader::readWellPathData( fileContents, datumElevation );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::initAfterRead()
{
if ( m_mswNameGrouping() == MswGroupingMode::USE_PREFERENCES )
{
m_mswNameGroupingPattern = RiaPreferences::current()->multiLateralWellNamePattern();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------