MSW Export: Add preference for improved MSW data structures and rename extraction methods

This commit is contained in:
Magne Sjaastad committed 2026-05-21 10:12:49 +02:00
1 parent dad431edac
commit 5691333c61
5 files changed
+48 -31

No files matched your search

@@ -211,6 +211,12 @@ RiaPreferences::RiaPreferences()
CAF_PDM_InitField( &m_useUndoRedo, "useUndoRedo", false, "Enable Undo/Redo for Property Editor changes" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_useUndoRedo );
CAF_PDM_InitField( &m_useImprovedMswDataStructures,
"useImprovedMswDataStructures",
false,
"Use Improved MSW Data Structures" + RiaDefines::betaFeaturePostfix() );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_useImprovedMswDataStructures );
CAF_PDM_InitFieldNoDefault( &m_plotTemplateFolders, "plotTemplateFolders", "Plot Template Folder(s)" );
m_plotTemplateFolders.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_maxPlotTemplateFoldersDepth, "MaxPlotTemplateFoldersDepth", 2, "Maximum Plot Template Folder Search Depth" );
@@ -391,6 +397,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
otherGroup->setCollapsedByDefault();
otherGroup->add( &holoLensDisableCertificateVerification );
otherGroup->add( &m_useUndoRedo );
otherGroup->add( &m_useImprovedMswDataStructures );
caf::PdmUiGroup* importExportGroup = uiOrdering.addNewGroup( "Import and Export" );
importExportGroup->setCollapsedByDefault();
@@ -717,6 +724,14 @@ bool RiaPreferences::useUndoRedo() const
return m_useUndoRedo();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences::useImprovedMswDataStructures() const
{
return m_useImprovedMswDataStructures();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -73,6 +73,8 @@ public:
bool useUndoRedo() const;
bool useImprovedMswDataStructures() const;
const QString& dateFormat() const;
const QString& timeFormat() const;
QString
@@ -182,6 +184,7 @@ private:
caf::PdmField<QString> m_timeFormat;
caf::PdmField<bool> m_useUndoRedo;
caf::PdmField<bool> m_useImprovedMswDataStructures;
caf::PdmField<caf::AppEnum<RiaDefines::ThemeEnum>> m_guiTheme;
@@ -19,6 +19,7 @@
#include "RicWellPathExportMswTableData.h"
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RiaQStringFormatter.h"
#include "MswExport/RicWellPathExportMswGeometryPath.h"
@@ -71,28 +72,27 @@ std::expected<RigMswTableData, std::string>
CompletionType completionType,
const std::optional<QDateTime>& exportDate )
{
bool exportAsTree = true; // This can be made configurable if needed, but for now we will always export as tree structure to preserve
// the hierarchy of the well path segments and completions
if ( exportAsTree )
// Data prcessing for MSW has improved. Currently, there exist two code paths for extracting MSW data. The preference for using the
// legacy code path is controlled by the "Use Improved MSW Data Structures" preference (General tab, Other group).
bool useLegacy = !RiaPreferences::current()->useImprovedMswDataStructures();
if ( useLegacy )
{
return extractSingleWellMswDataTree( eclipseCase, wellPath, exportCompletionsAfterMainBoreSegments, completionType, exportDate );
return extractSingleWellMsw_Legacy( eclipseCase, wellPath, exportCompletionsAfterMainBoreSegments, completionType, exportDate );
}
else
{
return extractSingleWellMswDataGeometry( eclipseCase, wellPath, exportCompletionsAfterMainBoreSegments, completionType, exportDate );
return extractSingleWellMsw( eclipseCase, wellPath, exportCompletionsAfterMainBoreSegments, completionType, exportDate );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::expected<RigMswTableData, std::string>
RicWellPathExportMswTableData::extractSingleWellMswDataGeometry( RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
bool exportCompletionsAfterMainBoreSegments,
CompletionType completionType,
const std::optional<QDateTime>& exportDate )
std::expected<RigMswTableData, std::string> RicWellPathExportMswTableData::extractSingleWellMsw( RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
bool exportCompletionsAfterMainBoreSegments,
CompletionType completionType,
const std::optional<QDateTime>& exportDate )
{
if ( !eclipseCase || !wellPath || eclipseCase->eclipseCaseData() == nullptr )
return std::unexpected( "Invalid eclipse case or well path provided" );
@@ -116,11 +116,11 @@ std::expected<RigMswTableData, std::string>
///
//--------------------------------------------------------------------------------------------------
std::expected<RigMswTableData, std::string>
RicWellPathExportMswTableData::extractSingleWellMswDataTree( RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
bool exportCompletionsAfterMainBoreSegments,
CompletionType completionType,
const std::optional<QDateTime>& exportDate )
RicWellPathExportMswTableData::extractSingleWellMsw_Legacy( RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
bool exportCompletionsAfterMainBoreSegments,
CompletionType completionType,
const std::optional<QDateTime>& exportDate )
{
if ( !eclipseCase || !wellPath || eclipseCase->eclipseCaseData() == nullptr )
{
@@ -70,18 +70,17 @@ public:
CompletionType completionType = CompletionType::ALL,
const std::optional<QDateTime>& exportDate = std::nullopt );
static std::expected<RigMswTableData, std::string> extractSingleWellMswDataTree( RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
bool exportCompletionsAfterMainBoreSegments = true,
CompletionType completionType = CompletionType::ALL,
const std::optional<QDateTime>& exportDate = std::nullopt );
static std::expected<RigMswTableData, std::string> extractSingleWellMsw_Legacy( RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
bool exportCompletionsAfterMainBoreSegments = true,
CompletionType completionType = CompletionType::ALL,
const std::optional<QDateTime>& exportDate = std::nullopt );
static std::expected<RigMswTableData, std::string>
extractSingleWellMswDataGeometry( RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
bool exportCompletionsAfterMainBoreSegments = true,
CompletionType completionType = CompletionType::ALL,
const std::optional<QDateTime>& exportDate = std::nullopt );
static std::expected<RigMswTableData, std::string> extractSingleWellMsw( RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
bool exportCompletionsAfterMainBoreSegments = true,
CompletionType completionType = CompletionType::ALL,
const std::optional<QDateTime>& exportDate = std::nullopt );
static CompletionType convertFromExportSettings( const class RicExportCompletionDataSettingsUi& settings );
@@ -100,7 +100,7 @@ std::vector<std::tuple<size_t, size_t, size_t, std::string>> extractSortedCells(
// Parameterized integration tests: Tree mode vs Geometry mode for all MSW project files.
//
// The test loads a ResInsight project file, extracts well MSW data using both the tree-based
// (extractSingleWellMswDataTree) and geometry-based (extractSingleWellMswDataGeometry)
// (extractSingleWellMsw_Legacy) and geometry-based (extractSingleWellMsw)
// algorithms, and verifies that both produce equivalent results for every well path:
//
// - The same set of reservoir cells in COMPSEGS (sorted {i,j,k,gridName} tuples)
@@ -155,8 +155,8 @@ TEST_P( MswTreeVsGeometryTest, CompareTreeAndGeometryModes )
if ( !wellPath->isTopLevelWellPath() ) continue;
auto treeResult = RicWellPathExportMswTableData::extractSingleWellMswDataTree( eclipseCase, wellPath );
auto geometryResult = RicWellPathExportMswTableData::extractSingleWellMswDataGeometry( eclipseCase, wellPath );
auto treeResult = RicWellPathExportMswTableData::extractSingleWellMsw_Legacy( eclipseCase, wellPath );
auto geometryResult = RicWellPathExportMswTableData::extractSingleWellMsw( eclipseCase, wellPath );
// If one mode fails, the other should fail too (no MSW data for this well path).
if ( !treeResult.has_value() && !geometryResult.has_value() )