diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplate.cpp index 7f8591c101..b604c4f724 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplate.cpp @@ -27,7 +27,9 @@ #include "RimFractureContainment.h" #include "RimProject.h" +#include "cafPdmFieldScriptingCapability.h" #include "cafPdmObject.h" +#include "cafPdmObjectScriptingCapability.h" #include "cafPdmUiDoubleSliderEditor.h" #include "cafPdmUiDoubleValueEditor.h" #include "cafPdmUiPushButtonEditor.h" @@ -109,7 +111,7 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimFractureTemplate, "RimFractureTemplate" ); RimFractureTemplate::RimFractureTemplate() : wellPathDepthAtFractureChanged( this ) { - CAF_PDM_InitObject( "Fracture Template", ":/FractureTemplate16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "Fracture Template", ":/FractureTemplate16x16.png", "", "" ); CAF_PDM_InitField( &m_id, "Id", -1, "ID", "", "", "" ); m_id.uiCapability()->setUiReadOnly( true ); @@ -130,13 +132,14 @@ RimFractureTemplate::RimFractureTemplate() "" ); m_fractureTemplateUnit.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_orientationType, - "Orientation", - caf::AppEnum( TRANSVERSE_WELL_PATH ), - "Fracture Orientation", - "", - "", - "" ); + CAF_PDM_InitScriptableField( &m_orientationType, + "Orientation", + caf::AppEnum( TRANSVERSE_WELL_PATH ), + "Fracture Orientation", + "", + "", + "" ); + CAF_PDM_InitField( &m_azimuthAngle, "AzimuthAngle", 0.0f, "Azimuth Angle", "", "", "" ); // Is this correct // description? CAF_PDM_InitField( &m_skinFactor, "SkinFactor", 0.0f, "Skin Factor", "", "", "" ); @@ -468,7 +471,7 @@ void RimFractureTemplate::defineEditorAttribute( const caf::PdmFieldHandle* fiel if ( field == &m_scaleApplyButton ) { - caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast( attribute ); + auto* attrib = dynamic_cast( attribute ); if ( attrib ) { attrib->m_buttonText = "Apply"; @@ -477,7 +480,7 @@ void RimFractureTemplate::defineEditorAttribute( const caf::PdmFieldHandle* fiel if ( field == &m_wellPathDepthAtFracture ) { - caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast( attribute ); + auto* myAttr = dynamic_cast( attribute ); if ( myAttr ) { auto [minimum, maximum] = wellPathDepthAtFractureRange(); @@ -664,26 +667,24 @@ double RimFractureTemplate::computeEffectivePermeability( const RimFracture* fra { return m_userDefinedEffectivePermeability; } + + double fracPermeability = 0.0; + auto values = wellFractureIntersectionData( fractureInstance ); + if ( values.isWidthAndPermeabilityDefined() ) + { + fracPermeability = values.m_permeability; + } else { - double fracPermeability = 0.0; - auto values = wellFractureIntersectionData( fractureInstance ); - if ( values.isWidthAndPermeabilityDefined() ) - { - fracPermeability = values.m_permeability; - } - else - { - auto conductivity = values.m_conductivity; - auto width = computeFractureWidth( fractureInstance ); + auto conductivity = values.m_conductivity; + auto width = computeFractureWidth( fractureInstance ); - if ( fabs( width ) < 1e-10 ) return std::numeric_limits::infinity(); + if ( fabs( width ) < 1e-10 ) return std::numeric_limits::infinity(); - fracPermeability = conductivity / width; - } - - return fracPermeability * m_relativePermeability; + fracPermeability = conductivity / width; } + + return fracPermeability * m_relativePermeability; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.cpp index 67a0b057d0..8dd6551cef 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.cpp @@ -109,7 +109,7 @@ QList { QList options; - if ( fieldNeedingOptions == &m_stimPlanModel ) + if ( fieldNeedingOptions == &m_stimPlanModel && m_stimPlanModel ) { // The user is not allowed to change this field, but option box looks good options.push_back( caf::PdmOptionItemInfo( m_stimPlanModel->name(), m_stimPlanModel ) ); diff --git a/Fwk/AppFwk/cafPdmScripting/cafPdmFieldScriptingCapability.h b/Fwk/AppFwk/cafPdmScripting/cafPdmFieldScriptingCapability.h index e4fac909b6..7a9091292c 100644 --- a/Fwk/AppFwk/cafPdmScripting/cafPdmFieldScriptingCapability.h +++ b/Fwk/AppFwk/cafPdmScripting/cafPdmFieldScriptingCapability.h @@ -681,7 +681,6 @@ public: return enumTexts; } - // Xml Serializing private: PdmField>* m_field; };