mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 22:50:25 -05:00
#14667 Completions: Move MSW settings to segments
This commit is contained in:
1 parent
cfb9e5765e
commit
63bcc22485
46 files changed
+1635
-1008
No files matched your search
@@ -33,9 +33,9 @@
|
||||
#include "RimFishbonesDefines.h"
|
||||
#include "RimImportedWellLog.h"
|
||||
#include "RimImportedWellLogData.h"
|
||||
#include "RimMswCompletionParameters.h"
|
||||
#include "RimPerforationCollection.h"
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimSegmentCollection.h"
|
||||
#include "RimStimPlanFractureTemplate.h"
|
||||
#include "RimStimPlanModel.h"
|
||||
#include "RimThermalFractureTemplate.h"
|
||||
@@ -222,44 +222,32 @@ QString RimcWellPath_appendPerforationInterval::classKeywordReturnedType() const
|
||||
return RimPerforationInterval::classKeywordStatic();
|
||||
}
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimWellPath, RimcWellPath_multiSegmentWellSettings, "MswSettings" );
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimWellPath, RimcWellPath_segmentCollection, "SegmentCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimcWellPath_multiSegmentWellSettings::RimcWellPath_multiSegmentWellSettings( caf::PdmObjectHandle* self )
|
||||
RimcWellPath_segmentCollection::RimcWellPath_segmentCollection( caf::PdmObjectHandle* self )
|
||||
: PdmObjectMethod( self, PdmObjectMethod::NullPointerType::NULL_IS_VALID, PdmObjectMethod::ResultType::PERSISTENT_TRUE )
|
||||
{
|
||||
CAF_PDM_InitObject( "MSW Settings", "", "", "Multi Segment Well Settings" );
|
||||
CAF_PDM_InitObject( "Segment Collection", "", "", "Segment Collection" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcWellPath_multiSegmentWellSettings::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcWellPath_segmentCollection::execute()
|
||||
{
|
||||
auto wellPath = self<RimWellPath>();
|
||||
|
||||
// RimMswCompletionParameters is a child object of RimWellPathCompletionSettings. To simplify the Python API, we return
|
||||
// RimMswCompletionParameters directly from a well path object in Python. Two parameters are already exposed as part of the completion
|
||||
// settings object, see RimWellPathCompletionSettings and the proxy fields liner_diameter and roughness. These fields are kept to
|
||||
// ensure backward compatibility with existing scripts.
|
||||
//
|
||||
// https://github.com/OPM/ResInsight/issues/11901
|
||||
|
||||
if ( auto completionSettings = wellPath->completionSettings() )
|
||||
{
|
||||
return completionSettings->mswCompletionParameters();
|
||||
}
|
||||
return nullptr;
|
||||
auto* wellPath = self<RimWellPath>();
|
||||
return wellPath ? wellPath->segmentCollection() : nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimcWellPath_multiSegmentWellSettings::classKeywordReturnedType() const
|
||||
QString RimcWellPath_segmentCollection::classKeywordReturnedType() const
|
||||
{
|
||||
return RimMswCompletionParameters::classKeywordStatic();
|
||||
return RimSegmentCollection::classKeywordStatic();
|
||||
}
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimWellPath, RimcWellPath_appendFishbones, "AppendFishbones" );
|
||||
|
||||
@@ -95,12 +95,12 @@ private:
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimcWellPath_multiSegmentWellSettings : public caf::PdmObjectMethod
|
||||
class RimcWellPath_segmentCollection : public caf::PdmObjectMethod
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimcWellPath_multiSegmentWellSettings( caf::PdmObjectHandle* self );
|
||||
RimcWellPath_segmentCollection( caf::PdmObjectHandle* self );
|
||||
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
QString classKeywordReturnedType() const override;
|
||||
|
||||
@@ -18,141 +18,36 @@
|
||||
|
||||
#include "RimcWellPathCompletionSettings.h"
|
||||
|
||||
#include "RimCustomSegmentInterval.h"
|
||||
#include "RimCustomSegmentIntervalCollection.h"
|
||||
#include "RimDiameterRoughnessInterval.h"
|
||||
#include "RimDiameterRoughnessIntervalCollection.h"
|
||||
#include "RimMswCompletionParameters.h"
|
||||
#include "RimWellPathCompletionSettings.h"
|
||||
#include "RimSegmentCollection.h"
|
||||
#include "RimSegmentInterval.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimWellPathCompletionSettings,
|
||||
RimcWellPathCompletionSettings_addDiameterRoughnessInterval,
|
||||
"AddDiameterRoughnessInterval" );
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSegmentCollection, RimcSegmentCollection_addSegmentInterval, "AddSegmentInterval" );
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimWellPathCompletionSettings,
|
||||
RimcWellPathCompletionSettings_addCustomSegmentInterval,
|
||||
"AddCustomSegmentInterval" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimcWellPathCompletionSettings_addDiameterRoughnessInterval::RimcWellPathCompletionSettings_addDiameterRoughnessInterval( caf::PdmObjectHandle* self )
|
||||
RimcSegmentCollection_addSegmentInterval::RimcSegmentCollection_addSegmentInterval( caf::PdmObjectHandle* self )
|
||||
: caf::PdmObjectCreationMethod( self )
|
||||
{
|
||||
CAF_PDM_InitObject( "Add Diameter Roughness Interval" );
|
||||
CAF_PDM_InitObject( "Add Segment Interval" );
|
||||
CAF_PDM_InitScriptableField( &m_startMD, "StartMd", 0.0, "Start Measured Depth" );
|
||||
CAF_PDM_InitScriptableField( &m_endMD, "EndMd", 100.0, "End Measured Depth" );
|
||||
CAF_PDM_InitScriptableField( &m_diameter, "Diameter", 0.152, "Diameter" );
|
||||
CAF_PDM_InitScriptableField( &m_roughnessFactor, "RoughnessFactor", 1.0e-5, "Roughness Factor" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcWellPathCompletionSettings_addDiameterRoughnessInterval::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcSegmentCollection_addSegmentInterval::execute()
|
||||
{
|
||||
auto completionSettings = self<RimWellPathCompletionSettings>();
|
||||
if ( !completionSettings )
|
||||
{
|
||||
return std::unexpected( QString( "Completion settings is null. Cannot add diameter roughness interval." ) );
|
||||
}
|
||||
auto* segmentCollection = self<RimSegmentCollection>();
|
||||
if ( !segmentCollection ) return std::unexpected( "Segment collection is null. Cannot add segment interval." );
|
||||
if ( m_endMD() <= m_startMD() ) return std::unexpected( "End MD must be greater than Start MD." );
|
||||
|
||||
auto mswParams = completionSettings->mswCompletionParameters();
|
||||
if ( !mswParams )
|
||||
{
|
||||
return std::unexpected( QString( "MSW completion parameters is null. Cannot add diameter roughness interval." ) );
|
||||
}
|
||||
|
||||
auto intervalCollection = mswParams->diameterRoughnessIntervals();
|
||||
if ( !intervalCollection )
|
||||
{
|
||||
return std::unexpected( QString( "Diameter roughness interval collection is null. Cannot add interval." ) );
|
||||
}
|
||||
|
||||
// Ensure we're in interval-specific mode
|
||||
mswParams->setDiameterRoughnessMode( RimMswCompletionParameters::DiameterRoughnessMode::INTERVALS );
|
||||
|
||||
// Create new interval
|
||||
auto* newInterval = intervalCollection->createInterval( m_startMD(), m_endMD(), m_diameter(), m_roughnessFactor() );
|
||||
|
||||
if ( !newInterval )
|
||||
{
|
||||
return std::unexpected( QString( "Failed to create diameter roughness interval." ) );
|
||||
}
|
||||
|
||||
completionSettings->updateAllRequiredEditors();
|
||||
|
||||
return newInterval;
|
||||
segmentCollection->setDiameterRoughnessMode( RimSegmentCollection::DiameterRoughnessMode::INTERVALS );
|
||||
auto* interval = segmentCollection->createInterval( m_startMD(), m_endMD(), m_diameter(), m_roughnessFactor() );
|
||||
segmentCollection->updateAllRequiredEditors();
|
||||
return interval;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimcWellPathCompletionSettings_addDiameterRoughnessInterval::classKeywordReturnedType() const
|
||||
QString RimcSegmentCollection_addSegmentInterval::classKeywordReturnedType() const
|
||||
{
|
||||
return RimDiameterRoughnessInterval::classKeywordStatic();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimcWellPathCompletionSettings_addCustomSegmentInterval::RimcWellPathCompletionSettings_addCustomSegmentInterval( caf::PdmObjectHandle* self )
|
||||
: caf::PdmObjectCreationMethod( self )
|
||||
{
|
||||
CAF_PDM_InitObject( "Add Custom Segment Interval" );
|
||||
CAF_PDM_InitScriptableField( &m_startMD, "StartMd", 0.0, "Start Measured Depth" );
|
||||
CAF_PDM_InitScriptableField( &m_endMD, "EndMd", 100.0, "End Measured Depth" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcWellPathCompletionSettings_addCustomSegmentInterval::execute()
|
||||
{
|
||||
auto completionSettings = self<RimWellPathCompletionSettings>();
|
||||
if ( !completionSettings )
|
||||
{
|
||||
return std::unexpected( QString( "Completion settings is null. Cannot add custom segment interval." ) );
|
||||
}
|
||||
|
||||
auto mswParams = completionSettings->mswCompletionParameters();
|
||||
if ( !mswParams )
|
||||
{
|
||||
return std::unexpected( QString( "MSW completion parameters is null. Cannot add custom segment interval." ) );
|
||||
}
|
||||
|
||||
auto intervalCollection = mswParams->customSegmentIntervals();
|
||||
if ( !intervalCollection )
|
||||
{
|
||||
return std::unexpected( QString( "Custom segment interval collection is null. Cannot add interval." ) );
|
||||
}
|
||||
|
||||
// Validate that end MD is greater than start MD
|
||||
if ( m_endMD() <= m_startMD() )
|
||||
{
|
||||
return std::unexpected(
|
||||
QString( "End MD must be greater than Start MD. Start MD: %1, End MD: %2" ).arg( m_startMD() ).arg( m_endMD() ) );
|
||||
}
|
||||
|
||||
// Create new interval
|
||||
auto* newInterval = intervalCollection->createInterval( m_startMD(), m_endMD() );
|
||||
|
||||
if ( !newInterval )
|
||||
{
|
||||
return std::unexpected( QString( "Failed to create custom segment interval." ) );
|
||||
}
|
||||
|
||||
completionSettings->updateAllRequiredEditors();
|
||||
|
||||
return newInterval;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimcWellPathCompletionSettings_addCustomSegmentInterval::classKeywordReturnedType() const
|
||||
{
|
||||
return RimCustomSegmentInterval::classKeywordStatic();
|
||||
return RimSegmentInterval::classKeywordStatic();
|
||||
}
|
||||
@@ -15,7 +15,6 @@
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
@@ -24,15 +23,12 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimcWellPathCompletionSettings_addDiameterRoughnessInterval : public caf::PdmObjectCreationMethod
|
||||
class RimcSegmentCollection_addSegmentInterval : public caf::PdmObjectCreationMethod
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimcWellPathCompletionSettings_addDiameterRoughnessInterval( caf::PdmObjectHandle* self );
|
||||
RimcSegmentCollection_addSegmentInterval( caf::PdmObjectHandle* self );
|
||||
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
QString classKeywordReturnedType() const override;
|
||||
@@ -43,21 +39,3 @@ private:
|
||||
caf::PdmField<double> m_diameter;
|
||||
caf::PdmField<double> m_roughnessFactor;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimcWellPathCompletionSettings_addCustomSegmentInterval : public caf::PdmObjectCreationMethod
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimcWellPathCompletionSettings_addCustomSegmentInterval( caf::PdmObjectHandle* self );
|
||||
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
QString classKeywordReturnedType() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<double> m_startMD;
|
||||
caf::PdmField<double> m_endMD;
|
||||
};
|
||||
Reference in new issue
Block a user