mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 15:10:22 -05:00
#14772 Forward scaleFractureTemplate to RimcFractureTemplate_setScaleFactors
Add a typed setter to the existing RimcFractureTemplate_setScaleFactors object method and let RicfScaleFractureTemplate forward to it via RicfForwarding::findFractureTemplate(). Make RimFractureTemplate::m_id scriptable (read-only) so templates can be looked up by id from Python. Project.scale_fracture_template(template_id=...) in Python now resolves the template object and calls FractureTemplate.set_scale_factors(), emitting a DeprecationWarning.
This commit is contained in:
1 parent
dbd9e50f5f
commit
eda2d73fed
6 files changed
+135
-46
No files matched your search
@@ -40,6 +40,17 @@ RimcFractureTemplate_setScaleFactors::RimcFractureTemplate_setScaleFactors( caf:
|
||||
CAF_PDM_InitScriptableField( &m_conductivity, "Conductivity", 1.0, "Conductivity" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimcFractureTemplate_setScaleFactors::setScaleFactors( double halfLength, double height, double dFactor, double conductivity )
|
||||
{
|
||||
m_halfLength = halfLength;
|
||||
m_height = height;
|
||||
m_dFactor = dFactor;
|
||||
m_conductivity = conductivity;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -59,3 +70,44 @@ std::expected<caf::PdmObjectHandle*, QString> RimcFractureTemplate_setScaleFacto
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimFractureTemplate, RimFractureTemplate_setContainment, "setContainment" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFractureTemplate_setContainment::RimFractureTemplate_setContainment( caf::PdmObjectHandle* self )
|
||||
: caf::PdmVoidObjectMethod( self )
|
||||
{
|
||||
CAF_PDM_InitObject( "Set Fracture Containment", "", "", "Set the K layer range fractures from this template are contained within" );
|
||||
|
||||
CAF_PDM_InitScriptableField( &m_topLayer, "TopLayer", -1, "Top Layer", "", "", "Zero-based K index of the top layer" );
|
||||
CAF_PDM_InitScriptableField( &m_baseLayer, "BaseLayer", -1, "Base Layer", "", "", "Zero-based K index of the base layer" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureTemplate_setContainment::setLayers( int topLayer, int baseLayer )
|
||||
{
|
||||
m_topLayer = topLayer;
|
||||
m_baseLayer = baseLayer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimFractureTemplate_setContainment::execute()
|
||||
{
|
||||
auto* fractureTemplate = self<RimFractureTemplate>();
|
||||
if ( !fractureTemplate ) return std::unexpected( "No fracture template is available." );
|
||||
|
||||
if ( m_topLayer() < 0 || m_baseLayer() < 0 ) return std::unexpected( "Top and base layer must be non-negative." );
|
||||
if ( m_topLayer() > m_baseLayer() ) return std::unexpected( "Top layer must not be below the base layer." );
|
||||
|
||||
fractureTemplate->setContainmentTopKLayer( m_topLayer() );
|
||||
fractureTemplate->setContainmentBaseKLayer( m_baseLayer() );
|
||||
fractureTemplate->loadDataAndUpdateGeometryHasChanged();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
Reference in new issue
Block a user