From dc4d0fa109e8a0fa8c651e81955383a3566c1755 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 30 Oct 2020 13:25:22 +0100 Subject: [PATCH] Remove duplicated code. Moving the data extraction out of the curves makes it possible to share the curve drawing functionality. --- .../RicNewFractureModelPlotFeature.cpp | 140 +++------------ .../RicNewFractureModelPlotFeature.h | 20 +-- .../ProjectDataModel/CMakeLists_files.cmake | 4 - .../RimElasticPropertiesCurve.cpp | 160 ----------------- .../RimElasticPropertiesCurve.h | 84 --------- .../RimFractureModelCurve.cpp | 12 +- .../ProjectDataModel/RimFractureModelCurve.h | 6 +- .../RimFractureModelStressCurve.cpp | 162 ------------------ .../RimFractureModelStressCurve.h | 63 ------- .../ProjectDataModel/RimLayerCurve.cpp | 5 +- 10 files changed, 39 insertions(+), 617 deletions(-) delete mode 100644 ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.cpp delete mode 100644 ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.h delete mode 100644 ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.cpp delete mode 100644 ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.h diff --git a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp index 342a26f6f4..c62e39d902 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.cpp @@ -20,7 +20,6 @@ #include "RiaApplication.h" #include "RiaColorTables.h" -#include "RiaFractureDefines.h" #include "RiaGuiApplication.h" #include "RiaLogging.h" @@ -33,7 +32,6 @@ #include "RimEclipseCase.h" #include "RimEclipseResultDefinition.h" #include "RimEclipseView.h" -#include "RimElasticPropertiesCurve.h" #include "RimFaciesProperties.h" #include "RimFractureModel.h" #include "RimFractureModelCurve.h" @@ -114,18 +112,18 @@ RimFractureModelPlot* RicNewFractureModelPlotFeature::createPlot( RimFractureMod { auto task = progInfo.task( "Creating stress track", 2 ); - createStressTrack( plot, - fractureModel, - eclipseCase, - timeStep, - "Stress", - {RiaDefines::CurveProperty::STRESS, RiaDefines::CurveProperty::INITIAL_STRESS} ); - createStressTrack( plot, - fractureModel, - eclipseCase, - timeStep, - "Stress Gradient", - {RiaDefines::CurveProperty::STRESS_GRADIENT} ); + createParametersTrack( plot, + fractureModel, + eclipseCase, + timeStep, + "Stress", + {RiaDefines::CurveProperty::STRESS, RiaDefines::CurveProperty::INITIAL_STRESS} ); + createParametersTrack( plot, + fractureModel, + eclipseCase, + timeStep, + "Stress Gradient", + {RiaDefines::CurveProperty::STRESS_GRADIENT} ); } { @@ -146,13 +144,14 @@ RimFractureModelPlot* RicNewFractureModelPlotFeature::createPlot( RimFractureMod for ( auto result : results ) { - createElasticPropertiesTrack( plot, fractureModel, eclipseCase, timeStep, result ); + QString trackName = caf::AppEnum::uiText( result ); + createParametersTrack( plot, fractureModel, eclipseCase, timeStep, trackName, {result} ); } } { auto task = progInfo.task( "Creating temperature track", 2 ); - createStressTrack( plot, fractureModel, eclipseCase, timeStep, "Temperature", {RiaDefines::CurveProperty::TEMPERATURE} ); + createParametersTrack( plot, fractureModel, eclipseCase, timeStep, "Temperature", {RiaDefines::CurveProperty::TEMPERATURE} ); } { @@ -374,10 +373,14 @@ void RicNewFractureModelPlotFeature::createParametersTrack( RimFractureModelPlot curve->setLineStyle( RiuQwtPlotCurve::STYLE_SOLID ); curve->setLineThickness( 2 ); + if ( propertyType == RiaDefines::CurveProperty::STRESS_GRADIENT ) + { + curve->setInterpolation( RiuQwtPlotCurve::INTERPOLATION_STEP_LEFT ); + } + if ( fixedInitialTimeStep ) { curve->setAutoNameComponents( false, false, false, false, false ); - curve->setCustomName( QString( "INITIAL %1" ).arg( resultVariable ) ); curve->setCurrentTimeStep( 0 ); } else @@ -408,109 +411,6 @@ void RicNewFractureModelPlotFeature::createParametersTrack( RimFractureModelPlot RiuPlotMainWindowTools::showPlotMainWindow(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicNewFractureModelPlotFeature::createElasticPropertiesTrack( RimFractureModelPlot* plot, - RimFractureModel* fractureModel, - RimEclipseCase* eclipseCase, - int timeStep, - RiaDefines::CurveProperty propertyType ) -{ - QString trackName = caf::AppEnum::uiText( propertyType ); - RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, trackName, plot ); - plotTrack->setFormationWellPath( fractureModel->thicknessDirectionWellPath() ); - plotTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR ); - plotTrack->setLogarithmicScale( false ); - plotTrack->setShowRegionLabels( true ); - plotTrack->setShowWindow( true ); - plotTrack->setColSpan( RimPlot::TWO ); - plotTrack->setLegendsVisible( true ); - plotTrack->setPlotTitleVisible( true ); - - caf::ColorTable colors = RiaColorTables::wellLogPlotPaletteColors(); - - RimElasticPropertiesCurve* curve = new RimElasticPropertiesCurve; - curve->setCurveProperty( propertyType ); - curve->setFractureModel( fractureModel ); - curve->setCase( eclipseCase ); - curve->setColor( colors.cycledColor3f( 0 ) ); - curve->setLineStyle( RiuQwtPlotCurve::STYLE_SOLID ); - curve->setLineThickness( 2 ); - curve->setUiName( trackName ); - curve->setAutoNameComponents( false, false, false, false, false ); - - plotTrack->addCurve( curve ); - plotTrack->setAutoScaleXEnabled( true ); - curve->loadDataAndUpdate( true ); - - curve->updateConnectedEditors(); - plotTrack->updateConnectedEditors(); - plot->updateConnectedEditors(); - - RiaApplication::instance()->project()->updateConnectedEditors(); - - RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); - RiuPlotMainWindowTools::selectAsCurrentItem( curve ); - RiuPlotMainWindowTools::showPlotMainWindow(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicNewFractureModelPlotFeature::createStressTrack( RimFractureModelPlot* plot, - RimFractureModel* fractureModel, - RimEclipseCase* eclipseCase, - int timeStep, - const QString& trackName, - const std::vector& propertyTypes ) -{ - RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, trackName, plot ); - plotTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR ); - plotTrack->setLogarithmicScale( false ); - plotTrack->setShowRegionLabels( true ); - plotTrack->setShowWindow( true ); - plotTrack->setColSpan( RimPlot::TWO ); - plotTrack->setLegendsVisible( true ); - plotTrack->setPlotTitleVisible( true ); - - caf::ColorTable colors = RiaColorTables::wellLogPlotPaletteColors(); - int colorIndex = 0; - - for ( const RiaDefines::CurveProperty& propertyType : propertyTypes ) - { - RimFractureModelStressCurve* curve = new RimFractureModelStressCurve; - curve->setCurveProperty( propertyType ); - curve->setFractureModel( fractureModel ); - curve->setCase( eclipseCase ); - curve->setColor( colors.cycledColor3f( colorIndex ) ); - curve->setLineStyle( RiuQwtPlotCurve::STYLE_SOLID ); - curve->setLineThickness( 2 ); - curve->setUiName( trackName ); - curve->setAutoNameComponents( false, false, false, false, false ); - if ( propertyType == RiaDefines::CurveProperty::STRESS_GRADIENT ) - { - curve->setInterpolation( RiuQwtPlotCurve::INTERPOLATION_STEP_LEFT ); - } - - plotTrack->addCurve( curve ); - plotTrack->setAutoScaleXEnabled( true ); - curve->loadDataAndUpdate( true ); - - curve->updateConnectedEditors(); - - colorIndex++; - } - - plotTrack->updateConnectedEditors(); - plot->updateConnectedEditors(); - - RiaApplication::instance()->project()->updateConnectedEditors(); - - RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); - RiuPlotMainWindowTools::showPlotMainWindow(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.h b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.h index f3f00d2274..c686690f3c 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.h +++ b/ApplicationCode/Commands/CompletionCommands/RicNewFractureModelPlotFeature.h @@ -21,10 +21,7 @@ #include "cafCmdFeature.h" #include "RiaDefines.h" - -#include "RimElasticPropertiesCurve.h" -#include "RimFractureModelCurve.h" -#include "RimFractureModelStressCurve.h" +#include "RiaFractureModelDefines.h" class RimEclipseCase; class RimFractureModelPlot; @@ -61,20 +58,7 @@ private: int timeStep, const QString& trackTitle, const std::vector& propertyTypes, - bool isPlotLogarithmic ); - - static void createElasticPropertiesTrack( RimFractureModelPlot* plot, - RimFractureModel* fractureModel, - RimEclipseCase* eclipseCase, - int timeStep, - RiaDefines::CurveProperty propertyType ); - - static void createStressTrack( RimFractureModelPlot* plot, - RimFractureModel* fractureModel, - RimEclipseCase* eclipseCase, - int timeStep, - const QString& trackName, - const std::vector& propertyTypes ); + bool isPlotLogarithmic = false ); static RimFractureModelPlot* createFractureModelPlot( bool showAfterCreation, const QString& plotDescription ); diff --git a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake index 95f54cbe76..fb7b5d3a4c 100644 --- a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake @@ -164,9 +164,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimFractureModelCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimElasticProperties.h ${CMAKE_CURRENT_LIST_DIR}/RimElasticPropertyScaling.h ${CMAKE_CURRENT_LIST_DIR}/RimElasticPropertyScalingCollection.h -${CMAKE_CURRENT_LIST_DIR}/RimElasticPropertiesCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimLayerCurve.h -${CMAKE_CURRENT_LIST_DIR}/RimFractureModelStressCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimAbstractPlotCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimFractureModelPropertyCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimFaciesProperties.h @@ -345,9 +343,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimFractureModelCurve.cpp ${CMAKE_CURRENT_LIST_DIR}/RimElasticProperties.cpp ${CMAKE_CURRENT_LIST_DIR}/RimElasticPropertyScaling.cpp ${CMAKE_CURRENT_LIST_DIR}/RimElasticPropertyScalingCollection.cpp -${CMAKE_CURRENT_LIST_DIR}/RimElasticPropertiesCurve.cpp ${CMAKE_CURRENT_LIST_DIR}/RimLayerCurve.cpp -${CMAKE_CURRENT_LIST_DIR}/RimFractureModelStressCurve.cpp ${CMAKE_CURRENT_LIST_DIR}/RimFaciesProperties.cpp ${CMAKE_CURRENT_LIST_DIR}/RimNonNetLayers.cpp ${CMAKE_CURRENT_LIST_DIR}/RimFractureModelCalculator.cpp diff --git a/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.cpp b/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.cpp deleted file mode 100644 index afe4098419..0000000000 --- a/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.cpp +++ /dev/null @@ -1,160 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2020- Equinor ASA -// -// ResInsight is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#include "RimElasticPropertiesCurve.h" - -#include "RigEclipseCaseData.h" - -#include "RimEclipseCase.h" -#include "RimEclipseResultDefinition.h" -#include "RimFractureModel.h" -#include "RimFractureModelCalculator.h" -#include "RimModeledWellPath.h" - -#include "RiaFractureDefines.h" - -CAF_PDM_SOURCE_INIT( RimElasticPropertiesCurve, "ElasticPropertiesCurve" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimElasticPropertiesCurve::RimElasticPropertiesCurve() -{ - CAF_PDM_InitObject( "Fracture Model Curve", "", "", "" ); - - CAF_PDM_InitFieldNoDefault( &m_fractureModel, "FractureModel", "Fracture Model", "", "", "" ); - m_fractureModel.uiCapability()->setUiTreeChildrenHidden( true ); - m_fractureModel.uiCapability()->setUiHidden( true ); - - CAF_PDM_InitFieldNoDefault( &m_curveProperty, "CurveProperty", "Curve Property", "", "", "" ); - m_curveProperty.uiCapability()->setUiHidden( true ); - - m_wellPath = nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimElasticPropertiesCurve::~RimElasticPropertiesCurve() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimElasticPropertiesCurve::setFractureModel( RimFractureModel* fractureModel ) -{ - m_fractureModel = fractureModel; - m_wellPath = fractureModel->thicknessDirectionWellPath(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimElasticPropertiesCurve::setEclipseResultCategory( RiaDefines::ResultCatType catType ) -{ - m_eclipseResultDefinition->setResultType( catType ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimElasticPropertiesCurve::setCurveProperty( RiaDefines::CurveProperty curveProperty ) -{ - m_curveProperty = curveProperty; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiaDefines::CurveProperty RimElasticPropertiesCurve::curveProperty() const -{ - return m_curveProperty(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimElasticPropertiesCurve::performDataExtraction( bool* isUsingPseudoLength ) -{ - std::vector values; - std::vector measuredDepthValues; - std::vector tvDepthValues; - double rkbDiff = 0.0; - - RiaDefines::DepthUnitType depthUnit = RiaDefines::DepthUnitType::UNIT_METER; - QString xUnits = RiaWellLogUnitTools::noUnitString(); - - *isUsingPseudoLength = false; - - RimEclipseCase* eclipseCase = dynamic_cast( m_case.value() ); - if ( eclipseCase && m_fractureModel ) - { - bool isOk = m_fractureModel->calculator()->extractCurveData( curveProperty(), - m_timeStep, - values, - measuredDepthValues, - tvDepthValues, - rkbDiff ); - if ( !isOk ) - { - return; - } - - RiaEclipseUnitTools::UnitSystem eclipseUnitsType = eclipseCase->eclipseCaseData()->unitsType(); - if ( eclipseUnitsType == RiaEclipseUnitTools::UnitSystem::UNITS_FIELD ) - { - // See https://github.com/OPM/ResInsight/issues/538 - - depthUnit = RiaDefines::DepthUnitType::UNIT_FEET; - } - } - - bool performDataSmoothing = false; - if ( !values.empty() && !measuredDepthValues.empty() ) - { - if ( tvDepthValues.empty() ) - { - this->setValuesAndDepths( values, - measuredDepthValues, - RiaDefines::DepthTypeEnum::MEASURED_DEPTH, - 0.0, - depthUnit, - !performDataSmoothing, - xUnits ); - } - else - { - this->setValuesWithMdAndTVD( values, - measuredDepthValues, - tvDepthValues, - rkbDiff, - depthUnit, - !performDataSmoothing, - xUnits ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimElasticPropertiesCurve::createCurveAutoName() -{ - return caf::AppEnum::uiText( m_curveProperty() ); -} diff --git a/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.h b/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.h deleted file mode 100644 index 6e9e6343b7..0000000000 --- a/ApplicationCode/ProjectDataModel/RimElasticPropertiesCurve.h +++ /dev/null @@ -1,84 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2020- Equinor ASA -// -// ResInsight is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "RimFractureModelPropertyCurve.h" -#include "RimWellLogExtractionCurve.h" - -#include "RiuQwtSymbol.h" - -#include "cafPdmField.h" -#include "cafPdmPtrField.h" - -#include - -class RimWellPath; -class RimWellMeasurement; -class RimFractureModel; -class RimColorLegend; - -//================================================================================================== -/// -//================================================================================================== -class RimElasticPropertiesCurve : public RimWellLogExtractionCurve, public RimFractureModelPropertyCurve -{ - CAF_PDM_HEADER_INIT; - -public: - RimElasticPropertiesCurve(); - ~RimElasticPropertiesCurve() override; - - void setFractureModel( RimFractureModel* fractureModel ); - - void setEclipseResultCategory( RiaDefines::ResultCatType catType ); - - void setCurveProperty( RiaDefines::CurveProperty ) override; - RiaDefines::CurveProperty curveProperty() const override; - -protected: - QString createCurveAutoName() override; - - void performDataExtraction( bool* isUsingPseudoLength ) override; - - static QString findFaciesName( const RimColorLegend& colorLegend, double value ); - static double findFaciesValue( const RimColorLegend& colorLegend, const QString& name ); - - static void addOverburden( std::vector& formationNames, - std::vector& formationValues, - std::vector& faciesValues, - std::vector& tvDepthValues, - std::vector& measuredDepthValues, - double overburdenHeight, - double defaultPoroValue, - const QString& formationName, - double faciesValue ); - - static void addUnderburden( std::vector& formationNames, - std::vector& formationValues, - std::vector& faciesValues, - std::vector& tvDepthValues, - std::vector& measuredDepthValues, - double overburdenHeight, - double defaultPoroValue, - const QString& formationName, - double faciesValue ); - - caf::PdmPtrField m_fractureModel; - caf::PdmField> m_curveProperty; -}; diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp b/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp index cd0d7eb48e..130afca4b0 100644 --- a/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimFractureModelCurve.cpp @@ -7,8 +7,8 @@ // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// ResInsight is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at @@ -177,3 +177,11 @@ void RimFractureModelCurve::performDataExtraction( bool* isUsingPseudoLength ) } } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimFractureModelCurve::createCurveAutoName() +{ + return caf::AppEnum::uiText( m_curveProperty() ); +} diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelCurve.h b/ApplicationCode/ProjectDataModel/RimFractureModelCurve.h index 42f219e4e9..5d4d9882c5 100644 --- a/ApplicationCode/ProjectDataModel/RimFractureModelCurve.h +++ b/ApplicationCode/ProjectDataModel/RimFractureModelCurve.h @@ -7,8 +7,8 @@ // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// ResInsight is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at @@ -51,6 +51,8 @@ protected: void performDataExtraction( bool* isUsingPseudoLength ) override; + QString createCurveAutoName(); + caf::PdmPtrField m_fractureModel; caf::PdmField> m_curveProperty; }; diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.cpp b/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.cpp deleted file mode 100644 index 31a74665c0..0000000000 --- a/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.cpp +++ /dev/null @@ -1,162 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2020- Equinor ASA -// -// ResInsight is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#include "RimFractureModelStressCurve.h" - -#include "RiaDefines.h" -#include "RiaFractureModelDefines.h" -#include "RigEclipseCaseData.h" -#include "RigEclipseWellLogExtractor.h" -#include "RigResultAccessorFactory.h" -#include "RigWellLogCurveData.h" -#include "RigWellPath.h" -#include "RigWellPathGeometryTools.h" - -#include "RimCase.h" -#include "RimEclipseCase.h" -#include "RimFractureModel.h" -#include "RimFractureModelCalculator.h" -#include "RimFractureModelPlot.h" -#include "RimModeledWellPath.h" -#include "RimWellLogFile.h" -#include "RimWellLogPlot.h" -#include "RimWellPath.h" -#include "RimWellPathCollection.h" -#include "RimWellPlotTools.h" - -#include "RiaLogging.h" - -#include "cafPdmUiTreeOrdering.h" - -CAF_PDM_SOURCE_INIT( RimFractureModelStressCurve, "RimFractureModelStressCurve" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimFractureModelStressCurve::RimFractureModelStressCurve() -{ - CAF_PDM_InitObject( "Fracture Model Curve", "", "", "" ); - - CAF_PDM_InitFieldNoDefault( &m_fractureModel, "FractureModel", "Fracture Model", "", "", "" ); - m_fractureModel.uiCapability()->setUiTreeChildrenHidden( true ); - m_fractureModel.uiCapability()->setUiHidden( true ); - - CAF_PDM_InitFieldNoDefault( &m_curveProperty, "CurveProperty", "Curve Property", "", "", "" ); - m_curveProperty.uiCapability()->setUiHidden( true ); - - m_wellPath = nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimFractureModelStressCurve::~RimFractureModelStressCurve() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimFractureModelStressCurve::setCurveProperty( RiaDefines::CurveProperty curveProperty ) -{ - m_curveProperty = curveProperty; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiaDefines::CurveProperty RimFractureModelStressCurve::curveProperty() const -{ - return m_curveProperty(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimFractureModelStressCurve::setFractureModel( RimFractureModel* fractureModel ) -{ - m_fractureModel = fractureModel; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimFractureModelStressCurve::performDataExtraction( bool* isUsingPseudoLength ) -{ - std::vector values; - std::vector measuredDepthValues; - std::vector tvDepthValues; - double rkbDiff = 0.0; - - RiaDefines::DepthUnitType depthUnit = RiaDefines::DepthUnitType::UNIT_METER; - QString xUnits = RiaWellLogUnitTools::noUnitString(); - - *isUsingPseudoLength = false; - - bool isOk = m_fractureModel->calculator()->extractCurveData( curveProperty(), - m_fractureModel->timeStep(), - values, - measuredDepthValues, - tvDepthValues, - rkbDiff ); - if ( !isOk ) - { - return; - } - - RimEclipseCase* eclipseCase = m_fractureModel->eclipseCase(); - if ( eclipseCase && eclipseCase->eclipseCaseData()->unitsType() == RiaEclipseUnitTools::UnitSystem::UNITS_FIELD ) - { - // See https://github.com/OPM/ResInsight/issues/538 - - depthUnit = RiaDefines::DepthUnitType::UNIT_FEET; - } - - bool performDataSmoothing = false; - if ( !values.empty() && !measuredDepthValues.empty() ) - { - if ( tvDepthValues.empty() ) - { - this->setValuesAndDepths( values, - measuredDepthValues, - RiaDefines::DepthTypeEnum::MEASURED_DEPTH, - 0.0, - depthUnit, - !performDataSmoothing, - xUnits ); - } - else - { - this->setValuesWithMdAndTVD( values, - measuredDepthValues, - tvDepthValues, - rkbDiff, - depthUnit, - !performDataSmoothing, - xUnits ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimFractureModelStressCurve::createCurveAutoName() -{ - return caf::AppEnum::uiText( m_curveProperty() ); -} diff --git a/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.h b/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.h deleted file mode 100644 index 4c48b848e0..0000000000 --- a/ApplicationCode/ProjectDataModel/RimFractureModelStressCurve.h +++ /dev/null @@ -1,63 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2020- Equinor ASA -// -// ResInsight is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "RimFractureModelPropertyCurve.h" -#include "RimWellLogExtractionCurve.h" - -#include "RiuQwtSymbol.h" - -#include "cafPdmField.h" -#include "cafPdmPtrField.h" - -#include - -class RimWellPath; -class RimWellMeasurement; -class RimFractureModel; -class RimColorLegend; - -//================================================================================================== -/// -//================================================================================================== -class RimFractureModelStressCurve : public RimWellLogExtractionCurve, public RimFractureModelPropertyCurve -{ - CAF_PDM_HEADER_INIT; - -public: - RimFractureModelStressCurve(); - ~RimFractureModelStressCurve() override; - - void setFractureModel( RimFractureModel* fractureModel ); - - void setCurveProperty( RiaDefines::CurveProperty ) override; - RiaDefines::CurveProperty curveProperty() const override; - -protected: - QString createCurveAutoName() override; - - void performDataExtraction( bool* isUsingPseudoLength ) override; - - static void addDatapointsForBottomOfLayers( std::vector& tvDepthValues, - std::vector& stress, - const std::vector& stressGradients ); - - caf::PdmPtrField m_fractureModel; - caf::PdmField> m_curveProperty; -}; diff --git a/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp b/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp index c5aca6a8e5..bf7c6e22a1 100644 --- a/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimLayerCurve.cpp @@ -74,9 +74,10 @@ void RimLayerCurve::performDataExtraction( bool* isUsingPseudoLength ) *isUsingPseudoLength = false; - RimEclipseCase* eclipseCase = dynamic_cast( m_case.value() ); - if ( eclipseCase && m_fractureModel ) + if ( m_fractureModel && m_fractureModel->eclipseCase() ) { + RimEclipseCase* eclipseCase = m_fractureModel->eclipseCase(); + bool isOk = m_fractureModel->calculator()->extractCurveData( curveProperty(), m_timeStep, values,