Skip to content

Commit

Permalink
Make RimWellPathCompletionSettings scriptable
Browse files Browse the repository at this point in the history
Support scripting of wellNameForExport, GroupNameForExport, MswLinerDiameter, MswRoutghness, Preferred Fluid Phase scriptable
  • Loading branch information
magnesj committed Nov 6, 2023
1 parent de1b60a commit a9fba1f
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "RimWellPath.h"

#include "cafPdmDoubleStringValidator.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiOrdering.h"
#include "cafPdmUiTreeOrdering.h"
Expand Down Expand Up @@ -79,13 +81,13 @@ CAF_PDM_SOURCE_INIT( RimWellPathCompletionSettings, "WellPathCompletionSettings"
//--------------------------------------------------------------------------------------------------
RimWellPathCompletionSettings::RimWellPathCompletionSettings()
{
CAF_PDM_InitObject( "Completion Settings", ":/CompletionsSymbol16x16.png" );
CAF_PDM_InitField( &m_wellNameForExport, "WellNameForExport", QString(), "Well Name" );
CAF_PDM_InitScriptableObject( "Completion Settings", ":/CompletionsSymbol16x16.png" );
CAF_PDM_InitScriptableField( &m_wellNameForExport, "WellNameForExport", QString(), "Well Name" );
m_wellNameForExport.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() );

CAF_PDM_InitField( &m_groupName, "WellGroupNameForExport", QString(), "Group Name" );
CAF_PDM_InitScriptableFieldWithScriptKeyword( &m_groupName, "WellGroupNameForExport", "GroupNameForExport", QString(), "Group Name" );
CAF_PDM_InitField( &m_referenceDepth, "ReferenceDepthForExport", QString(), "Reference Depth for BHP" );
CAF_PDM_InitFieldNoDefault( &m_preferredFluidPhase, "WellTypeForExport", "Preferred Fluid Phase" );
CAF_PDM_InitScriptableFieldNoDefault( &m_preferredFluidPhase, "WellTypeForExport", "Preferred Fluid Phase" );
CAF_PDM_InitField( &m_drainageRadiusForPI, "DrainageRadiusForPI", QString( "0.0" ), "Drainage Radius for PI" );
CAF_PDM_InitFieldNoDefault( &m_gasInflowEquation, "GasInflowEq", "Gas Inflow Equation" );
CAF_PDM_InitFieldNoDefault( &m_automaticWellShutIn, "AutoWellShutIn", "Automatic well shut-in" );
Expand All @@ -98,6 +100,14 @@ RimWellPathCompletionSettings::RimWellPathCompletionSettings()
m_mswParameters = new RimMswCompletionParameters;
m_mswParameters.uiCapability()->setUiTreeHidden( true );
m_mswParameters.uiCapability()->setUiTreeChildrenHidden( true );

CAF_PDM_InitScriptableFieldNoDefault( &m_mswLinerDiameter, "MswLinerDiameter", "MSW Liner Diameter" );
m_mswLinerDiameter.registerGetMethod( this, &RimWellPathCompletionSettings::mswLinerDiameter );
m_mswLinerDiameter.registerSetMethod( this, &RimWellPathCompletionSettings::setMswLinerDiameter );

CAF_PDM_InitScriptableFieldNoDefault( &m_mswRoughness, "MswRoughness", "MSW Roughness" );
m_mswRoughness.registerGetMethod( this, &RimWellPathCompletionSettings::mswRoughness );
m_mswRoughness.registerSetMethod( this, &RimWellPathCompletionSettings::setMswRoughness );
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -361,3 +371,35 @@ QString RimWellPathCompletionSettings::formatStringForExport( const QString& tex
if ( text.contains( ' ' ) ) return QString( "'%1'" ).arg( text );
return text;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletionSettings::setMswRoughness( const double& roughness )
{
m_mswParameters->setRoughnessFactor( roughness );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellPathCompletionSettings::mswRoughness() const
{
return m_mswParameters->roughnessFactor();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletionSettings::setMswLinerDiameter( const double& diameter )
{
m_mswParameters->setLinerDiameter( diameter );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellPathCompletionSettings::mswLinerDiameter() const
{
return m_mswParameters->linerDiameter();
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmProxyValueField.h"

class RimMswCompletionParameters;
class RimWellPathCompletionsLegacy;
Expand Down Expand Up @@ -93,6 +94,11 @@ class RimWellPathCompletionSettings : public caf::PdmObject
private:
QString formatStringForExport( const QString& text, const QString& defaultText = "" ) const;

void setMswRoughness( const double& roughness );
double mswRoughness() const;
void setMswLinerDiameter( const double& diameter );
double mswLinerDiameter() const;

private:
friend class RimWellPathCompletions;

Expand All @@ -110,4 +116,9 @@ class RimWellPathCompletionSettings : public caf::PdmObject
caf::PdmField<int> m_fluidInPlaceRegion;

caf::PdmChildField<RimMswCompletionParameters*> m_mswParameters;

// Use proxy fields for selected parameters in RimMswCompletionParameters, so it is possible to modify these values from the same
// scripting object
caf::PdmProxyValueField<double> m_mswLinerDiameter;
caf::PdmProxyValueField<double> m_mswRoughness;
};
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ RimWellPath::RimWellPath()
m_completions = new RimWellPathCompletions;
m_completions.uiCapability()->setUiTreeHidden( true );

CAF_PDM_InitFieldNoDefault( &m_completionSettings, "CompletionSettings", "Completion Settings" );
CAF_PDM_InitScriptableFieldNoDefault( &m_completionSettings, "CompletionSettings", "Completion Settings" );
m_completionSettings = new RimWellPathCompletionSettings;

CAF_PDM_InitFieldNoDefault( &m_wellLogFiles, "WellLogFiles", "Well Log Files" );
Expand Down

0 comments on commit a9fba1f

Please sign in to comment.