diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp index 0d5b74c3bf..df762c7b5d 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp @@ -166,7 +166,7 @@ void RicNewWellBoreStabilityPlotFeature::createFormationTrack( RimWellBoreStabil RimWellLogTrack* formationTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Formations", plot ); formationTrack->setFormationWellPath( wellPath ); formationTrack->setFormationCase( geoMechCase ); - formationTrack->setShowFormations( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES ); + formationTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS ); formationTrack->setVisibleXRange( 0.0, 0.0 ); formationTrack->setWidthScaleFactor( RimWellLogTrack::NARROW_TRACK ); } @@ -182,8 +182,9 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabi casingShoeTrack->setWidthScaleFactor( RimWellLogTrack::NARROW_TRACK ); casingShoeTrack->setFormationWellPath( wellPath ); casingShoeTrack->setFormationCase( geoMechCase ); - casingShoeTrack->setShowFormations( RiuPlotAnnotationTool::DARK_LINES ); - casingShoeTrack->setShowFormationLabels( false ); + casingShoeTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS ); + casingShoeTrack->setAnnotationDisplay( RiuPlotAnnotationTool::DARK_LINES ); + casingShoeTrack->setShowRegionLabels( false ); casingShoeTrack->setShowWellPathAttributes( true ); casingShoeTrack->setWellPathAttributesSource( wellPath ); casingShoeTrack->setVisibleXRange( 0.0, 0.0 ); @@ -207,16 +208,17 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); stabilityCurvesTrack->setFormationWellPath( wellPath ); stabilityCurvesTrack->setFormationCase( geoMechView->geoMechCase() ); - stabilityCurvesTrack->setShowFormations( RiuPlotAnnotationTool::NONE ); - stabilityCurvesTrack->setShowFormationLabels( false ); + stabilityCurvesTrack->setAnnotationType( RiuPlotAnnotationTool::CURVE_ANNOTATIONS ); + stabilityCurvesTrack->setShowRegionLabels( true ); std::vector resultNames = RiaDefines::wellPathStabilityResultNames(); - std::vector colors = {cvf::Color3f::RED, + std::vector colors = {cvf::Color3f::RED, cvf::Color3f::PURPLE, cvf::Color3f::GREEN, cvf::Color3f::BLUE, cvf::Color3f::ORANGE}; + std::vector lineStyles = {RiuQwtPlotCurve::STYLE_SOLID, RiuQwtPlotCurve::STYLE_DASH, RiuQwtPlotCurve::STYLE_DASH_DOT, @@ -298,6 +300,6 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); wellPathAnglesTrack->setFormationWellPath( wellPath ); wellPathAnglesTrack->setFormationCase( geoMechView->geoMechCase() ); - wellPathAnglesTrack->setShowFormations( RiuPlotAnnotationTool::NONE ); - wellPathAnglesTrack->setShowFormationLabels( false ); + wellPathAnglesTrack->setAnnotationType( RiuPlotAnnotationTool::NO_ANNOTATIONS ); + wellPathAnglesTrack->setShowRegionLabels( false ); } diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp index 6ff2a2eb67..780ab8076d 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp @@ -224,6 +224,7 @@ void RicNewWellLogPlotFeatureImpl::updateAfterCreation( RimWellLogPlot* plot ) plot->loadDataAndUpdate(); plot->updateDepthZoom(); plot->updateConnectedEditors(); + plot->updateTracks(); RiaApplication::instance()->project()->updateConnectedEditors(); } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index 2f4a0f4d4a..e2aaf6ed65 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -1097,7 +1097,7 @@ void RimWellPltPlot::onLoadDataAndUpdate() { if ( trackCount() > 0 ) { - trackByIndex( 0 )->setShowFormations( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES ); + trackByIndex( 0 )->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS ); } m_isOnLoad = false; } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index ae0d6362a2..ee3e9dcfce 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -936,7 +936,7 @@ void RimWellRftPlot::onLoadDataAndUpdate() { if ( trackCount() > 0 ) { - trackByIndex( 0 )->setShowFormations( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES ); + trackByIndex( 0 )->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS ); } m_isOnLoad = false; diff --git a/ApplicationCode/ProjectDataModel/RimWellBoreStabilityPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellBoreStabilityPlot.cpp index 31ad6869a4..769a50d2f4 100644 --- a/ApplicationCode/ProjectDataModel/RimWellBoreStabilityPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellBoreStabilityPlot.cpp @@ -121,6 +121,8 @@ double RimWellBoreStabilityPlot::userDefinedUcs() const //-------------------------------------------------------------------------------------------------- void RimWellBoreStabilityPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { + m_commonDataSource->uiOrdering( uiConfigName, uiOrdering ); + caf::PdmUiGroup* parameterSources = uiOrdering.addNewGroup( "Parameter Sources" ); parameterSources->add( &m_porePressureSource ); parameterSources->add( &m_poissonRatioSource ); @@ -131,7 +133,11 @@ void RimWellBoreStabilityPlot::defineUiOrdering( QString uiConfigName, caf::PdmU m_userDefinedPoissionRatio.uiCapability()->setUiReadOnly( m_poissonRatioSource() != RigGeoMechWellLogExtractor::USER_DEFINED ); m_userDefinedUcs.uiCapability()->setUiReadOnly( m_ucsSource() != RigGeoMechWellLogExtractor::USER_DEFINED ); - RimWellLogPlot::defineUiOrdering( uiConfigName, uiOrdering ); + + uiOrderingForDepthAxis( uiOrdering ); + uiOrderingForPlotSettings( uiOrdering ); + + uiOrdering.skipRemainingFields( true ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellLogCurveCommonDataSource.cpp b/ApplicationCode/ProjectDataModel/RimWellLogCurveCommonDataSource.cpp index 16bbb7e36b..f34a172c14 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogCurveCommonDataSource.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogCurveCommonDataSource.cpp @@ -200,6 +200,7 @@ void RimWellLogCurveCommonDataSource::resetDefaultOptions() m_uniqueWellNames.clear(); m_uniqueTimeSteps.clear(); m_uniqueBranchIndices.clear(); + m_uniqueBranchDetection.clear(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index 34b3749d41..e3127ae609 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -225,7 +225,7 @@ void RimWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view ) } else if ( geomCase ) { - m_geomResultDefinition->setResultAddress( RigFemResultAddress( RIG_ELEMENT, "POR", "" ) ); + m_geomResultDefinition->setResultAddress( RigFemResultAddress( RIG_NODAL, "POR-Bar", "" ) ); } clearGeneratedSimWellPaths(); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index 1b1bd34e3c..9f3fd695e6 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -211,7 +211,6 @@ void RimWellLogPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, changedField == &m_depthAxisGridVisibility ) { updateTracks(); - if ( m_viewer ) m_viewer->updateChildrenLayout(); } else if ( changedField == &m_showTitleInPlot ) { @@ -687,7 +686,7 @@ QString RimWellLogPlot::createAutoName() const //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::performAutoNameUpdate() { - this->m_commonDataSource->updateDefaultOptions(); + updateCommonDataSource(); this->updatePlotTitle(); } @@ -742,6 +741,14 @@ RimWellLogCurveCommonDataSource* RimWellLogPlot::commonDataSource() const return m_commonDataSource; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogPlot::updateCommonDataSource() +{ + m_commonDataSource->updateDefaultOptions(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -817,6 +824,7 @@ void RimWellLogPlot::updateTracks( bool autoScaleXAxis ) calculateAvailableDepthRange(); applyDepthZoomFromVisibleDepth(); + if ( m_viewer ) m_viewer->updateChildrenLayout(); } } @@ -948,7 +956,7 @@ void RimWellLogPlot::deleteViewWidget() //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::initAfterRead() { - m_commonDataSource->updateDefaultOptions(); + updateCommonDataSource(); if ( !m_userName_OBSOLETE().isEmpty() ) { m_nameConfig->setCustomName( m_userName_OBSOLETE() ); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h index 7025f4fbf6..ac52b68a78 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h @@ -131,6 +131,7 @@ public: void handleKeyPressEvent( QKeyEvent* keyEvent ); RimWellLogCurveCommonDataSource* commonDataSource() const; + void updateCommonDataSource(); void setAvailableDepthUnits( const std::set& depthUnits ); void setAvailableDepthTypes( const std::set& depthTypes ); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index 2d1082b686..080f0eb2fd 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -51,8 +51,11 @@ #include "RimPerforationInterval.h" #include "RimProject.h" #include "RimTools.h" +#include "RimWellBoreStabilityPlot.h" #include "RimWellFlowRateCurve.h" #include "RimWellLogCurve.h" +#include "RimWellLogCurveCommonDataSource.h" +#include "RimWellLogExtractionCurve.h" #include "RimWellLogPlotCollection.h" #include "RimWellPath.h" #include "RimWellPathAttribute.h" @@ -131,14 +134,22 @@ void AppEnum::setUp() } template <> -void AppEnum::setUp() +void AppEnum::setUp() +{ + addItem( RiuPlotAnnotationTool::NO_ANNOTATIONS, "NO_ANNOTATIONS", "No Annotations" ); + addItem( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS, "FORMATIONS", "Formations" ); + addItem( RiuPlotAnnotationTool::CURVE_ANNOTATIONS, "CURVE_DATA", "Curve Data Annotations" ); + setDefault( RiuPlotAnnotationTool::NO_ANNOTATIONS ); +} + +template <> +void AppEnum::setUp() { - addItem( RiuPlotAnnotationTool::NONE, "NONE", "None" ); addItem( RiuPlotAnnotationTool::DARK_LINES, "DARK_LINES", "Dark Lines" ); addItem( RiuPlotAnnotationTool::COLORED_LINES, "COLORED_LINES", "Colored Lines" ); addItem( RiuPlotAnnotationTool::COLOR_SHADING, "COLOR_SHADING", "Color Shading" ); addItem( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES, "SHADING_AND_LINES", "Color Shading and Lines" ); - setDefault( RiuPlotAnnotationTool::NONE ); + setDefault( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES ); } } // namespace caf @@ -175,7 +186,8 @@ RimWellLogTrack::RimWellLogTrack() m_majorTickInterval.uiCapability()->setUiHidden( true ); m_minorTickInterval.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_formationDisplay, "FormationDisplay", "Show Formations", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_regionAnnotationType, "AnnotationType", "Region Annotations", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_regionAnnotationDisplay, "RegionDisplay", "Region Display", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_colorShadingPalette, "ColorShadingPalette", "Colors", "", "", "" ); m_colorShadingPalette = RimRegularLegendConfig::CATEGORY; @@ -185,7 +197,7 @@ RimWellLogTrack::RimWellLogTrack() CAF_PDM_InitField( &m_showFormations_OBSOLETE, "ShowFormations", false, "Show Lines", "", "", "" ); m_showFormations_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_showFormationLabels, "ShowFormationLabels", true, "Show Labels", "", "", "" ); + CAF_PDM_InitField( &m_showRegionLabels, "ShowFormationLabels", true, "Show Labels", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_formationSource, "FormationSource", "Source", "", "", "" ); @@ -372,8 +384,9 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField, m_wellLogTrackPlotWidget->replot(); } - else if ( changedField == &m_formationDisplay || changedField == &m_formationSource || - changedField == &m_colorShadingTransparency || changedField == &m_colorShadingPalette ) + else if ( changedField == &m_regionAnnotationType || changedField == &m_regionAnnotationDisplay || + changedField == &m_formationSource || changedField == &m_colorShadingTransparency || + changedField == &m_colorShadingPalette ) { if ( changedField == &m_formationSource && m_formationSource == WELL_PICK_FILTER ) { @@ -410,7 +423,7 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField, } } } - else if ( changedField == &m_showFormationLabels ) + else if ( changedField == &m_showRegionLabels ) { loadDataAndUpdate(); } @@ -598,6 +611,23 @@ QList RimWellLogTrack::calculateValueOptions( const caf: if ( options.size() > 0 ) return options; + if ( fieldNeedingOptions == &m_regionAnnotationType ) + { + options.push_back( + caf::PdmOptionItemInfo( RegionAnnotationTypeEnum::uiText( RiuPlotAnnotationTool::NO_ANNOTATIONS ), + RiuPlotAnnotationTool::NO_ANNOTATIONS ) ); + options.push_back( + caf::PdmOptionItemInfo( RegionAnnotationTypeEnum::uiText( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS ), + RiuPlotAnnotationTool::FORMATION_ANNOTATIONS ) ); + RimWellBoreStabilityPlot* wellBoreStabilityPlot = nullptr; + this->firstAncestorOrThisOfTypeAsserted( wellBoreStabilityPlot ); + if ( wellBoreStabilityPlot ) + { + options.push_back( + caf::PdmOptionItemInfo( RegionAnnotationTypeEnum::uiText( RiuPlotAnnotationTool::CURVE_ANNOTATIONS ), + RiuPlotAnnotationTool::CURVE_ANNOTATIONS ) ); + } + } if ( fieldNeedingOptions == &m_formationWellPathForSourceCase ) { RimTools::wellPathOptionItems( &options ); @@ -821,14 +851,17 @@ void RimWellLogTrack::loadDataAndUpdate( bool updateParentPlotAndToolbars ) curves[cIdx]->loadDataAndUpdate( false ); } - if ( m_formationDisplay == RiuPlotAnnotationTool::NONE ) - { - setFormationFieldsUiReadOnly( true ); - } - else + if ( m_regionAnnotationType == RiuPlotAnnotationTool::FORMATION_ANNOTATIONS ) { setFormationFieldsUiReadOnly( false ); } + else + { + setFormationFieldsUiReadOnly( true ); + } + bool noAnnotations = m_regionAnnotationType() == RiuPlotAnnotationTool::NO_ANNOTATIONS; + m_regionAnnotationDisplay.uiCapability()->setUiReadOnly( noAnnotations ); + m_showRegionLabels.uiCapability()->setUiReadOnly( noAnnotations ); if ( m_wellLogTrackPlotWidget ) { @@ -837,7 +870,7 @@ void RimWellLogTrack::loadDataAndUpdate( bool updateParentPlotAndToolbars ) m_wellLogTrackPlotWidget->updateLegend(); this->updateAxisScaleEngine(); - this->updateFormationNamesOnPlot(); + this->updateRegionAnnotationsOnPlot(); this->applyXZoomFromVisibleRange(); } @@ -872,9 +905,9 @@ void RimWellLogTrack::setAndUpdateWellPathFormationNamesData( RimCase* rimCase, updateConnectedEditors(); - if ( m_formationDisplay != RiuPlotAnnotationTool::NONE ) + if ( m_regionAnnotationType != RiuPlotAnnotationTool::NO_ANNOTATIONS ) { - updateFormationNamesOnPlot(); + updateRegionAnnotationsOnPlot(); } } @@ -904,9 +937,9 @@ void RimWellLogTrack::setAndUpdateSimWellFormationNamesData( RimCase* rimCase, c updateConnectedEditors(); - if ( m_formationDisplay != RiuPlotAnnotationTool::NONE ) + if ( m_regionAnnotationType != RiuPlotAnnotationTool::NO_ANNOTATIONS ) { - updateFormationNamesOnPlot(); + updateRegionAnnotationsOnPlot(); } } @@ -1279,9 +1312,33 @@ void RimWellLogTrack::setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::setShowFormations( RiuPlotAnnotationTool::FormationDisplay formationDisplay ) +void RimWellLogTrack::setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType annotationType ) { - m_formationDisplay = formationDisplay; + m_regionAnnotationType = annotationType; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::setAnnotationDisplay( RiuPlotAnnotationTool::RegionDisplay annotationDisplay ) +{ + m_regionAnnotationDisplay = annotationDisplay; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAnnotationTool::RegionAnnotationType RimWellLogTrack::annotationType() const +{ + return m_regionAnnotationType(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAnnotationTool::RegionDisplay RimWellLogTrack::annotationDisplay() const +{ + return m_regionAnnotationDisplay(); } //-------------------------------------------------------------------------------------------------- @@ -1289,15 +1346,15 @@ void RimWellLogTrack::setShowFormations( RiuPlotAnnotationTool::FormationDisplay //-------------------------------------------------------------------------------------------------- bool RimWellLogTrack::showFormations() const { - return m_formationDisplay() != RiuPlotAnnotationTool::NONE; + return m_regionAnnotationType() == RiuPlotAnnotationTool::FORMATION_ANNOTATIONS; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::setShowFormationLabels( bool on ) +void RimWellLogTrack::setShowRegionLabels( bool on ) { - m_showFormationLabels = on; + m_showRegionLabels = on; } //-------------------------------------------------------------------------------------------------- @@ -1357,17 +1414,19 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering uiOrdering.add( &m_userName ); caf::PdmUiGroup* annotationGroup = uiOrdering.addNewGroup( "Regions/Annotations" ); - annotationGroup->add( &m_formationDisplay ); - if ( m_formationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING || - m_formationDisplay() & RiuPlotAnnotationTool::COLORED_LINES ) + annotationGroup->add( &m_regionAnnotationType ); + annotationGroup->add( &m_regionAnnotationDisplay ); + annotationGroup->add( &m_showRegionLabels ); + + if ( m_regionAnnotationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING || + m_regionAnnotationDisplay() & RiuPlotAnnotationTool::COLORED_LINES ) { annotationGroup->add( &m_colorShadingPalette ); - if ( m_formationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING ) + if ( m_regionAnnotationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING ) { annotationGroup->add( &m_colorShadingTransparency ); } } - annotationGroup->add( &m_showFormationLabels ); if ( !m_formationsForCaseWithSimWellOnly ) { @@ -1435,9 +1494,9 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::initAfterRead() { - if ( m_showFormations_OBSOLETE() && m_formationDisplay() == RiuPlotAnnotationTool::NONE ) + if ( m_showFormations_OBSOLETE() && m_regionAnnotationType() == RiuPlotAnnotationTool::NO_ANNOTATIONS ) { - m_formationDisplay = RiuPlotAnnotationTool::COLORED_LINES; + m_regionAnnotationType = RiuPlotAnnotationTool::FORMATION_ANNOTATIONS; } } @@ -1623,7 +1682,8 @@ void RimWellLogTrack::uiOrderingForRftPltFormations( caf::PdmUiOrdering& uiOrder { caf::PdmUiGroup* formationGroup = uiOrdering.addNewGroup( "Zonation/Formation Names" ); formationGroup->setCollapsedByDefault( true ); - formationGroup->add( &m_formationDisplay ); + formationGroup->add( &m_regionAnnotationType ); + formationGroup->add( &m_regionAnnotationDisplay ); formationGroup->add( &m_formationSource ); if ( m_formationSource == CASE ) { @@ -1726,29 +1786,29 @@ CurveSamplingPointData RimWellLogTrack::curveSamplingPointData( RigGeoMechWellLo //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::findFormationNamesToPlot( const CurveSamplingPointData& curveData, - const std::vector& formationNamesVector, - RimWellLogPlot::DepthTypeEnum depthType, - std::vector* formationNamesToPlot, - std::vector>* yValues ) +void RimWellLogTrack::findRegionNamesToPlot( const CurveSamplingPointData& curveData, + const std::vector& regionNamesVector, + RimWellLogPlot::DepthTypeEnum depthType, + std::vector* regionNamesToPlot, + std::vector>* yValues ) { - if ( formationNamesVector.empty() ) return; + if ( regionNamesVector.empty() ) return; - std::vector formationNameIndicesFromCurve; + std::vector regionNameIndicesFromCurve; for ( double nameIdx : curveData.data ) { if ( nameIdx != std::numeric_limits::infinity() ) { - formationNameIndicesFromCurve.push_back( static_cast( round( nameIdx ) ) ); + regionNameIndicesFromCurve.push_back( static_cast( round( nameIdx ) ) ); } else { - formationNameIndicesFromCurve.push_back( std::numeric_limits::max() ); + regionNameIndicesFromCurve.push_back( std::numeric_limits::max() ); } } - if ( formationNameIndicesFromCurve.empty() ) return; + if ( regionNameIndicesFromCurve.empty() ) return; std::vector depthVector; @@ -1764,17 +1824,17 @@ void RimWellLogTrack::findFormationNamesToPlot( const CurveSamplingPointData& if ( depthVector.empty() ) return; double currentYStart = depthVector[0]; - size_t prevNameIndex = formationNameIndicesFromCurve[0]; + size_t prevNameIndex = regionNameIndicesFromCurve[0]; size_t currentNameIndex; - for ( size_t i = 1; i < formationNameIndicesFromCurve.size(); i++ ) + for ( size_t i = 1; i < regionNameIndicesFromCurve.size(); i++ ) { - currentNameIndex = formationNameIndicesFromCurve[i]; + currentNameIndex = regionNameIndicesFromCurve[i]; if ( currentNameIndex != std::numeric_limits::max() && currentNameIndex != prevNameIndex ) { - if ( prevNameIndex < formationNamesVector.size() ) + if ( prevNameIndex < regionNamesVector.size() ) { - formationNamesToPlot->push_back( formationNamesVector[prevNameIndex] ); + regionNamesToPlot->push_back( regionNamesVector[prevNameIndex] ); yValues->push_back( std::make_pair( currentYStart, depthVector[i - 1] ) ); } @@ -1783,10 +1843,10 @@ void RimWellLogTrack::findFormationNamesToPlot( const CurveSamplingPointData& } } - size_t lastFormationIdx = formationNameIndicesFromCurve.back(); - if ( lastFormationIdx < formationNamesVector.size() ) + size_t lastFormationIdx = regionNameIndicesFromCurve.back(); + if ( lastFormationIdx < regionNamesVector.size() ) { - formationNamesToPlot->push_back( formationNamesVector[lastFormationIdx] ); + regionNamesToPlot->push_back( regionNamesVector[lastFormationIdx] ); yValues->push_back( std::make_pair( currentYStart, depthVector.back() ) ); } } @@ -1822,7 +1882,6 @@ std::vector RimWellLogTrack::formationNamesVector( RimCase* rimCase ) //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::setFormationFieldsUiReadOnly( bool readOnly /*= true*/ ) { - m_showFormationLabels.uiCapability()->setUiReadOnly( readOnly ); m_formationSource.uiCapability()->setUiReadOnly( readOnly ); m_formationTrajectoryType.uiCapability()->setUiReadOnly( readOnly ); m_formationSimWellName.uiCapability()->setUiReadOnly( readOnly ); @@ -1838,17 +1897,32 @@ void RimWellLogTrack::setFormationFieldsUiReadOnly( bool readOnly /*= true*/ ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::updateFormationNamesOnPlot() +void RimWellLogTrack::updateRegionAnnotationsOnPlot() { - removeFormationNames(); + removeRegionAnnotations(); - if ( m_formationDisplay == RiuPlotAnnotationTool::NONE ) return; + if ( m_regionAnnotationType == RiuPlotAnnotationTool::NO_ANNOTATIONS ) return; if ( m_annotationTool == nullptr ) { m_annotationTool = std::unique_ptr( new RiuPlotAnnotationTool() ); } + if ( m_regionAnnotationType == RiuPlotAnnotationTool::FORMATION_ANNOTATIONS ) + { + updateFormationNamesOnPlot(); + } + else + { + updateCurveDataRegionsOnPlot(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::updateFormationNamesOnPlot() +{ std::vector formationNamesToPlot; RimWellLogPlot* plot = nullptr; @@ -1915,24 +1989,24 @@ void RimWellLogTrack::updateFormationNamesOnPlot() std::vector> yValues; std::vector formationNamesVector = RimWellLogTrack::formationNamesVector( m_formationCase ); - RimWellLogTrack::findFormationNamesToPlot( curveData, - formationNamesVector, - plot->depthType(), - &formationNamesToPlot, - &yValues ); + RimWellLogTrack::findRegionNamesToPlot( curveData, + formationNamesVector, + plot->depthType(), + &formationNamesToPlot, + &yValues ); std::pair xRange = std::make_pair( m_visibleXRangeMin(), m_visibleXRangeMax() ); caf::ColorTable colorTable( RimRegularLegendConfig::colorArrayFromColorType( m_colorShadingPalette() ) ); - m_annotationTool->attachFormationNames( this->viewer(), - formationNamesToPlot, - xRange, - yValues, - m_formationDisplay(), - colorTable, - ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100, - m_showFormationLabels() ); + m_annotationTool->attachNamedRegions( this->viewer(), + formationNamesToPlot, + xRange, + yValues, + m_regionAnnotationDisplay(), + colorTable, + ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100, + m_showRegionLabels() ); } else if ( m_formationSource() == WELL_PICK_FILTER ) { @@ -1959,6 +2033,136 @@ void RimWellLogTrack::updateFormationNamesOnPlot() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::updateCurveDataRegionsOnPlot() +{ + RimWellBoreStabilityPlot* wellBoreStabilityPlot = nullptr; + this->firstAncestorOrThisOfType( wellBoreStabilityPlot ); + if ( wellBoreStabilityPlot ) + { + wellBoreStabilityPlot->updateCommonDataSource(); + RimGeoMechCase* geoMechCase = dynamic_cast( + wellBoreStabilityPlot->commonDataSource()->caseToApply() ); + RimWellPath* wellPath = wellBoreStabilityPlot->commonDataSource()->wellPathToApply(); + int timeStep = wellBoreStabilityPlot->commonDataSource()->timeStepToApply(); + if ( geoMechCase && wellPath && timeStep >= 0 ) + { + RigGeoMechWellLogExtractor* geoMechWellLogExtractor = nullptr; + geoMechWellLogExtractor = RiaExtractionTools::wellLogExtractorGeoMechCase( wellPath, + dynamic_cast( + geoMechCase ) ); + if ( !geoMechWellLogExtractor ) return; + + std::pair xRange = std::make_pair( m_visibleXRangeMin(), m_visibleXRangeMax() ); + + CurveSamplingPointData curveData; + curveData.md = geoMechWellLogExtractor->cellIntersectionMDs(); + curveData.tvd = geoMechWellLogExtractor->cellIntersectionTVDs(); + + RimWellLogExtractionCurve::findAndLoadWbsParametersFromLasFiles( wellPath, geoMechWellLogExtractor ); + RimWellBoreStabilityPlot* wbsPlot; + this->firstAncestorOrThisOfType( wbsPlot ); + if ( wbsPlot ) + { + geoMechWellLogExtractor->setWbsParameters( wbsPlot->porePressureSource(), + wbsPlot->poissonRatioSource(), + wbsPlot->ucsSource(), + wbsPlot->userDefinedPoissonRatio(), + wbsPlot->userDefinedUcs() ); + } + + std::vector ppValues = geoMechWellLogExtractor->porePressureIntervals( timeStep ); + std::vector poissonValues = geoMechWellLogExtractor->poissonIntervals( timeStep ); + std::vector ucsValues = geoMechWellLogExtractor->ucsIntervals( timeStep ); + + { + caf::ColorTable colorTable( RimRegularLegendConfig::colorArrayFromColorType( m_colorShadingPalette() ) ); + + std::vector sourceNames = + {"", "PP=Grid", "PP=Las-File", "PP=Element Property Table", "", "PP=Hydrostatic"}; + curveData.data = ppValues; + + std::vector sourceNamesToPlot; + std::vector> yValues; + RimWellLogTrack::findRegionNamesToPlot( curveData, + sourceNames, + wellBoreStabilityPlot->depthType(), + &sourceNamesToPlot, + &yValues ); + m_annotationTool->attachNamedRegions( this->viewer(), + sourceNamesToPlot, + xRange, + yValues, + m_regionAnnotationDisplay(), + colorTable, + ( ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100 ) / 3, + m_showRegionLabels(), + RiuPlotAnnotationTool::LEFT_COLUMN ); + } + { + caf::ColorTable colorTable( RimRegularLegendConfig::colorArrayFromColorType( m_colorShadingPalette() ) ); + + std::vector sourceNames = + {"", + "", + "Poisson=Las-File", + "Poisson=Element Property Table", + QString( "Poisson=%1" ).arg( wellBoreStabilityPlot->userDefinedPoissonRatio() ), + ""}; + curveData.data = poissonValues; + + std::vector sourceNamesToPlot; + std::vector> yValues; + RimWellLogTrack::findRegionNamesToPlot( curveData, + sourceNames, + wellBoreStabilityPlot->depthType(), + &sourceNamesToPlot, + &yValues ); + m_annotationTool->attachNamedRegions( this->viewer(), + sourceNamesToPlot, + xRange, + yValues, + m_regionAnnotationDisplay(), + colorTable, + ( ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100 ) / 3, + m_showRegionLabels(), + RiuPlotAnnotationTool::CENTRE_COLUMN ); + } + { + caf::ColorTable colorTable( RimRegularLegendConfig::colorArrayFromColorType( m_colorShadingPalette() ) ); + + std::vector sourceNames = {"", + "", + "UCS=Las-File", + "UCS=Element Property Table", + QString( "UCS=%1" ).arg( wellBoreStabilityPlot->userDefinedUcs() ), + ""}; + + curveData.data = ucsValues; + + std::vector sourceNamesToPlot; + std::vector> yValues; + RimWellLogTrack::findRegionNamesToPlot( curveData, + sourceNames, + wellBoreStabilityPlot->depthType(), + &sourceNamesToPlot, + &yValues ); + m_annotationTool->attachNamedRegions( this->viewer(), + sourceNamesToPlot, + xRange, + yValues, + m_regionAnnotationDisplay(), + colorTable, + ( ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100 ) / 3, + m_showRegionLabels(), + RiuPlotAnnotationTool::RIGHT_COLUMN ); + } + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -2053,7 +2257,7 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::removeFormationNames() +void RimWellLogTrack::removeRegionAnnotations() { if ( m_annotationTool ) { diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h index 76b2d1fbc5..7c0fd1ec08 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h @@ -91,6 +91,9 @@ public: EXTRA_WIDE_TRACK = 10 }; + typedef caf::AppEnum RegionAnnotationTypeEnum; + typedef caf::AppEnum RegionAnnotationDisplayEnum; + void setDescription( const QString& description ); bool isVisible(); void addCurve( RimWellLogCurve* curve ); @@ -103,6 +106,7 @@ public: { return curves.size(); } + void setXAxisTitle( const QString& text ); QString depthPlotTitle() const; int widthScaleFactor() const; @@ -145,9 +149,16 @@ public: void setVisibleXRange( double minValue, double maxValue ); void setTickIntervals( double majorTickInterval, double minorTickInterval ); void setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility gridLines ); - void setShowFormations( RiuPlotAnnotationTool::FormationDisplay formationDisplay ); + + void setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType annotationType ); + void setAnnotationDisplay( RiuPlotAnnotationTool::RegionDisplay annotationDisplay ); + + RiuPlotAnnotationTool::RegionAnnotationType annotationType() const; + RiuPlotAnnotationTool::RegionDisplay annotationDisplay() const; + bool showFormations() const; - void setShowFormationLabels( bool on ); + + void setShowRegionLabels( bool on ); bool showWellPathAttributes() const; void setShowWellPathAttributes( bool on ); @@ -204,19 +215,21 @@ private: static CurveSamplingPointData curveSamplingPointData( RigGeoMechWellLogExtractor* extractor, const RigFemResultAddress& resultAddress ); - static void findFormationNamesToPlot( const CurveSamplingPointData& curveData, - const std::vector& formationNamesVector, - RimWellLogPlot::DepthTypeEnum depthType, - std::vector* formationNamesToPlot, - std::vector>* yValues ); + static void findRegionNamesToPlot( const CurveSamplingPointData& curveData, + const std::vector& formationNamesVector, + RimWellLogPlot::DepthTypeEnum depthType, + std::vector* formationNamesToPlot, + std::vector>* yValues ); static std::vector formationNamesVector( RimCase* rimCase ); void setFormationFieldsUiReadOnly( bool readOnly = true ); + void updateRegionAnnotationsOnPlot(); void updateFormationNamesOnPlot(); + void updateCurveDataRegionsOnPlot(); void updateWellPathAttributesOnPlot(); - void removeFormationNames(); + void removeRegionAnnotations(); void updateAxisScaleEngine(); bool isFirstVisibleTrackInPlot() const; @@ -239,29 +252,30 @@ private: caf::PdmField m_majorTickInterval; caf::PdmField m_minorTickInterval; - caf::PdmField> m_formationDisplay; - caf::PdmField m_colorShadingPalette; - caf::PdmField m_colorShadingTransparency; - caf::PdmField m_showFormationLabels; - caf::PdmField> m_formationSource; - caf::PdmPtrField m_formationCase; - caf::PdmField> m_formationTrajectoryType; - caf::PdmPtrField m_formationWellPathForSourceCase; - caf::PdmPtrField m_formationWellPathForSourceWellPath; - caf::PdmField m_formationSimWellName; - caf::PdmField m_formationBranchIndex; - caf::PdmField> m_formationLevel; - caf::PdmField m_showformationFluids; - caf::PdmField> m_widthScaleFactor; - caf::PdmField m_formationBranchDetection; - caf::PdmField m_showWellPathAttributes; - caf::PdmField m_showWellPathCompletions; - caf::PdmField m_showWellPathComponentsBothSides; - caf::PdmField m_showWellPathComponentLabels; - caf::PdmField m_wellPathAttributesInLegend; - caf::PdmField m_wellPathCompletionsInLegend; - caf::PdmPtrField m_wellPathComponentSource; - caf::PdmPtrField m_wellPathAttributeCollection; + caf::PdmField m_regionAnnotationType; + caf::PdmField m_regionAnnotationDisplay; + caf::PdmField m_colorShadingPalette; + caf::PdmField m_colorShadingTransparency; + caf::PdmField m_showRegionLabels; + caf::PdmField> m_formationSource; + caf::PdmPtrField m_formationCase; + caf::PdmField> m_formationTrajectoryType; + caf::PdmPtrField m_formationWellPathForSourceCase; + caf::PdmPtrField m_formationWellPathForSourceWellPath; + caf::PdmField m_formationSimWellName; + caf::PdmField m_formationBranchIndex; + caf::PdmField> m_formationLevel; + caf::PdmField m_showformationFluids; + caf::PdmField> m_widthScaleFactor; + caf::PdmField m_formationBranchDetection; + caf::PdmField m_showWellPathAttributes; + caf::PdmField m_showWellPathCompletions; + caf::PdmField m_showWellPathComponentsBothSides; + caf::PdmField m_showWellPathComponentLabels; + caf::PdmField m_wellPathAttributesInLegend; + caf::PdmField m_wellPathCompletionsInLegend; + caf::PdmPtrField m_wellPathComponentSource; + caf::PdmPtrField m_wellPathAttributeCollection; caf::PdmField m_showFormations_OBSOLETE; diff --git a/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp b/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp index e4087f5d87..36a1a4203f 100644 --- a/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp +++ b/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp @@ -575,6 +575,169 @@ void RigGeoMechWellLogExtractor::setWbsParameters( WbsParameterSource porePressu m_userDefinedUcs = userDefinedUcs; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigGeoMechWellLogExtractor::porePressureIntervals( int frameIndex ) +{ + std::vector ppValues( m_intersections.size(), 0.0 ); + + RigFemResultAddress porBarResAddr( RIG_ELEMENT_NODAL, "POR-Bar", "" ); + RigFemResultAddress porElementResAddr( RIG_ELEMENT, "POR", "" ); + + const RigFemPart* femPart = m_caseData->femParts()->part( 0 ); + RigFemPartResultsCollection* resultCollection = m_caseData->femPartResults(); + + std::vector porePressures = resultCollection->resultValues( porBarResAddr, 0, frameIndex ); + std::vector poreElementPressuresPascal = resultCollection->resultValues( porElementResAddr, 0, frameIndex ); + + std::vector interpolatedInterfacePorePressureBar; + interpolatedInterfacePorePressureBar.resize( m_intersections.size(), std::numeric_limits::infinity() ); + +#pragma omp parallel for + for ( int64_t intersectionIdx = 0; intersectionIdx < (int64_t)m_intersections.size(); ++intersectionIdx ) + { + size_t elmIdx = m_intersectedCellsGlobIdx[intersectionIdx]; + RigElementType elmType = femPart->elementType( elmIdx ); + if ( !( elmType == HEX8 || elmType == HEX8P ) ) continue; + + interpolatedInterfacePorePressureBar[intersectionIdx] = interpolateGridResultValue( porBarResAddr.resultPosType, + porePressures, + intersectionIdx, + false ); + } + +#pragma omp parallel for + for ( int64_t intersectionIdx = 0; intersectionIdx < (int64_t)m_intersections.size(); ++intersectionIdx ) + { + // Priority 4: Hydrostatic pore pressure + ppValues[intersectionIdx] = static_cast( HYDROSTATIC_PP ); + + // Priority 3: Try element property tables + if ( m_porePressureSource == AUTO || m_porePressureSource == ELEMENT_PROPERTY_TABLE ) + { + size_t elmIdx = m_intersectedCellsGlobIdx[intersectionIdx]; + if ( elmIdx < poreElementPressuresPascal.size() ) + { + ppValues[intersectionIdx] = static_cast( ELEMENT_PROPERTY_TABLE ); + } + } + + // Priority 2: Try LAS-file + if ( m_porePressureSource == AUTO || m_porePressureSource == LAS_FILE ) + { + double lasMudWeightKgPerM3 = getWellLogSegmentValue( intersectionIdx, m_wellLogMdAndMudWeightKgPerM3 ); + if ( lasMudWeightKgPerM3 != std::numeric_limits::infinity() ) + { + ppValues[intersectionIdx] = static_cast( LAS_FILE ); + } + } + + // Priority 1: Try pore pressure from the grid + if ( m_porePressureSource == AUTO || m_porePressureSource == GRID ) + { + float averagePorePressureBar = std::numeric_limits::infinity(); + bool validGridPorePressure = averageIntersectionValuesToSegmentValue( intersectionIdx, + interpolatedInterfacePorePressureBar, + std::numeric_limits::infinity(), + &averagePorePressureBar ); + if ( validGridPorePressure ) + { + ppValues[intersectionIdx] = static_cast( GRID ); + } + } + } + return ppValues; +} +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigGeoMechWellLogExtractor::poissonIntervals( int frameIndex ) +{ + std::vector poissonValues( m_intersections.size(), 0.0 ); + + RigFemResultAddress poissonResAddr( RIG_ELEMENT, "RATIO", "" ); + + RigFemPartResultsCollection* resultCollection = m_caseData->femPartResults(); + + std::vector poissonRatios = resultCollection->resultValues( poissonResAddr, 0, frameIndex ); + +#pragma omp parallel for + for ( int64_t intersectionIdx = 0; intersectionIdx < (int64_t)m_intersections.size(); ++intersectionIdx ) + { + // Priority 3: User defined Poisson ratio + poissonValues[intersectionIdx] = static_cast( USER_DEFINED ); + + // Priority 2: Element property table ratio + if ( m_poissonRatioSource == AUTO || m_poissonRatioSource == ELEMENT_PROPERTY_TABLE ) + { + size_t elmIdx = m_intersectedCellsGlobIdx[intersectionIdx]; + if ( elmIdx < poissonRatios.size() ) + { + poissonValues[intersectionIdx] = static_cast( ELEMENT_PROPERTY_TABLE ); + } + } + + // Priority 1: Las-file poisson ratio + if ( m_poissonRatioSource == AUTO || m_poissonRatioSource == LAS_FILE ) + { + if ( !m_wellLogMdAndPoissonRatios.empty() ) + { + double lasPoissionRatio = getWellLogSegmentValue( intersectionIdx, m_wellLogMdAndPoissonRatios ); + if ( lasPoissionRatio != std::numeric_limits::infinity() ) + { + poissonValues[intersectionIdx] = static_cast( LAS_FILE ); + } + } + } + } + return poissonValues; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigGeoMechWellLogExtractor::ucsIntervals( int frameIndex ) +{ + std::vector ucsValues( m_intersections.size(), 0.0 ); + + RigFemResultAddress ucsResAddr( RIG_ELEMENT, "UCS", "" ); + + RigFemPartResultsCollection* resultCollection = m_caseData->femPartResults(); + + std::vector ucsValuesPascal = resultCollection->resultValues( ucsResAddr, 0, frameIndex ); + +#pragma omp parallel for + for ( int64_t intersectionIdx = 0; intersectionIdx < (int64_t)m_intersections.size(); ++intersectionIdx ) + { + // Priority 3: User defined Poisson ratio + ucsValues[intersectionIdx] = static_cast( USER_DEFINED ); + + // Priority 2: From element property table + if ( m_ucsSource == AUTO || m_ucsSource == ELEMENT_PROPERTY_TABLE ) + { + size_t elmIdx = m_intersectedCellsGlobIdx[intersectionIdx]; + if ( elmIdx < ucsValuesPascal.size() ) + { + ucsValues[intersectionIdx] = static_cast( ELEMENT_PROPERTY_TABLE ); + } + } + // Priority 1: Las-file + if ( m_ucsSource == AUTO || m_ucsSource == LAS_FILE ) + { + if ( !m_wellLogMdAndUcsBar.empty() ) + { + double lasUniaxialStrengthInBar = getWellLogSegmentValue( intersectionIdx, m_wellLogMdAndUcsBar ); + if ( lasUniaxialStrengthInBar != std::numeric_limits::infinity() ) + { + ucsValues[intersectionIdx] = static_cast( LAS_FILE ); + } + } + } + } + return ucsValues; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -749,8 +912,8 @@ void RigGeoMechWellLogExtractor::calculateIntersection() hexCorners[6] = cvf::Vec3d( nodeCoords[cornerIndices[6]] ); hexCorners[7] = cvf::Vec3d( nodeCoords[cornerIndices[7]] ); - // int intersectionCount = RigHexIntersector::lineHexCellIntersection(p1, p2, hexCorners, closeCells[ccIdx], - // &intersections); + // int intersectionCount = RigHexIntersector::lineHexCellIntersection(p1, p2, hexCorners, + // closeCells[ccIdx], &intersections); RigHexIntersectionTools::lineHexCellIntersection( p1, p2, hexCorners, closeCells[ccIdx], &intersections ); } diff --git a/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.h b/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.h index 638b3b1cd1..f1bf8d59aa 100644 --- a/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.h +++ b/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.h @@ -81,6 +81,10 @@ public: double userDefinedPoissonRatio, double userDefinedUcs ); + std::vector porePressureIntervals( int frameIndex ); + std::vector poissonIntervals( int frameIndex ); + std::vector ucsIntervals( int frameIndex ); + private: enum WellPathTangentCalculation { diff --git a/ApplicationCode/UserInterface/RiuPlotAnnotationTool.cpp b/ApplicationCode/UserInterface/RiuPlotAnnotationTool.cpp index 2fbe1d043a..258f35cb9b 100644 --- a/ApplicationCode/UserInterface/RiuPlotAnnotationTool.cpp +++ b/ApplicationCode/UserInterface/RiuPlotAnnotationTool.cpp @@ -42,17 +42,16 @@ RiuPlotAnnotationTool::~RiuPlotAnnotationTool() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuPlotAnnotationTool::attachFormationNames( QwtPlot* plot, - const std::vector& names, - const std::pair xRange, - const std::vector> yPositions, - FormationDisplay formationDisplay, - const caf::ColorTable& colorTable, - int shadingAlphaByte, - bool showNames /*= true */ ) +void RiuPlotAnnotationTool::attachNamedRegions( QwtPlot* plot, + const std::vector& names, + const std::pair xRange, + const std::vector> yPositions, + RegionDisplay regionDisplay, + const caf::ColorTable& colorTable, + int shadingAlphaByte, + bool showNames /*= true */, + TrackSpan trackSpan /*= FULL_WIDTH*/ ) { - detachAllAnnotations(); - if ( names.size() != yPositions.size() ) return; m_plot = plot; @@ -67,18 +66,20 @@ void RiuPlotAnnotationTool::attachFormationNames( QwtPlot* for ( size_t i = 0; i < names.size(); i++ ) { + if ( names[i].isEmpty() ) continue; + QwtPlotMarker* line( new QwtPlotMarker() ); QString name; if ( showNames ) { name = names[i]; - if ( ( formationDisplay & COLOR_SHADING ) == 0 && names[i].toLower().indexOf( "top" ) == -1 ) + if ( ( regionDisplay & COLOR_SHADING ) == 0 && names[i].toLower().indexOf( "top" ) == -1 ) { name += " Top"; } } - if ( formationDisplay & COLOR_SHADING ) + if ( regionDisplay & COLOR_SHADING ) { cvf::Color3ub cvfColor = catMapper.mapToColor( static_cast( i ) ); QColor shadingColor( cvfColor.r(), cvfColor.g(), cvfColor.b(), shadingAlphaByte ); @@ -103,26 +104,28 @@ void RiuPlotAnnotationTool::attachFormationNames( QwtPlot* QColor lineColor( 0, 0, 0, 0 ); QColor textColor( 0, 0, 0, 255 ); - if ( formationDisplay & DARK_LINES || formationDisplay & COLORED_LINES ) + if ( regionDisplay & DARK_LINES || regionDisplay & COLORED_LINES ) { cvf::Color3ub cvfColor = catMapper.mapToColor( static_cast( i ) ); QColor cycledColor( cvfColor.r(), cvfColor.g(), cvfColor.b() ); - lineColor = formationDisplay & DARK_LINES ? QColor( 0, 0, 100 ) : cycledColor; + lineColor = regionDisplay & DARK_LINES ? QColor( 0, 0, 100 ) : cycledColor; textColor = lineColor; } - RiuPlotAnnotationTool::horizontalDashedLineWithColor( line, lineColor, textColor, name, yPositions[i].first ); + Qt::Alignment horizontalAlignment = trackTextAlignment( trackSpan ); + RiuPlotAnnotationTool::horizontalDashedLine( line, + name, + yPositions[i].first, + lineColor, + textColor, + horizontalAlignment ); line->attach( m_plot ); m_markers.push_back( std::move( line ) ); if ( ( i != names.size() - 1 ) && cvf::Math::abs( yPositions[i].second - yPositions[i + 1].first ) > delta ) { QwtPlotMarker* bottomLine( new QwtPlotMarker() ); - RiuPlotAnnotationTool::horizontalDashedLineWithColor( bottomLine, - lineColor, - textColor, - QString(), - yPositions[i].second ); + RiuPlotAnnotationTool::horizontalDashedLine( bottomLine, QString(), yPositions[i].second, lineColor, textColor ); bottomLine->attach( m_plot ); m_markers.push_back( std::move( bottomLine ) ); @@ -162,7 +165,7 @@ void RiuPlotAnnotationTool::attachAnnotationLine( QwtPlot* plot, m_plot = plot; QwtPlotMarker* line( new QwtPlotMarker() ); - RiuPlotAnnotationTool::horizontalDashedLineWithColor( line, color, color, annotationText, yPosition ); + RiuPlotAnnotationTool::horizontalDashedLine( line, annotationText, yPosition, color, color ); line->attach( m_plot ); m_markers.push_back( std::move( line ) ); } @@ -186,16 +189,31 @@ void RiuPlotAnnotationTool::detachAllAnnotations() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuPlotAnnotationTool::horizontalDashedLine( QwtPlotMarker* line, const QString& name, double yValue ) +Qt::Alignment RiuPlotAnnotationTool::trackTextAlignment( TrackSpan trackSpan ) { - horizontalDashedLineWithColor( line, QColor( 0, 0, 100 ), QColor( 0, 0, 100 ), name, yValue ); + switch ( trackSpan ) + { + case FULL_WIDTH: + return Qt::AlignRight; + case LEFT_COLUMN: + return Qt::AlignLeft; + case CENTRE_COLUMN: + return Qt::AlignCenter; + case RIGHT_COLUMN: + return Qt::AlignRight; + } + return Qt::AlignRight; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuPlotAnnotationTool::horizontalDashedLineWithColor( - QwtPlotMarker* line, const QColor& color, const QColor& textColor, const QString& name, double yValue ) +void RiuPlotAnnotationTool::horizontalDashedLine( QwtPlotMarker* line, + const QString& name, + double yValue, + const QColor& color /*= QColor(0, 0, 100) */, + const QColor& textColor /*= QColor(0, 0, 100) */, + Qt::Alignment horizontalAlignment /*= Qt::AlignRight */ ) { QPen curvePen; curvePen.setStyle( Qt::DashLine ); @@ -208,5 +226,5 @@ void RiuPlotAnnotationTool::horizontalDashedLineWithColor( QwtText label( name ); label.setColor( textColor ); line->setLabel( label ); - line->setLabelAlignment( Qt::AlignRight | Qt::AlignBottom ); + line->setLabelAlignment( horizontalAlignment | Qt::AlignBottom ); } diff --git a/ApplicationCode/UserInterface/RiuPlotAnnotationTool.h b/ApplicationCode/UserInterface/RiuPlotAnnotationTool.h index c7cb77df1f..f0376bc60f 100644 --- a/ApplicationCode/UserInterface/RiuPlotAnnotationTool.h +++ b/ApplicationCode/UserInterface/RiuPlotAnnotationTool.h @@ -33,27 +33,40 @@ class QwtPlot; class RiuPlotAnnotationTool { public: - enum FormationDisplay + enum RegionAnnotationType + { + NO_ANNOTATIONS = 0, + FORMATION_ANNOTATIONS = 1, + CURVE_ANNOTATIONS = 2 + }; + enum RegionDisplay { - NONE = 0x00, DARK_LINES = 0x01, COLORED_LINES = 0x02, COLOR_SHADING = 0x04, COLOR_SHADING_AND_LINES = 0x05 }; + enum TrackSpan + { + FULL_WIDTH, + LEFT_COLUMN, + CENTRE_COLUMN, + RIGHT_COLUMN + }; public: RiuPlotAnnotationTool(){}; ~RiuPlotAnnotationTool(); - void attachFormationNames( QwtPlot* plot, - const std::vector& names, - const std::pair xRange, - const std::vector> yPositions, - FormationDisplay formationDisplay, - const caf::ColorTable& colorTable, - int shadingAlphaByte, - bool showNames = true ); + void attachNamedRegions( QwtPlot* plot, + const std::vector& names, + const std::pair xRange, + const std::vector> yPositions, + RegionDisplay regionDisplay, + const caf::ColorTable& colorTable, + int shadingAlphaByte, + bool showNames = true, + TrackSpan trackSpan = FULL_WIDTH ); void attachWellPicks( QwtPlot* plot, const std::vector& names, const std::vector yPositions ); void attachAnnotationLine( QwtPlot* plot, const QColor& color, const QString& annotationText, const double yPosition ); @@ -61,9 +74,13 @@ public: void detachAllAnnotations(); private: - static void horizontalDashedLine( QwtPlotMarker* line, const QString& name, double yValue ); - static void horizontalDashedLineWithColor( - QwtPlotMarker* line, const QColor& color, const QColor& textColor, const QString& name, double yValue ); + static Qt::Alignment trackTextAlignment( TrackSpan trackSpan ); + static void horizontalDashedLine( QwtPlotMarker* line, + const QString& name, + double yValue, + const QColor& color = QColor( 0, 0, 100 ), + const QColor& textColor = QColor( 0, 0, 100 ), + Qt::Alignment horizontalAlignment = Qt::AlignRight ); private: QPointer m_plot;