diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorMudWeightWindow.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorMudWeightWindow.cpp index 38fac2d014..cb44e5907f 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorMudWeightWindow.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorMudWeightWindow.cpp @@ -85,9 +85,11 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorMudWeightWindow::calculate( for ( auto parameterType : parameterTypes ) { - frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() ); + auto task = + frameCountProgress.task( "Loading parameter: " + + caf::AppEnum::uiText( parameterType ), + m_resultCollection->frameCount() ); loadParameterFramesOrValue( parameterType, partIndex, parameterFrames, parameterValues ); - frameCountProgress.incrementProgress(); } double airGap = m_resultCollection->airGapMudWeightWindow(); @@ -101,25 +103,30 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorMudWeightWindow::calculate( m_resultCollection->lowerLimitParameterMudWeightWindow(); // Pore pressure - frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() ); - RigFemScalarResultFrames* porePressureDataFrames = - m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( RIG_ELEMENT_NODAL, "POR-Bar", "" ) ); - frameCountProgress.incrementProgress(); + RigFemScalarResultFrames* porePressureDataFrames = nullptr; + { + auto task = frameCountProgress.task( "Loading POR-Bar.", m_resultCollection->frameCount() ); + porePressureDataFrames = + m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( RIG_ELEMENT_NODAL, "POR-Bar", "" ) ); + } // Stress (ST.S3) - frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() ); - RigFemScalarResultFrames* stressDataFrames = - m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( resVarAddr.resultPosType, "ST", "S3" ) ); - frameCountProgress.incrementProgress(); + RigFemScalarResultFrames* stressDataFrames = nullptr; + { + auto task = frameCountProgress.task( "Loading ST.S3", m_resultCollection->frameCount() ); + stressDataFrames = + m_resultCollection->findOrLoadScalarResult( partIndex, + RigFemResultAddress( resVarAddr.resultPosType, "ST", "S3" ) ); + } // Initial overburden gradient (ST.S33) - frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() ); - RigFemScalarResultFrames* obg0DataFrames = - m_resultCollection->findOrLoadScalarResult( partIndex, - RigFemResultAddress( resVarAddr.resultPosType, "ST", "S33" ) ); - frameCountProgress.incrementProgress(); - - frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() ); + RigFemScalarResultFrames* obg0DataFrames = nullptr; + { + auto task = frameCountProgress.task( "Loading ST.S33", m_resultCollection->frameCount() ); + obg0DataFrames = + m_resultCollection->findOrLoadScalarResult( partIndex, + RigFemResultAddress( resVarAddr.resultPosType, "ST", "S33" ) ); + } RigFemScalarResultFrames* mudWeightWindowFrames = m_resultCollection->createScalarResult( partIndex, @@ -133,7 +140,6 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorMudWeightWindow::calculate( RigFemScalarResultFrames* lowerMudWeightLimitFrames = m_resultCollection->createScalarResult( partIndex, RigFemResultAddress( resVarAddr.resultPosType, resVarAddr.fieldName, "LMWL" ) ); - frameCountProgress.incrementProgress(); const RigFemPart* femPart = m_resultCollection->parts()->part( partIndex ); const RigFemPartGrid* femPartGrid = femPart->getOrCreateStructGrid(); @@ -150,6 +156,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorMudWeightWindow::calculate( if ( PP_NonReservoirType != RimMudWeightWindowParameters::NonReservoirPorePressureType::HYDROSTATIC && !nonReservoirAddress.isEmpty() ) { + auto task = frameCountProgress.task( "Loading non-reservoir pore pressure.", m_resultCollection->frameCount() ); nonReservoirResultFrames = m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( RIG_ELEMENT, @@ -160,6 +167,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorMudWeightWindow::calculate( float inf = std::numeric_limits::infinity(); frameCountProgress.setNextProgressIncrement( 1u ); + frameCountProgress.setProgressDescription( "Calculating Mud Weight Window." ); int frameCount = stressDataFrames->frameCount(); for ( int fIdx = 0; fIdx < frameCount; ++fIdx ) diff --git a/ApplicationCode/ProjectDataModel/RimCase.cpp b/ApplicationCode/ProjectDataModel/RimCase.cpp index 932b5bc342..76b8104f48 100644 --- a/ApplicationCode/ProjectDataModel/RimCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimCase.cpp @@ -42,7 +42,8 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimCase, "Case", "RimCase" ); /// //-------------------------------------------------------------------------------------------------- RimCase::RimCase() - : m_isInActiveDestruction( false ) + : settingsChanged( this ) + , m_isInActiveDestruction( false ) { CAF_PDM_InitScriptableObjectWithNameAndComment( "Case", ":/Case48x48.png", "", "", "Case", "The ResInsight base class for Cases" ); diff --git a/ApplicationCode/ProjectDataModel/RimCase.h b/ApplicationCode/ProjectDataModel/RimCase.h index 30f989bf44..2a51e6003d 100644 --- a/ApplicationCode/ProjectDataModel/RimCase.h +++ b/ApplicationCode/ProjectDataModel/RimCase.h @@ -81,6 +81,8 @@ public: Rim2dIntersectionViewCollection* intersectionViewCollection(); + caf::Signal<> settingsChanged; + protected: QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) override; diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp index 104ba58103..7e7bc848c5 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp @@ -422,8 +422,6 @@ std::vector RimGeoMechCase::allSpecialViews() const //-------------------------------------------------------------------------------------------------- void RimGeoMechCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ ) { - uiTreeOrdering.add( &m_mudWeightWindowParameters ); - std::vector children; geoMechViews.childObjects( &children ); @@ -1143,6 +1141,9 @@ void RimGeoMechCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& m_initialPermeabilityType != RimGeoMechCase::InitialPermeabilityType::INITIAL_PERMEABILITY_PER_ELEMENT ); permeabilityGroup->add( &m_permeabilityExponent ); + caf::PdmUiGroup* mudWeightWindowGroup = uiOrdering.addNewGroup( "Mud Weight Window" ); + m_mudWeightWindowParameters->uiOrdering( uiConfigName, *mudWeightWindowGroup ); + caf::PdmUiGroup* shearSlipIndicatorGroup = uiOrdering.addNewGroup( "Shear Slip Indicator" ); shearSlipIndicatorGroup->add( &m_waterDensityShearSlipIndicator ); diff --git a/ApplicationCode/ProjectDataModel/RimMudWeightWindowParameters.cpp b/ApplicationCode/ProjectDataModel/RimMudWeightWindowParameters.cpp index 70894ca2dc..0df9a621dc 100644 --- a/ApplicationCode/ProjectDataModel/RimMudWeightWindowParameters.cpp +++ b/ApplicationCode/ProjectDataModel/RimMudWeightWindowParameters.cpp @@ -415,6 +415,7 @@ void RimMudWeightWindowParameters::fieldChangedByUi( const caf::PdmFieldHandle* m_userDefinedPPNonReservoir, m_porePressureNonReservoirAddress ); geoMechCase->updateConnectedViews(); + geoMechCase->settingsChanged.send(); } } } @@ -474,6 +475,7 @@ void RimMudWeightWindowParameters::handleFieldChanged( RimGeoMechCase* } geoMechCase->updateConnectedViews(); + geoMechCase->settingsChanged.send(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index 0dedb91d6f..4f67f21729 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -178,7 +178,11 @@ void RimWellLogExtractionCurve::setFromSimulationWellName( const QString& simWel //-------------------------------------------------------------------------------------------------- void RimWellLogExtractionCurve::setCase( RimCase* rimCase ) { + disconnectCaseSignals( m_case.value() ); + m_case = rimCase; + + connectCaseSignals( rimCase ); clearGeneratedSimWellPaths(); } @@ -197,7 +201,9 @@ void RimWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view ) { if ( view ) { + disconnectCaseSignals( m_case.value() ); m_case = view->ownerCase(); + connectCaseSignals( m_case ); } RimGeoMechCase* geomCase = dynamic_cast( m_case.value() ); @@ -763,6 +769,8 @@ void RimWellLogExtractionCurve::initAfterRead() m_eclipseResultDefinition->setEclipseCase( eclipseCase ); m_geomResultDefinition->setGeoMechCase( geomCase ); + + connectCaseSignals( m_case.value() ); } //-------------------------------------------------------------------------------------------------- @@ -1101,3 +1109,33 @@ void RimWellLogExtractionCurve::setBranchIndex( int index ) { m_branchIndex = index; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogExtractionCurve::connectCaseSignals( RimCase* rimCase ) +{ + if ( rimCase ) + { + rimCase->settingsChanged.connect( this, &RimWellLogExtractionCurve::onCaseSettingsChanged ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogExtractionCurve::disconnectCaseSignals( RimCase* rimCase ) +{ + if ( rimCase != nullptr ) + { + rimCase->settingsChanged.disconnect( this ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogExtractionCurve::onCaseSettingsChanged( const caf::SignalEmitter* emitter ) +{ + loadDataAndUpdate( true ); +} diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h index 373746b699..a9f0193a2c 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h @@ -94,8 +94,12 @@ public: RiaDefines::PhaseType phaseType() const override; protected: - QString createCurveAutoName() override; - void onLoadDataAndUpdate( bool updateParentPlot ) override; + QString createCurveAutoName() override; + void onLoadDataAndUpdate( bool updateParentPlot ) override; + void onCaseSettingsChanged( const caf::SignalEmitter* emitter ); + void connectCaseSignals( RimCase* rimCase ); + void disconnectCaseSignals( RimCase* rimCase ); + virtual void performDataExtraction( bool* isUsingPseudoLength ); void extractData( bool* isUsingPseudoLength, bool performDataSmoothing = false, double smoothingThreshold = -1.0 );