Add MSW segment support to well path completions/collection

Introduce MSW segment collection to RimWellPathCompletions, including UI tree integration and completion list updates. Add MSW Eclipse case and show bands fields to RimWellPathCollection, with new UI controls and update logic. Implement segment update and visualization methods, option calculation for Eclipse case selection, and update headers and includes accordingly.
This commit is contained in:
Magne Sjaastad committed 2026-01-20 14:13:22 +01:00
1 parent 0aec220869
commit 4b3ebd2a95
4 files changed
+121 -12

No files matched your search

@@ -22,6 +22,8 @@
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimMswSegment.h"
#include "RimMswSegmentCollection.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimProject.h"
@@ -65,6 +67,9 @@ RimWellPathCompletions::RimWellPathCompletions()
CAF_PDM_InitFieldNoDefault( &m_stimPlanModelCollection, "StimPlanModels", "StimPlan Models" );
m_stimPlanModelCollection = new RimStimPlanModelCollection;
CAF_PDM_InitFieldNoDefault( &m_mswSegmentCollection, "MswSegments", "MSW Segments" );
m_mswSegmentCollection = new RimMswSegmentCollection;
CAF_PDM_InitField( &m_wellNameForExport_OBSOLETE, "WellNameForExport", QString(), "Well Name" );
m_wellNameForExport_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_wellGroupName_OBSOLETE, "WellGroupNameForExport", QString(), "Well Group Name" );
@@ -129,6 +134,14 @@ RimStimPlanModelCollection* RimWellPathCompletions::stimPlanModelCollection() co
return m_stimPlanModelCollection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimMswSegmentCollection* RimWellPathCompletions::mswSegmentCollection() const
{
return m_mswSegmentCollection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -187,6 +200,14 @@ std::vector<RimWellPathComponentInterface*> RimWellPathCompletions::allCompletio
completions.push_back( valve );
}
if ( m_mswSegmentCollection && m_mswSegmentCollection->isChecked() )
{
for ( const RimMswSegment* segment : m_mswSegmentCollection->segments() )
{
completions.push_back( const_cast<RimMswSegment*>( segment ) );
}
}
return completions;
}
@@ -216,6 +237,14 @@ std::vector<const RimWellPathComponentInterface*> RimWellPathCompletions::allCom
completions.push_back( valve );
}
if ( m_mswSegmentCollection && m_mswSegmentCollection->isChecked() )
{
for ( const RimMswSegment* segment : m_mswSegmentCollection->segments() )
{
completions.push_back( segment );
}
}
return completions;
}
@@ -274,6 +303,11 @@ void RimWellPathCompletions::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTre
{
uiTreeOrdering.add( &m_stimPlanModelCollection );
}
if ( m_mswSegmentCollection && m_mswSegmentCollection->hasSegments() )
{
uiTreeOrdering.add( &m_mswSegmentCollection );
}
}
//--------------------------------------------------------------------------------------------------
@@ -27,6 +27,7 @@
#include "gsl/gsl"
class RimFishbonesCollection;
class RimMswSegmentCollection;
class RimPerforationCollection;
class RimStimPlanModelCollection;
class RimWellPathComponentInterface;
@@ -49,6 +50,7 @@ public:
RimPerforationCollection* perforationCollection() const;
RimWellPathFractureCollection* fractureCollection() const;
RimStimPlanModelCollection* stimPlanModelCollection() const;
RimMswSegmentCollection* mswSegmentCollection() const;
std::vector<RimWellPathComponentInterface*> allCompletionsNoConst() const;
std::vector<const RimWellPathComponentInterface*> allCompletions() const;
@@ -72,6 +74,7 @@ private:
caf::PdmChildField<RimPerforationCollection*> m_perforationCollection;
caf::PdmChildField<RimWellPathFractureCollection*> m_fractureCollection;
caf::PdmChildField<RimStimPlanModelCollection*> m_stimPlanModelCollection;
caf::PdmChildField<RimMswSegmentCollection*> m_mswSegmentCollection;
private:
/////////////////////
@@ -41,9 +41,11 @@
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseCaseTools.h"
#include "RimEclipseView.h"
#include "RimFileWellPath.h"
#include "RimModeledWellPath.h"
#include "RimMswSegmentCollection.h"
#include "RimOilField.h"
#include "RimOsduWellLog.h"
#include "RimOsduWellPath.h"
@@ -55,6 +57,7 @@
#include "RimWellMeasurementCollection.h"
#include "RimWellPath.h"
#include "RimWellPathCompletionSettings.h"
#include "RimWellPathCompletions.h"
#include "RimWellPathTieIn.h"
#include "RiuMainWindow.h"
@@ -67,6 +70,7 @@
#include "cafDataLoader.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiButton.h"
#include "cafPdmUiEditorHandle.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafProgressInfo.h"
@@ -140,6 +144,9 @@ RimWellPathCollection::RimWellPathCollection()
CAF_PDM_InitFieldNoDefault( &m_mswNameGrouping, "MswWellNameGrouping", "Grouping" );
CAF_PDM_InitFieldNoDefault( &m_mswNameGroupingPattern, "MswWellNameGroupingPattern", "Grouping Pattern" );
CAF_PDM_InitFieldNoDefault( &m_mswEclipseCase, "MswEclipseCase", "Eclipse Case" );
CAF_PDM_InitField( &m_mswShowBands, "MseShowBands", true, "Show Bands" );
m_wellPathImporter = std::make_unique<RifWellPathImporter>();
m_wellPathFormationsImporter = std::make_unique<RifWellPathFormationsImporter>();
}
@@ -159,6 +166,27 @@ void RimWellPathCollection::fieldChangedByUi( const caf::PdmFieldHandle* changed
scheduleRedrawAffectedViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimWellPathCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
{
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_mswEclipseCase )
{
options.push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
auto cases = RimEclipseCaseTools::eclipseCases();
for ( auto* c : cases )
{
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
/// Read files containing well path data, or create geometry based on the targets
//--------------------------------------------------------------------------------------------------
@@ -514,17 +542,23 @@ void RimWellPathCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
advancedGroup->add( &wellPathClip );
advancedGroup->add( &wellPathClipZDistance );
caf::PdmUiGroup* mswGroupingGroup = uiOrdering.addNewGroup( "MSW Settings" );
mswGroupingGroup->add( &m_mswNameGrouping );
caf::PdmUiGroup* wellGrouping = uiOrdering.addNewGroup( "MSW Grouping" );
wellGrouping->add( &m_mswNameGrouping );
if ( m_mswNameGrouping() != MswGroupingMode::DISABLED )
{
if ( m_mswNameGrouping() == MswGroupingMode::USE_PREFERENCES )
{
m_mswNameGroupingPattern = RiaPreferences::current()->multiLateralWellNamePattern();
}
mswGroupingGroup->add( &m_mswNameGroupingPattern );
wellGrouping->add( &m_mswNameGroupingPattern );
m_mswNameGroupingPattern.uiCapability()->setUiReadOnly( m_mswNameGrouping() == MswGroupingMode::USE_PREFERENCES );
}
caf::PdmUiGroup* mswSegmentGroup = uiOrdering.addNewGroup( "MSW Segment Visualization" );
mswSegmentGroup->add( &m_mswShowBands );
mswSegmentGroup->add( &m_mswEclipseCase );
auto updateButton = mswSegmentGroup->addNewButton( "Update Segments", [this]() { updateMswSegments(); } );
updateButton->setAlignment( Qt::AlignRight );
uiOrdering.skipRemainingFields();
}
@@ -554,6 +588,38 @@ caf::PdmFieldHandle* RimWellPathCollection::objectToggleField()
return &isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::updateMswSegments()
{
for ( const auto& wellPath : m_wellPaths )
{
if ( !wellPath ) continue;
auto* completions = wellPath->completions();
if ( !completions ) continue;
auto* segmentCollection = completions->mswSegmentCollection();
if ( !segmentCollection ) continue;
segmentCollection->updateSegments( m_mswEclipseCase() );
}
if ( RimProject* project = RimProject::current() )
{
project->scheduleCreateDisplayModelAndRedrawAllViews();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellPathCollection::showMswSegmentBands() const
{
return m_mswShowBands();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -29,6 +29,7 @@
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafPdmPtrField.h"
// Include to make Pdm work for cvf::Color
#include "cafPdmChildField.h"
@@ -121,6 +122,8 @@ public:
std::vector<RimWellPath*> connectedWellPathLaterals( const RimWellPath* parentWellPath ) const;
bool showMswSegmentBands() const;
RimWellPath* mostRecentlyUpdatedWellPath();
void readWellPathFormationFiles();
@@ -155,9 +158,10 @@ protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
private:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
void initAfterRead() override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
void initAfterRead() override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
caf::PdmFieldHandle* objectToggleField() override;
@@ -168,16 +172,15 @@ private:
caf::AppEnum<RiaDefines::EclipseUnitSystem> findUnitSystemForWellPath( const RimWellPath* wellPath );
cafTreeNode* addWellToWellNode( cafTreeNode* parent, RimWellPath* wellPath );
std::vector<RimWellPath*> wellPathsWithNoParent( const std::vector<RimWellPath*>& sourceWellPaths ) const;
std::vector<RimWellPath*> wellPathsWithNoParent( const std::vector<RimWellPath*>& sourceWellPaths ) const;
std::map<QString, std::vector<RimWellPath*>> wellPathsForWellNameStem( const std::vector<RimWellPath*>& sourceWellPaths ) const;
static void buildUiTreeOrdering( cafTreeNode* treeNode, caf::PdmUiTreeOrdering* parentUiTreeNode, const QString& uiConfigName );
cafTreeNode* addWellToWellNode( cafTreeNode* parent, RimWellPath* wellPath );
static void buildUiTreeOrdering( cafTreeNode* treeNode, caf::PdmUiTreeOrdering* parentUiTreeNode, const QString& uiConfigName );
static QString unGroupedText();
void updateMswSegments();
private:
std::unique_ptr<RifWellPathImporter> m_wellPathImporter;
std::unique_ptr<RifWellPathFormationsImporter> m_wellPathFormationsImporter;
@@ -190,4 +193,7 @@ private:
caf::PdmField<MswGroupingEnum> m_mswNameGrouping;
caf::PdmField<QString> m_mswNameGroupingPattern;
caf::PdmPtrField<RimEclipseCase*> m_mswEclipseCase;
caf::PdmField<bool> m_mswShowBands;
};