Merge pull request #4730 from OPM/feature-plot-color-fill

Feature plot color fill
This commit is contained in:
Gaute Lindkvist 2019-09-18 15:43:14 +02:00 committed by GitHub
commit cdfaedf834
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 642 additions and 282 deletions

View File

@ -25,6 +25,7 @@
#include "RimEclipseResultCase.h" #include "RimEclipseResultCase.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimSimWellInView.h" #include "RimSimWellInView.h"
#include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogExtractionCurve.h" #include "RimWellLogExtractionCurve.h"
#include "RimWellLogFile.h" #include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h" #include "RimWellLogFileChannel.h"
@ -178,23 +179,90 @@ RimWellLogExtractionCurve* RicWellLogTools::addExtractionCurve( RimWellLogTrack*
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plotTrack->curveCount() ); cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plotTrack->curveCount() );
curve->setColor( curveColor ); curve->setColor( curveColor );
if ( wellPath )
{ RimCase* caseToApply = nullptr;
curve->setWellPath( wellPath ); RimWellLogPlot* plot = nullptr;
plotTrack->setFormationWellPath( wellPath ); plotTrack->firstAncestorOrThisOfTypeAsserted( plot );
plotTrack->setFormationTrajectoryType( RimWellLogTrack::WELL_PATH ); RimWellLogCurveCommonDataSource* commonDataSource = plot->commonDataSource();
}
if ( simWell )
{
curve->setFromSimulationWellName( simWell->name(), branchIndex, useBranchDetection );
plotTrack->setFormationSimWellName( simWell->name() );
plotTrack->setFormationBranchIndex( branchIndex );
plotTrack->setFormationTrajectoryType( RimWellLogTrack::SIMULATION_WELL );
}
if ( view ) if ( view )
{ {
plotTrack->setFormationCase( view->ownerCase() ); caseToApply = view->ownerCase();
}
else if ( commonDataSource->caseToApply() )
{
caseToApply = commonDataSource->caseToApply();
}
else if ( plotTrack->formationNamesCase() )
{
caseToApply = plotTrack->formationNamesCase();
}
else
{
std::vector<RimCase*> allCases;
RiaApplication::instance()->project()->allCases( allCases );
if ( !allCases.empty() ) caseToApply = allCases.front();
}
QString ownerSimWellName;
if ( !wellPath )
{
if ( commonDataSource->wellPathToApply() )
{
wellPath = commonDataSource->wellPathToApply();
}
else if ( plotTrack->formationWellPath() )
{
wellPath = plotTrack->formationWellPath();
}
else
{
auto allWellPaths = RiaApplication::instance()->project()->allWellPaths();
if ( !allWellPaths.empty() )
{
wellPath = allWellPaths.front();
}
}
}
if ( !simWell )
{
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( caseToApply );
if ( eclipseCase )
{
if ( !commonDataSource->simWellNameToApply().isEmpty() )
{
ownerSimWellName = commonDataSource->simWellNameToApply();
}
else if ( !plotTrack->formationSimWellName().isEmpty() )
{
ownerSimWellName = plotTrack->formationSimWellName();
}
else
{
auto allSimWells = eclipseCase->sortedSimWellNames();
if ( !allSimWells.empty() )
{
ownerSimWellName = *allSimWells.begin();
}
}
}
}
if ( simWell || !ownerSimWellName.isEmpty() )
{
QString simWellName = simWell ? simWell->name() : ownerSimWellName;
curve->setFromSimulationWellName( simWellName, branchIndex, useBranchDetection );
}
if ( wellPath )
{
curve->setWellPath( wellPath );
curve->setTrajectoryType( RimWellLogExtractionCurve::WELL_PATH );
}
if ( caseToApply )
{
curve->setCase( caseToApply );
} }
curve->setPropertiesFromView( view ); curve->setPropertiesFromView( view );
@ -212,7 +280,6 @@ RimWellLogExtractionCurve* RicWellLogTools::addExtractionCurve( RimWellLogTrack*
// Make sure the summary plot window is visible // Make sure the summary plot window is visible
RiuPlotMainWindowTools::showPlotMainWindow(); RiuPlotMainWindowTools::showPlotMainWindow();
} }
return curve; return curve;
} }

View File

@ -166,7 +166,7 @@ void RicNewWellBoreStabilityPlotFeature::createFormationTrack( RimWellBoreStabil
RimWellLogTrack* formationTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Formations", plot ); RimWellLogTrack* formationTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Formations", plot );
formationTrack->setFormationWellPath( wellPath ); formationTrack->setFormationWellPath( wellPath );
formationTrack->setFormationCase( geoMechCase ); formationTrack->setFormationCase( geoMechCase );
formationTrack->setShowFormations( true ); formationTrack->setShowFormations( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES );
formationTrack->setVisibleXRange( 0.0, 0.0 ); formationTrack->setVisibleXRange( 0.0, 0.0 );
formationTrack->setWidthScaleFactor( RimWellLogTrack::NARROW_TRACK ); formationTrack->setWidthScaleFactor( RimWellLogTrack::NARROW_TRACK );
} }
@ -182,7 +182,7 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabi
casingShoeTrack->setWidthScaleFactor( RimWellLogTrack::NARROW_TRACK ); casingShoeTrack->setWidthScaleFactor( RimWellLogTrack::NARROW_TRACK );
casingShoeTrack->setFormationWellPath( wellPath ); casingShoeTrack->setFormationWellPath( wellPath );
casingShoeTrack->setFormationCase( geoMechCase ); casingShoeTrack->setFormationCase( geoMechCase );
casingShoeTrack->setShowFormations( true ); casingShoeTrack->setShowFormations( RiuPlotAnnotationTool::DARK_LINES );
casingShoeTrack->setShowFormationLabels( false ); casingShoeTrack->setShowFormationLabels( false );
casingShoeTrack->setShowWellPathAttributes( true ); casingShoeTrack->setShowWellPathAttributes( true );
casingShoeTrack->setWellPathAttributesSource( wellPath ); casingShoeTrack->setWellPathAttributesSource( wellPath );
@ -207,7 +207,7 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
stabilityCurvesTrack->setFormationWellPath( wellPath ); stabilityCurvesTrack->setFormationWellPath( wellPath );
stabilityCurvesTrack->setFormationCase( geoMechView->geoMechCase() ); stabilityCurvesTrack->setFormationCase( geoMechView->geoMechCase() );
stabilityCurvesTrack->setShowFormations( true ); stabilityCurvesTrack->setShowFormations( RiuPlotAnnotationTool::NONE );
stabilityCurvesTrack->setShowFormationLabels( false ); stabilityCurvesTrack->setShowFormationLabels( false );
std::vector<QString> resultNames = RiaDefines::wellPathStabilityResultNames(); std::vector<QString> resultNames = RiaDefines::wellPathStabilityResultNames();
@ -227,8 +227,13 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
{ {
const QString& resultName = resultNames[i]; const QString& resultName = resultNames[i];
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" ); RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
RimWellLogExtractionCurve* curve = RimWellLogExtractionCurve* curve = RicWellLogTools::addExtractionCurve( stabilityCurvesTrack,
RicWellLogTools::addExtractionCurve( stabilityCurvesTrack, geoMechView, wellPath, nullptr, 0, false, false ); geoMechView,
wellPath,
nullptr,
-1,
false,
false );
curve->setGeoMechResultAddress( resAddr ); curve->setGeoMechResultAddress( resAddr );
curve->setCurrentTimeStep( geoMechView->currentTimeStep() ); curve->setCurrentTimeStep( geoMechView->currentTimeStep() );
curve->setCustomName( resultName ); curve->setCustomName( resultName );
@ -263,7 +268,7 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
const QString& resultName = resultNames[i]; const QString& resultName = resultNames[i];
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" ); RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
RimWellLogExtractionCurve* curve = RimWellLogExtractionCurve* curve =
RicWellLogTools::addExtractionCurve( wellPathAnglesTrack, geoMechView, wellPath, nullptr, 0, false, false ); RicWellLogTools::addExtractionCurve( wellPathAnglesTrack, geoMechView, wellPath, nullptr, -1, false, false );
curve->setGeoMechResultAddress( resAddr ); curve->setGeoMechResultAddress( resAddr );
curve->setCurrentTimeStep( geoMechView->currentTimeStep() ); curve->setCurrentTimeStep( geoMechView->currentTimeStep() );
curve->setCustomName( resultName ); curve->setCustomName( resultName );
@ -275,7 +280,7 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
curve->loadDataAndUpdate( false ); curve->loadDataAndUpdate( false );
double actualMinValue = minValue, actualMaxValue = maxValue; double actualMinValue = minValue, actualMaxValue = maxValue;
curve->valueRange( &actualMinValue, &actualMaxValue ); curve->xValueRangeInQwt( &actualMinValue, &actualMaxValue );
while ( maxValue < actualMaxValue ) while ( maxValue < actualMaxValue )
{ {
maxValue += angleIncrement; maxValue += angleIncrement;
@ -293,6 +298,6 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
wellPathAnglesTrack->setFormationWellPath( wellPath ); wellPathAnglesTrack->setFormationWellPath( wellPath );
wellPathAnglesTrack->setFormationCase( geoMechView->geoMechCase() ); wellPathAnglesTrack->setFormationCase( geoMechView->geoMechCase() );
wellPathAnglesTrack->setShowFormations( true ); wellPathAnglesTrack->setShowFormations( RiuPlotAnnotationTool::NONE );
wellPathAnglesTrack->setShowFormationLabels( false ); wellPathAnglesTrack->setShowFormationLabels( false );
} }

View File

@ -70,6 +70,7 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
{ {
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return; if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return;
RimWellLogPlot* wellLogPlot = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogPlot>();
RimWellLogTrack* wellLogPlotTrack = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogTrack>(); RimWellLogTrack* wellLogPlotTrack = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogTrack>();
if ( wellLogPlotTrack ) if ( wellLogPlotTrack )
{ {
@ -77,10 +78,10 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
} }
else else
{ {
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemOfType<RimWellPath>(); RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemOfType<RimWellPath>();
int branchIndex = -1; int branchIndex = -1;
RimSimWellInView* simWell = RicWellLogTools::selectedSimulationWell( &branchIndex ); RimSimWellInView* simWell = RicWellLogTools::selectedSimulationWell( &branchIndex );
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
bool useBranchDetection = true; bool useBranchDetection = true;
RimSimWellInViewCollection* simWellColl = nullptr; RimSimWellInViewCollection* simWellColl = nullptr;
if ( simWell ) if ( simWell )
@ -91,11 +92,29 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
if ( wellPath || simWell ) if ( wellPath || simWell )
{ {
RimWellLogTrack* newWellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(); RimWellLogTrack* newWellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( true,
"",
wellLogPlot );
if ( wellPath )
{
newWellLogPlotTrack->setFormationWellPath( wellPath );
newWellLogPlotTrack->setFormationTrajectoryType( RimWellLogTrack::WELL_PATH );
}
else
{
newWellLogPlotTrack->setFormationSimWellName( simWell->name() );
newWellLogPlotTrack->setFormationTrajectoryType( RimWellLogTrack::SIMULATION_WELL );
newWellLogPlotTrack->setFormationBranchIndex( branchIndex );
newWellLogPlotTrack->setFormationBranchDetection( useBranchDetection );
}
if ( view )
{
newWellLogPlotTrack->setFormationCase( view->ownerCase() );
}
RimWellLogExtractionCurve* plotCurve = RicWellLogTools::addExtractionCurve( newWellLogPlotTrack, RimWellLogExtractionCurve* plotCurve = RicWellLogTools::addExtractionCurve( newWellLogPlotTrack,
RiaApplication::instance() view,
->activeReservoirView(),
wellPath, wellPath,
simWell, simWell,
branchIndex, branchIndex,
@ -103,11 +122,10 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
plotCurve->loadDataAndUpdate( true ); plotCurve->loadDataAndUpdate( true );
RimWellLogPlot* plot = nullptr; newWellLogPlotTrack->firstAncestorOrThisOfType( wellLogPlot );
newWellLogPlotTrack->firstAncestorOrThisOfType( plot ); if ( wellLogPlot && plotCurve->curveData() )
if ( plot && plotCurve->curveData() )
{ {
plot->setDepthUnit( plotCurve->curveData()->depthUnit() ); wellLogPlot->setDepthUnit( plotCurve->curveData()->depthUnit() );
} }
plotCurve->updateConnectedEditors(); plotCurve->updateConnectedEditors();

View File

@ -25,6 +25,7 @@
#include "RimProject.h" #include "RimProject.h"
#include "RimWellLogCurve.h" #include "RimWellLogCurve.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
#include "RimWellLogTrack.h" #include "RimWellLogTrack.h"
@ -51,8 +52,12 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotFeature::onActionTriggered( bool isChecked ) void RicNewWellLogPlotFeature::onActionTriggered( bool isChecked )
{ {
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(); RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RicWellLogTools::addExtractionCurve( plotTrack, nullptr, nullptr, nullptr, -1, true ); RimWellLogExtractionCurve* curve = RicWellLogTools::addExtractionCurve( plotTrack, nullptr, nullptr, nullptr, -1, true );
curve->loadDataAndUpdate( true );
RimWellLogPlot* plot = nullptr;
plotTrack->firstAncestorOrThisOfTypeAsserted( plot );
plot->zoomAll();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -19,12 +19,18 @@
#include "RicNewWellLogPlotFeatureImpl.h" #include "RicNewWellLogPlotFeatureImpl.h"
#include "RiaApplication.h"
#include "RimCase.h"
#include "RimEclipseCase.h"
#include "RimMainPlotCollection.h" #include "RimMainPlotCollection.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimWellBoreStabilityPlot.h" #include "RimWellBoreStabilityPlot.h"
#include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h" #include "RimWellLogPlotCollection.h"
#include "RimWellLogTrack.h" #include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RiaGuiApplication.h" #include "RiaGuiApplication.h"
@ -114,6 +120,48 @@ RimWellLogTrack* RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( bool
plot = createWellLogPlot(); plot = createWellLogPlot();
} }
RimCase* caseToApply = nullptr;
RimWellPath* wellPathToApply = nullptr;
QString simWellToApply;
RimWellLogCurveCommonDataSource* commonDataSource = plot->commonDataSource();
caseToApply = commonDataSource->caseToApply();
wellPathToApply = commonDataSource->wellPathToApply();
simWellToApply = commonDataSource->simWellNameToApply();
caf::Tristate branchDetectionToApply = commonDataSource->branchDetectionToApply();
int branchIndexToApply = commonDataSource->branchIndexToApply();
if ( !caseToApply )
{
std::vector<RimCase*> allCases;
RiaApplication::instance()->project()->allCases( allCases );
if ( !allCases.empty() )
{
caseToApply = allCases.front();
}
}
if ( !wellPathToApply && caseToApply )
{
auto allWellPaths = RiaApplication::instance()->project()->allWellPaths();
if ( !allWellPaths.empty() )
{
wellPathToApply = allWellPaths.front();
}
}
if ( simWellToApply.isEmpty() && caseToApply )
{
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( caseToApply );
if ( eclipseCase )
{
auto allSimWells = eclipseCase->sortedSimWellNames();
if ( !allSimWells.empty() )
{
simWellToApply = *allSimWells.begin();
}
}
}
RimWellLogTrack* plotTrack = new RimWellLogTrack(); RimWellLogTrack* plotTrack = new RimWellLogTrack();
plot->addTrack( plotTrack ); plot->addTrack( plotTrack );
if ( !trackDescription.isEmpty() ) if ( !trackDescription.isEmpty() )
@ -125,6 +173,40 @@ RimWellLogTrack* RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( bool
plotTrack->setDescription( QString( "Track %1" ).arg( plot->trackCount() ) ); plotTrack->setDescription( QString( "Track %1" ).arg( plot->trackCount() ) );
} }
if ( caseToApply )
{
plotTrack->setFormationCase( caseToApply );
}
if ( wellPathToApply )
{
plotTrack->setFormationWellPath( wellPathToApply );
}
if ( !simWellToApply.isEmpty() )
{
plotTrack->setFormationSimWellName( simWellToApply );
}
if ( wellPathToApply )
{
plotTrack->setFormationTrajectoryType( RimWellLogTrack::WELL_PATH );
}
else if ( !simWellToApply.isEmpty() )
{
plotTrack->setFormationTrajectoryType( RimWellLogTrack::SIMULATION_WELL );
}
if ( !branchDetectionToApply.isPartiallyTrue() )
{
plotTrack->setFormationBranchDetection( branchDetectionToApply.isTrue() );
}
if ( branchIndexToApply >= 0 )
{
plotTrack->setFormationBranchIndex( branchIndexToApply );
}
if ( updateAfter ) if ( updateAfter )
{ {
updateAfterCreation( plot ); updateAfterCreation( plot );

View File

@ -1097,7 +1097,7 @@ void RimWellPltPlot::onLoadDataAndUpdate()
{ {
if ( trackCount() > 0 ) if ( trackCount() > 0 )
{ {
trackByIndex( 0 )->setShowFormations( true ); trackByIndex( 0 )->setShowFormations( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES );
} }
m_isOnLoad = false; m_isOnLoad = false;
} }

View File

@ -936,7 +936,7 @@ void RimWellRftPlot::onLoadDataAndUpdate()
{ {
if ( trackCount() > 0 ) if ( trackCount() > 0 )
{ {
trackByIndex( 0 )->setShowFormations( true ); trackByIndex( 0 )->setShowFormations( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES );
} }
m_isOnLoad = false; m_isOnLoad = false;

View File

@ -649,7 +649,7 @@ void RimPlotCurve::loadDataAndUpdate( bool updateParentPlot )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimPlotCurve::xValueRange( double* minimumValue, double* maximumValue ) const bool RimPlotCurve::xValueRangeInQwt( double* minimumValue, double* maximumValue ) const
{ {
CVF_ASSERT( minimumValue && maximumValue ); CVF_ASSERT( minimumValue && maximumValue );
CVF_ASSERT( m_qwtPlotCurve ); CVF_ASSERT( m_qwtPlotCurve );
@ -668,7 +668,7 @@ bool RimPlotCurve::xValueRange( double* minimumValue, double* maximumValue ) con
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimPlotCurve::yValueRange( double* minimumValue, double* maximumValue ) const bool RimPlotCurve::yValueRangeInQwt( double* minimumValue, double* maximumValue ) const
{ {
CVF_ASSERT( minimumValue && maximumValue ); CVF_ASSERT( minimumValue && maximumValue );
CVF_ASSERT( m_qwtPlotCurve ); CVF_ASSERT( m_qwtPlotCurve );

View File

@ -50,8 +50,8 @@ public:
void loadDataAndUpdate( bool updateParentPlot ); void loadDataAndUpdate( bool updateParentPlot );
virtual bool xValueRange( double* minimumValue, double* maximumValue ) const; virtual bool xValueRangeInQwt( double* minimumValue, double* maximumValue ) const;
virtual bool yValueRange( double* minimumValue, double* maximumValue ) const; virtual bool yValueRangeInQwt( double* minimumValue, double* maximumValue ) const;
void setParentQwtPlotAndReplot( QwtPlot* plot ); void setParentQwtPlotAndReplot( QwtPlot* plot );
void setParentQwtPlotNoReplot( QwtPlot* plot ); void setParentQwtPlotNoReplot( QwtPlot* plot );

View File

@ -19,6 +19,7 @@
#include "RimWellLogCurve.h" #include "RimWellLogCurve.h"
#include "RiaCurveDataTools.h"
#include "RigWellLogCurveData.h" #include "RigWellLogCurveData.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
@ -33,6 +34,8 @@
#include "qwt_symbol.h" #include "qwt_symbol.h"
#include <algorithm>
// NB! Special macro for pure virtual class // NB! Special macro for pure virtual class
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimWellLogCurve, "WellLogPlotCurve" ); CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimWellLogCurve, "WellLogPlotCurve" );
@ -55,9 +58,31 @@ RimWellLogCurve::~RimWellLogCurve() {}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellLogCurve::valueRange( double* minimumValue, double* maximumValue ) const bool RimWellLogCurve::xValueRangeInData( double* minimumValue, double* maximumValue ) const
{ {
return xValueRange( minimumValue, maximumValue ); CAF_ASSERT( minimumValue && maximumValue );
if ( !( minimumValue && maximumValue ) )
{
return false;
}
if ( m_curveData->xValues().empty() )
{
return false;
}
*minimumValue = std::numeric_limits<double>::infinity();
*maximumValue = -std::numeric_limits<double>::infinity();
for ( double xValue : m_curveData->xValues() )
{
if ( RiaCurveDataTools::isValidValue( xValue, false ) )
{
*minimumValue = std::min( *minimumValue, xValue );
*maximumValue = std::max( *maximumValue, xValue );
}
}
return true;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -38,7 +38,7 @@ public:
RimWellLogCurve(); RimWellLogCurve();
~RimWellLogCurve() override; ~RimWellLogCurve() override;
bool valueRange( double* minimumValue, double* maximumValue ) const; bool xValueRangeInData( double* minimumValue, double* maximumValue ) const;
const RigWellLogCurveData* curveData() const; const RigWellLogCurveData* curveData() const;

View File

@ -52,7 +52,7 @@ RimWellLogCurveCommonDataSource::RimWellLogCurveCommonDataSource()
CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Name", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Name", "", "", "" );
CAF_PDM_InitField( &m_simWellName, "SimulationWellName", QString( "None" ), "Well Name", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_simWellName, "SimulationWellName", "Well Name", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_branchDetection, CAF_PDM_InitFieldNoDefault( &m_branchDetection,
"BranchDetection", "BranchDetection",
"Branch Detection", "Branch Detection",
@ -117,6 +117,14 @@ void RimWellLogCurveCommonDataSource::setWellPathToApply( RimWellPath* val )
m_wellPath = val; m_wellPath = val;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellLogCurveCommonDataSource::branchIndexToApply() const
{
return m_branchIndex;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -125,6 +133,14 @@ void RimWellLogCurveCommonDataSource::setBranchIndexToApply( int val )
m_branchIndex = val; m_branchIndex = val;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::Tristate RimWellLogCurveCommonDataSource::branchDetectionToApply() const
{
return m_branchDetection();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -177,6 +193,13 @@ void RimWellLogCurveCommonDataSource::resetDefaultOptions()
setBranchDetectionToApply( caf::Tristate::State::PartiallyTrue ); setBranchDetectionToApply( caf::Tristate::State::PartiallyTrue );
setSimWellNameToApply( QString( "" ) ); setSimWellNameToApply( QString( "" ) );
setTimeStepToApply( -1 ); setTimeStepToApply( -1 );
m_uniqueCases.clear();
m_uniqueTrajectoryTypes.clear();
m_uniqueWellPaths.clear();
m_uniqueWellNames.clear();
m_uniqueTimeSteps.clear();
m_uniqueBranchIndices.clear();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -189,13 +212,6 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions( const std::vector<Ri
resetDefaultOptions(); resetDefaultOptions();
// Check to see if the parameters are unique // Check to see if the parameters are unique
std::set<RimCase*> uniqueCases;
std::set<int> uniqueTrajectoryTypes;
std::set<RimWellPath*> uniqueWellPaths;
std::set<QString> uniqueWellNames;
std::set<int> uniqueTimeSteps;
std::set<bool> uniqueBranchDetection;
std::set<int> uniqueBranchIndex;
for ( RimWellLogCurve* curve : curves ) for ( RimWellLogCurve* curve : curves )
{ {
if ( !curve->isCurveVisible() ) if ( !curve->isCurveVisible() )
@ -206,65 +222,93 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions( const std::vector<Ri
RimWellLogFileCurve* fileCurve = dynamic_cast<RimWellLogFileCurve*>( curve ); RimWellLogFileCurve* fileCurve = dynamic_cast<RimWellLogFileCurve*>( curve );
if ( extractionCurve ) if ( extractionCurve )
{ {
uniqueCases.insert( extractionCurve->rimCase() ); if ( extractionCurve->rimCase() )
uniqueTrajectoryTypes.insert( static_cast<int>( extractionCurve->trajectoryType() ) ); {
uniqueWellPaths.insert( extractionCurve->wellPath() ); m_uniqueCases.insert( extractionCurve->rimCase() );
uniqueWellNames.insert( extractionCurve->wellName() ); }
uniqueTimeSteps.insert( extractionCurve->currentTimeStep() ); m_uniqueTrajectoryTypes.insert( static_cast<int>( extractionCurve->trajectoryType() ) );
uniqueBranchDetection.insert( extractionCurve->branchDetection() ); if ( extractionCurve->trajectoryType() == RimWellLogTrack::WELL_PATH )
uniqueBranchIndex.insert( extractionCurve->branchIndex() ); {
if ( extractionCurve->wellPath() )
{
m_uniqueWellPaths.insert( extractionCurve->wellPath() );
}
}
else if ( extractionCurve->trajectoryType() == RimWellLogTrack::SIMULATION_WELL )
{
if ( !extractionCurve->wellName().isEmpty() )
{
m_uniqueWellNames.insert( extractionCurve->wellName() );
}
}
m_uniqueTimeSteps.insert( extractionCurve->currentTimeStep() );
m_uniqueBranchDetection.insert( extractionCurve->branchDetection() );
m_uniqueBranchIndices.insert( extractionCurve->branchIndex() );
} }
else if ( fileCurve ) else if ( fileCurve )
{ {
uniqueWellPaths.insert( fileCurve->wellPath() ); m_uniqueWellPaths.insert( fileCurve->wellPath() );
uniqueWellNames.insert( fileCurve->wellName() ); m_uniqueWellNames.insert( fileCurve->wellName() );
} }
} }
for ( RimWellLogTrack* track : tracks ) for ( RimWellLogTrack* track : tracks )
{ {
if ( track->showWellPathAttributes() ) if ( track->showWellPathAttributes() )
{ {
uniqueTrajectoryTypes.insert( static_cast<int>( RimWellLogExtractionCurve::WELL_PATH ) ); m_uniqueTrajectoryTypes.insert( static_cast<int>( RimWellLogExtractionCurve::WELL_PATH ) );
uniqueWellPaths.insert( track->wellPathAttributeSource() ); m_uniqueWellPaths.insert( track->wellPathAttributeSource() );
} }
if ( track->showFormations() ) if ( track->showFormations() )
{ {
uniqueCases.insert( track->formationNamesCase() ); m_uniqueTrajectoryTypes.insert( track->formationTrajectoryType() );
uniqueWellPaths.insert( track->formationWellPath() ); if ( track->formationTrajectoryType() == RimWellLogTrack::WELL_PATH )
{
m_uniqueWellPaths.insert( track->formationWellPath() );
}
else if ( track->formationTrajectoryType() == RimWellLogTrack::SIMULATION_WELL )
{
m_uniqueWellNames.insert( track->formationSimWellName() );
}
m_uniqueBranchDetection.insert( track->formationBranchDetection() );
m_uniqueBranchIndices.insert( track->formationBranchIndex() );
m_uniqueCases.insert( track->formationNamesCase() );
m_uniqueWellPaths.insert( track->formationWellPath() );
} }
} }
if ( uniqueCases.size() == 1u ) if ( m_uniqueCases.size() == 1u )
{ {
setCaseToApply( *uniqueCases.begin() ); setCaseToApply( *m_uniqueCases.begin() );
} }
if ( uniqueTrajectoryTypes.size() == 1u ) if ( m_uniqueTrajectoryTypes.size() == 1u )
{ {
m_trajectoryType = *uniqueTrajectoryTypes.begin(); m_trajectoryType = *m_uniqueTrajectoryTypes.begin();
if ( uniqueWellPaths.size() == 1u ) if ( m_uniqueWellPaths.size() == 1u )
{ {
setWellPathToApply( *uniqueWellPaths.begin() ); setWellPathToApply( *m_uniqueWellPaths.begin() );
} }
if ( uniqueBranchIndex.size() == 1u ) if ( m_uniqueBranchIndices.size() == 1u )
{ {
setBranchIndexToApply( *uniqueBranchIndex.begin() ); setBranchIndexToApply( *m_uniqueBranchIndices.begin() );
} }
if ( uniqueBranchDetection.size() == 1u ) if ( m_uniqueBranchDetection.size() == 1u )
{ {
setBranchDetectionToApply( *uniqueBranchDetection.begin() == true ? caf::Tristate::State::True setBranchDetectionToApply( *m_uniqueBranchDetection.begin() == true ? caf::Tristate::State::True
: caf::Tristate::State::False ); : caf::Tristate::State::False );
} }
if ( uniqueWellNames.size() == 1u ) if ( m_uniqueWellNames.size() == 1u )
{ {
setSimWellNameToApply( *uniqueWellNames.begin() ); setSimWellNameToApply( *m_uniqueWellNames.begin() );
} }
} }
if ( uniqueTimeSteps.size() == 1u ) if ( m_uniqueTimeSteps.size() == 1u )
{ {
setTimeStepToApply( *uniqueTimeSteps.begin() ); setTimeStepToApply( *m_uniqueTimeSteps.begin() );
} }
} }
@ -379,29 +423,48 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks( std::vector<RimWell
for ( RimWellLogTrack* track : tracks ) for ( RimWellLogTrack* track : tracks )
{ {
bool updatedSomething = false; bool updatedSomething = false;
if ( caseToApply() != nullptr )
{
if ( track->showFormations() )
{
track->setFormationCase( caseToApply() );
updatedSomething = true;
}
}
if ( wellPathToApply() != nullptr ) if ( track->showWellPathAttributes() )
{ {
if ( track->showWellPathAttributes() ) if ( wellPathToApply() )
{ {
track->setWellPathAttributesSource( wellPathToApply() ); track->setWellPathAttributesSource( wellPathToApply() );
updatedSomething = true; updatedSomething = true;
} }
if ( track->showFormations() ) }
if ( track->showFormations() )
{
if ( caseToApply() != nullptr )
{
track->setFormationCase( caseToApply() );
updatedSomething = true;
}
if ( wellPathToApply() != nullptr )
{ {
track->setFormationWellPath( wellPathToApply() ); track->setFormationWellPath( wellPathToApply() );
updatedSomething = true; updatedSomething = true;
} }
}
if ( !simWellNameToApply().isEmpty() )
{
track->setFormationSimWellName( simWellNameToApply() );
updatedSomething = true;
}
if ( !branchDetectionToApply().isPartiallyTrue() )
{
track->setFormationSimWellName( simWellNameToApply() );
updatedSomething = true;
}
if ( branchIndexToApply() >= 0 )
{
track->setFormationBranchIndex( branchIndexToApply() );
updatedSomething = true;
}
}
if ( updatedSomething ) if ( updatedSomething )
{ {
RimWellLogPlot* parentPlot = nullptr; RimWellLogPlot* parentPlot = nullptr;
@ -560,14 +623,28 @@ QList<caf::PdmOptionItemInfo>
if ( caseToApply() == nullptr ) if ( caseToApply() == nullptr )
{ {
options.push_front( caf::PdmOptionItemInfo( "Mixed Cases", nullptr ) ); if ( !m_uniqueCases.empty() )
{
options.push_front( caf::PdmOptionItemInfo( "Mixed Cases", nullptr ) );
}
else
{
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
} }
} }
else if ( fieldNeedingOptions == &m_trajectoryType ) else if ( fieldNeedingOptions == &m_trajectoryType )
{ {
if ( m_trajectoryType() == -1 ) if ( m_trajectoryType() == -1 )
{ {
options.push_back( caf::PdmOptionItemInfo( "Mixed Trajectory Types", -1 ) ); if ( !m_uniqueTrajectoryTypes.empty() )
{
options.push_back( caf::PdmOptionItemInfo( "Mixed Trajectory Types", -1 ) );
}
else
{
options.push_back( caf::PdmOptionItemInfo( "No Trajectory Types", -1 ) );
}
} }
std::vector<RimWellLogExtractionCurve::TrajectoryType> trajectoryTypes = std::vector<RimWellLogExtractionCurve::TrajectoryType> trajectoryTypes =
{RimWellLogExtractionCurve::WELL_PATH, RimWellLogExtractionCurve::SIMULATION_WELL}; {RimWellLogExtractionCurve::WELL_PATH, RimWellLogExtractionCurve::SIMULATION_WELL};
@ -583,7 +660,14 @@ QList<caf::PdmOptionItemInfo>
RimTools::wellPathOptionItems( &options ); RimTools::wellPathOptionItems( &options );
if ( wellPathToApply() == nullptr ) if ( wellPathToApply() == nullptr )
{ {
options.push_front( caf::PdmOptionItemInfo( "Mixed Well Paths", nullptr ) ); if ( !m_uniqueWellPaths.empty() )
{
options.push_front( caf::PdmOptionItemInfo( "Mixed Well Paths", nullptr ) );
}
else
{
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
} }
} }
else if ( fieldNeedingOptions == &m_timeStep ) else if ( fieldNeedingOptions == &m_timeStep )
@ -602,7 +686,14 @@ QList<caf::PdmOptionItemInfo>
if ( timeStepToApply() == -1 ) if ( timeStepToApply() == -1 )
{ {
options.push_front( caf::PdmOptionItemInfo( "Mixed Time Steps", -1 ) ); if ( !m_uniqueTimeSteps.empty() )
{
options.push_front( caf::PdmOptionItemInfo( "Mixed Time Steps", -1 ) );
}
else
{
options.push_front( caf::PdmOptionItemInfo( "No Time Steps", -1 ) );
}
} }
} }
else if ( fieldNeedingOptions == &m_simWellName ) else if ( fieldNeedingOptions == &m_simWellName )
@ -618,14 +709,16 @@ QList<caf::PdmOptionItemInfo>
options.push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) ); options.push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) );
} }
if ( options.size() == 0 ) if ( m_simWellName().isEmpty() )
{ {
options.push_front( caf::PdmOptionItemInfo( "None", "None" ) ); if ( !m_uniqueWellNames.empty() )
} {
options.push_front( caf::PdmOptionItemInfo( "Mixed Well Names", "" ) );
if ( m_simWellName == QString( "" ) ) }
{ else
options.push_front( caf::PdmOptionItemInfo( "Mixed Well Names", "" ) ); {
options.push_front( caf::PdmOptionItemInfo( "None", "None" ) );
}
} }
} }
} }
@ -641,7 +734,14 @@ QList<caf::PdmOptionItemInfo>
if ( m_branchIndex() == -1 ) if ( m_branchIndex() == -1 )
{ {
options.push_front( caf::PdmOptionItemInfo( "Mixed Branches", -1 ) ); if ( !m_uniqueBranchIndices.empty() )
{
options.push_front( caf::PdmOptionItemInfo( "Mixed Branches", -1 ) );
}
else
{
options.push_front( caf::PdmOptionItemInfo( "No Branches", -1 ) );
}
} }
} }
} }

View File

@ -42,18 +42,21 @@ class RimWellLogCurveCommonDataSource : public caf::PdmObject
public: public:
RimWellLogCurveCommonDataSource(); RimWellLogCurveCommonDataSource();
RimCase* caseToApply() const; RimCase* caseToApply() const;
void setCaseToApply( RimCase* val ); void setCaseToApply( RimCase* val );
int trajectoryTypeToApply() const; int trajectoryTypeToApply() const;
void setTrajectoryTypeToApply( int val ); void setTrajectoryTypeToApply( int val );
RimWellPath* wellPathToApply() const; RimWellPath* wellPathToApply() const;
void setWellPathToApply( RimWellPath* val ); void setWellPathToApply( RimWellPath* val );
void setBranchIndexToApply( int val ); int branchIndexToApply() const;
void setBranchDetectionToApply( caf::Tristate::State val ); void setBranchIndexToApply( int val );
QString simWellNameToApply() const; caf::Tristate branchDetectionToApply() const;
void setSimWellNameToApply( const QString& val ); void setBranchDetectionToApply( caf::Tristate::State val );
int timeStepToApply() const;
void setTimeStepToApply( int val ); QString simWellNameToApply() const;
void setSimWellNameToApply( const QString& val );
int timeStepToApply() const;
void setTimeStepToApply( int val );
void resetDefaultOptions(); void resetDefaultOptions();
void updateDefaultOptions( const std::vector<RimWellLogCurve*>& curves, const std::vector<RimWellLogTrack*>& tracks ); void updateDefaultOptions( const std::vector<RimWellLogCurve*>& curves, const std::vector<RimWellLogTrack*>& tracks );
@ -90,4 +93,12 @@ private:
caf::PdmField<int> m_branchIndex; caf::PdmField<int> m_branchIndex;
caf::PdmField<caf::Tristate> m_branchDetection; caf::PdmField<caf::Tristate> m_branchDetection;
caf::PdmField<int> m_timeStep; caf::PdmField<int> m_timeStep;
std::set<RimCase*> m_uniqueCases;
std::set<int> m_uniqueTrajectoryTypes;
std::set<RimWellPath*> m_uniqueWellPaths;
std::set<QString> m_uniqueWellNames;
std::set<int> m_uniqueTimeSteps;
std::set<bool> m_uniqueBranchDetection;
std::set<int> m_uniqueBranchIndices;
}; };

View File

@ -96,7 +96,7 @@ RimWellLogExtractionCurve::RimWellLogExtractionCurve()
CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Name", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Name", "", "", "" );
m_wellPath.uiCapability()->setUiTreeChildrenHidden( true ); m_wellPath.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitField( &m_simWellName, "SimulationWellName", QString( "None" ), "Well Name", "", "", "" ); CAF_PDM_InitField( &m_simWellName, "SimulationWellName", QString( "" ), "Well Name", "", "", "" );
CAF_PDM_InitField( &m_branchDetection, CAF_PDM_InitField( &m_branchDetection,
"BranchDetection", "BranchDetection",
true, true,
@ -195,7 +195,10 @@ RimCase* RimWellLogExtractionCurve::rimCase() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view ) void RimWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view )
{ {
m_case = view ? view->ownerCase() : nullptr; if ( view )
{
m_case = view->ownerCase();
}
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() ); RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() ); RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
@ -209,6 +212,10 @@ void RimWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view )
m_timeStep = eclipseView->currentTimeStep(); m_timeStep = eclipseView->currentTimeStep();
} }
else if ( eclipseCase )
{
m_eclipseResultDefinition->setResultVariable( "SOIL" );
}
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view ); RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view );
if ( geoMechView ) if ( geoMechView )
@ -216,6 +223,10 @@ void RimWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view )
m_geomResultDefinition->setResultAddress( geoMechView->cellResultResultDefinition()->resultAddress() ); m_geomResultDefinition->setResultAddress( geoMechView->cellResultResultDefinition()->resultAddress() );
m_timeStep = geoMechView->currentTimeStep(); m_timeStep = geoMechView->currentTimeStep();
} }
else if ( geomCase )
{
m_geomResultDefinition->setResultAddress( RigFemResultAddress( RIG_ELEMENT, "POR", "" ) );
}
clearGeneratedSimWellPaths(); clearGeneratedSimWellPaths();
} }
@ -276,7 +287,7 @@ void RimWellLogExtractionCurve::fieldChangedByUi( const caf::PdmFieldHandle* cha
clampTimestep(); clampTimestep();
auto wellNameSet = sortedSimWellNames(); auto wellNameSet = sortedSimWellNames();
if ( !wellNameSet.count( m_simWellName() ) ) m_simWellName = "None"; if ( !wellNameSet.count( m_simWellName() ) ) m_simWellName = "";
clearGeneratedSimWellPaths(); clearGeneratedSimWellPaths();
@ -321,123 +332,10 @@ void RimWellLogExtractionCurve::fieldChangedByUi( const caf::PdmFieldHandle* cha
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot ) void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
{ {
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
if ( isCurveVisible() ) if ( isCurveVisible() )
{ {
// Make sure we have set correct case data into the result definitions.
bool isUsingPseudoLength = false; bool isUsingPseudoLength = false;
extractData( &isUsingPseudoLength );
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
m_eclipseResultDefinition->setEclipseCase( eclipseCase );
m_geomResultDefinition->setGeoMechCase( geomCase );
clampBranchIndex();
RimMainPlotCollection* mainPlotCollection;
this->firstAncestorOrThisOfTypeAsserted( mainPlotCollection );
RimWellLogPlotCollection* wellLogCollection = mainPlotCollection->wellLogPlotCollection();
cvf::ref<RigEclipseWellLogExtractor> eclExtractor;
if ( eclipseCase )
{
if ( m_trajectoryType == WELL_PATH )
{
eclExtractor = wellLogCollection->findOrCreateExtractor( m_wellPath, eclipseCase );
}
else
{
std::vector<const RigWellPath*> simWellBranches =
RiaSimWellBranchTools::simulationWellBranches( m_simWellName, m_branchDetection );
if ( m_branchIndex >= 0 && m_branchIndex < static_cast<int>( simWellBranches.size() ) )
{
auto wellBranch = simWellBranches[m_branchIndex];
eclExtractor = wellLogCollection->findOrCreateSimWellExtractor( m_simWellName,
eclipseCase->caseUserDescription(),
wellBranch,
eclipseCase->eclipseCaseData() );
if ( eclExtractor.notNull() )
{
m_wellPathsWithExtractors.push_back( wellBranch );
}
isUsingPseudoLength = true;
}
}
}
cvf::ref<RigGeoMechWellLogExtractor> geomExtractor = wellLogCollection->findOrCreateExtractor( m_wellPath,
geomCase );
std::vector<double> values;
std::vector<double> measuredDepthValues;
std::vector<double> tvDepthValues;
RiaDefines::DepthUnitType depthUnit = RiaDefines::UNIT_METER;
if ( eclExtractor.notNull() && eclipseCase )
{
measuredDepthValues = eclExtractor->cellIntersectionMDs();
tvDepthValues = eclExtractor->cellIntersectionTVDs();
m_eclipseResultDefinition->loadResult();
cvf::ref<RigResultAccessor> resAcc =
RigResultAccessorFactory::createFromResultDefinition( eclipseCase->eclipseCaseData(),
0,
m_timeStep,
m_eclipseResultDefinition );
if ( resAcc.notNull() )
{
eclExtractor->curveData( resAcc.p(), &values );
}
RiaEclipseUnitTools::UnitSystem eclipseUnitsType = eclipseCase->eclipseCaseData()->unitsType();
if ( eclipseUnitsType == RiaEclipseUnitTools::UNITS_FIELD )
{
// See https://github.com/OPM/ResInsight/issues/538
depthUnit = RiaDefines::UNIT_FEET;
}
}
else if ( geomExtractor.notNull() ) // geomExtractor
{
measuredDepthValues = geomExtractor->cellIntersectionMDs();
tvDepthValues = geomExtractor->cellIntersectionTVDs();
findAndLoadWbsParametersFromLasFiles( m_wellPath(), geomExtractor.p() );
RimWellBoreStabilityPlot* wbsPlot;
this->firstAncestorOrThisOfType( wbsPlot );
if ( wbsPlot )
{
geomExtractor->setWbsParameters( wbsPlot->porePressureSource(),
wbsPlot->poissonRatioSource(),
wbsPlot->ucsSource(),
wbsPlot->userDefinedPoissonRatio(),
wbsPlot->userDefinedUcs() );
}
geomExtractor->setRkbDiff( rkbDiff() );
m_geomResultDefinition->loadResult();
geomExtractor->curveData( m_geomResultDefinition->resultAddress(), m_timeStep, &values );
}
m_curveData = new RigWellLogCurveData;
if ( values.size() && measuredDepthValues.size() )
{
if ( !tvDepthValues.size() )
{
m_curveData->setValuesAndMD( values, measuredDepthValues, depthUnit, true );
}
else
{
m_curveData->setValuesWithTVD( values, measuredDepthValues, tvDepthValues, depthUnit, true );
}
}
RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_METER; RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_METER;
@ -464,6 +362,8 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
m_qwtPlotCurve->setLineSegmentStartStopIndices( m_curveData->polylineStartStopIndices() ); m_qwtPlotCurve->setLineSegmentStartStopIndices( m_curveData->polylineStartStopIndices() );
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
if ( isUsingPseudoLength ) if ( isUsingPseudoLength )
{ {
RimWellLogTrack* wellLogTrack; RimWellLogTrack* wellLogTrack;
@ -491,6 +391,125 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::extractData( bool* isUsingPseudoLength )
{
CAF_ASSERT( isUsingPseudoLength );
// Make sure we have set correct case data into the result definitions.
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
m_eclipseResultDefinition->setEclipseCase( eclipseCase );
m_geomResultDefinition->setGeoMechCase( geomCase );
clampBranchIndex();
RimMainPlotCollection* mainPlotCollection;
this->firstAncestorOrThisOfTypeAsserted( mainPlotCollection );
RimWellLogPlotCollection* wellLogCollection = mainPlotCollection->wellLogPlotCollection();
cvf::ref<RigEclipseWellLogExtractor> eclExtractor;
if ( eclipseCase )
{
if ( m_trajectoryType == WELL_PATH )
{
eclExtractor = wellLogCollection->findOrCreateExtractor( m_wellPath, eclipseCase );
}
else
{
std::vector<const RigWellPath*> simWellBranches =
RiaSimWellBranchTools::simulationWellBranches( m_simWellName, m_branchDetection );
if ( m_branchIndex >= 0 && m_branchIndex < static_cast<int>( simWellBranches.size() ) )
{
auto wellBranch = simWellBranches[m_branchIndex];
eclExtractor = wellLogCollection->findOrCreateSimWellExtractor( m_simWellName,
eclipseCase->caseUserDescription(),
wellBranch,
eclipseCase->eclipseCaseData() );
if ( eclExtractor.notNull() )
{
m_wellPathsWithExtractors.push_back( wellBranch );
}
*isUsingPseudoLength = true;
}
}
}
cvf::ref<RigGeoMechWellLogExtractor> geomExtractor = wellLogCollection->findOrCreateExtractor( m_wellPath, geomCase );
std::vector<double> values;
std::vector<double> measuredDepthValues;
std::vector<double> tvDepthValues;
RiaDefines::DepthUnitType depthUnit = RiaDefines::UNIT_METER;
if ( eclExtractor.notNull() && eclipseCase )
{
measuredDepthValues = eclExtractor->cellIntersectionMDs();
tvDepthValues = eclExtractor->cellIntersectionTVDs();
m_eclipseResultDefinition->loadResult();
cvf::ref<RigResultAccessor> resAcc =
RigResultAccessorFactory::createFromResultDefinition( eclipseCase->eclipseCaseData(),
0,
m_timeStep,
m_eclipseResultDefinition );
if ( resAcc.notNull() )
{
eclExtractor->curveData( resAcc.p(), &values );
}
RiaEclipseUnitTools::UnitSystem eclipseUnitsType = eclipseCase->eclipseCaseData()->unitsType();
if ( eclipseUnitsType == RiaEclipseUnitTools::UNITS_FIELD )
{
// See https://github.com/OPM/ResInsight/issues/538
depthUnit = RiaDefines::UNIT_FEET;
}
}
else if ( geomExtractor.notNull() ) // geomExtractor
{
measuredDepthValues = geomExtractor->cellIntersectionMDs();
tvDepthValues = geomExtractor->cellIntersectionTVDs();
findAndLoadWbsParametersFromLasFiles( m_wellPath(), geomExtractor.p() );
RimWellBoreStabilityPlot* wbsPlot;
this->firstAncestorOrThisOfType( wbsPlot );
if ( wbsPlot )
{
geomExtractor->setWbsParameters( wbsPlot->porePressureSource(),
wbsPlot->poissonRatioSource(),
wbsPlot->ucsSource(),
wbsPlot->userDefinedPoissonRatio(),
wbsPlot->userDefinedUcs() );
}
geomExtractor->setRkbDiff( rkbDiff() );
m_geomResultDefinition->loadResult();
geomExtractor->curveData( m_geomResultDefinition->resultAddress(), m_timeStep, &values );
}
m_curveData = new RigWellLogCurveData;
if ( values.size() && measuredDepthValues.size() )
{
if ( !tvDepthValues.size() )
{
m_curveData->setValuesAndMD( values, measuredDepthValues, depthUnit, true );
}
else
{
m_curveData->setValuesWithTVD( values, measuredDepthValues, tvDepthValues, depthUnit, true );
}
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Search well path for LAS-files containing Well Bore Stability data and set them in the extractor. /// Search well path for LAS-files containing Well Bore Stability data and set them in the extractor.
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -584,14 +603,10 @@ QList<caf::PdmOptionItemInfo>
if ( fieldNeedingOptions == &m_wellPath ) if ( fieldNeedingOptions == &m_wellPath )
{ {
RimTools::wellPathOptionItems( &options ); RimTools::wellPathOptionItems( &options );
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
} }
else if ( fieldNeedingOptions == &m_case ) else if ( fieldNeedingOptions == &m_case )
{ {
RimTools::caseOptionItems( &options ); RimTools::caseOptionItems( &options );
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
} }
else if ( fieldNeedingOptions == &m_timeStep ) else if ( fieldNeedingOptions == &m_timeStep )
{ {
@ -616,11 +631,6 @@ QList<caf::PdmOptionItemInfo>
{ {
options.push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) ); options.push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) );
} }
if ( options.size() == 0 )
{
options.push_front( caf::PdmOptionItemInfo( "None", "None" ) );
}
} }
else if ( fieldNeedingOptions == &m_branchIndex ) else if ( fieldNeedingOptions == &m_branchIndex )
{ {

View File

@ -89,6 +89,7 @@ public:
protected: protected:
QString createCurveAutoName() override; QString createCurveAutoName() override;
void onLoadDataAndUpdate( bool updateParentPlot ) override; void onLoadDataAndUpdate( bool updateParentPlot ) override;
void extractData( bool* isUsingPseudoLength );
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue, const QVariant& oldValue,

View File

@ -289,11 +289,6 @@ void RimWellLogTrack::simWellOptionItems( QList<caf::PdmOptionItemInfo>* options
{ {
options->push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) ); options->push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) );
} }
if ( options->size() == 0 )
{
options->push_front( caf::PdmOptionItemInfo( "None", "None" ) );
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -606,18 +601,14 @@ QList<caf::PdmOptionItemInfo> RimWellLogTrack::calculateValueOptions( const caf:
if ( fieldNeedingOptions == &m_formationWellPathForSourceCase ) if ( fieldNeedingOptions == &m_formationWellPathForSourceCase )
{ {
RimTools::wellPathOptionItems( &options ); RimTools::wellPathOptionItems( &options );
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
} }
else if ( fieldNeedingOptions == &m_formationWellPathForSourceWellPath ) else if ( fieldNeedingOptions == &m_formationWellPathForSourceWellPath )
{ {
RimTools::wellPathWithFormationsOptionItems( &options ); RimTools::wellPathWithFormationsOptionItems( &options );
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
} }
else if ( fieldNeedingOptions == &m_formationCase ) else if ( fieldNeedingOptions == &m_formationCase )
{ {
RimTools::caseOptionItems( &options ); RimTools::caseOptionItems( &options );
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
} }
else if ( fieldNeedingOptions == &m_formationSimWellName ) else if ( fieldNeedingOptions == &m_formationSimWellName )
{ {
@ -769,7 +760,7 @@ void RimWellLogTrack::availableDepthRange( double* minimumDepth, double* maximum
double minCurveDepth = HUGE_VAL; double minCurveDepth = HUGE_VAL;
double maxCurveDepth = -HUGE_VAL; double maxCurveDepth = -HUGE_VAL;
if ( curve->isCurveVisible() && curve->yValueRange( &minCurveDepth, &maxCurveDepth ) ) if ( curve->isCurveVisible() && curve->yValueRangeInQwt( &minCurveDepth, &maxCurveDepth ) )
{ {
if ( minCurveDepth < minDepth ) if ( minCurveDepth < minDepth )
{ {
@ -986,6 +977,30 @@ void RimWellLogTrack::setFormationSimWellName( const QString& simWellName )
m_formationSimWellName = simWellName; m_formationSimWellName = simWellName;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogTrack::formationSimWellName() const
{
return m_formationSimWellName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setFormationBranchDetection( bool branchDetection )
{
m_formationBranchDetection = branchDetection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogTrack::formationBranchDetection() const
{
return m_formationBranchDetection();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -994,6 +1009,14 @@ void RimWellLogTrack::setFormationBranchIndex( int branchIndex )
m_formationBranchIndex = branchIndex; m_formationBranchIndex = branchIndex;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellLogTrack::formationBranchIndex() const
{
return m_formationBranchIndex;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1002,6 +1025,14 @@ void RimWellLogTrack::setFormationCase( RimCase* rimCase )
m_formationCase = rimCase; m_formationCase = rimCase;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCase* RimWellLogTrack::formationNamesCase() const
{
return m_formationCase();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1013,9 +1044,9 @@ void RimWellLogTrack::setFormationTrajectoryType( TrajectoryType trajectoryType
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimCase* RimWellLogTrack::formationNamesCase() const RimWellLogTrack::TrajectoryType RimWellLogTrack::formationTrajectoryType() const
{ {
return m_formationCase(); return m_formationTrajectoryType();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1144,7 +1175,7 @@ void RimWellLogTrack::calculateXZoomRange()
if ( curve->isCurveVisible() ) if ( curve->isCurveVisible() )
{ {
visibleCurves++; visibleCurves++;
if ( curve->xValueRange( &minCurveValue, &maxCurveValue ) ) if ( curve->xValueRangeInData( &minCurveValue, &maxCurveValue ) )
{ {
if ( minCurveValue < minValue ) if ( minCurveValue < minValue )
{ {
@ -1248,9 +1279,9 @@ void RimWellLogTrack::setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setShowFormations( bool on ) void RimWellLogTrack::setShowFormations( RiuPlotAnnotationTool::FormationDisplay formationDisplay )
{ {
m_showFormations_OBSOLETE = on; m_formationDisplay = formationDisplay;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1258,7 +1289,7 @@ void RimWellLogTrack::setShowFormations( bool on )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellLogTrack::showFormations() const bool RimWellLogTrack::showFormations() const
{ {
return m_showFormations_OBSOLETE; return m_formationDisplay() != RiuPlotAnnotationTool::NONE;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1324,23 +1355,23 @@ RimWellLogCurve* RimWellLogTrack::curveDefinitionFromCurve( const QwtPlotCurve*
void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
uiOrdering.add( &m_userName ); uiOrdering.add( &m_userName );
caf::PdmUiGroup* formationGroup = uiOrdering.addNewGroup( "Zonation/Formation Names" ); caf::PdmUiGroup* annotationGroup = uiOrdering.addNewGroup( "Regions/Annotations" );
formationGroup->add( &m_formationDisplay ); annotationGroup->add( &m_formationDisplay );
if ( m_formationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING || if ( m_formationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING ||
m_formationDisplay() & RiuPlotAnnotationTool::COLORED_LINES ) m_formationDisplay() & RiuPlotAnnotationTool::COLORED_LINES )
{ {
formationGroup->add( &m_colorShadingPalette ); annotationGroup->add( &m_colorShadingPalette );
if ( m_formationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING ) if ( m_formationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING )
{ {
formationGroup->add( &m_colorShadingTransparency ); annotationGroup->add( &m_colorShadingTransparency );
} }
} }
formationGroup->add( &m_showFormationLabels ); annotationGroup->add( &m_showFormationLabels );
if ( !m_formationsForCaseWithSimWellOnly ) if ( !m_formationsForCaseWithSimWellOnly )
{ {
formationGroup->add( &m_formationSource ); annotationGroup->add( &m_formationSource );
} }
else else
{ {
@ -1349,23 +1380,23 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
if ( m_formationSource() == CASE ) if ( m_formationSource() == CASE )
{ {
formationGroup->add( &m_formationCase ); annotationGroup->add( &m_formationCase );
if ( !m_formationsForCaseWithSimWellOnly ) if ( !m_formationsForCaseWithSimWellOnly )
{ {
formationGroup->add( &m_formationTrajectoryType ); annotationGroup->add( &m_formationTrajectoryType );
if ( m_formationTrajectoryType() == WELL_PATH ) if ( m_formationTrajectoryType() == WELL_PATH )
{ {
formationGroup->add( &m_formationWellPathForSourceCase ); annotationGroup->add( &m_formationWellPathForSourceCase );
} }
} }
if ( m_formationsForCaseWithSimWellOnly || m_formationTrajectoryType() == SIMULATION_WELL ) if ( m_formationsForCaseWithSimWellOnly || m_formationTrajectoryType() == SIMULATION_WELL )
{ {
formationGroup->add( &m_formationSimWellName ); annotationGroup->add( &m_formationSimWellName );
RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName( formationGroup, RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName( annotationGroup,
m_formationSimWellName, m_formationSimWellName,
m_formationBranchDetection, m_formationBranchDetection,
m_formationBranchIndex ); m_formationBranchIndex );
@ -1373,11 +1404,11 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
} }
else if ( m_formationSource() == WELL_PICK_FILTER ) else if ( m_formationSource() == WELL_PICK_FILTER )
{ {
formationGroup->add( &m_formationWellPathForSourceWellPath ); annotationGroup->add( &m_formationWellPathForSourceWellPath );
if ( m_formationWellPathForSourceWellPath() ) if ( m_formationWellPathForSourceWellPath() )
{ {
formationGroup->add( &m_formationLevel ); annotationGroup->add( &m_formationLevel );
formationGroup->add( &m_showformationFluids ); annotationGroup->add( &m_showformationFluids );
} }
} }
@ -1653,7 +1684,7 @@ RigEclipseWellLogExtractor* RimWellLogTrack::createSimWellExtractor( RimWellLogP
if ( wellPaths.size() == 0 ) return nullptr; if ( wellPaths.size() == 0 ) return nullptr;
CVF_ASSERT( branchIndex < static_cast<int>( wellPaths.size() ) ); CVF_ASSERT( branchIndex >= 0 && branchIndex < static_cast<int>( wellPaths.size() ) );
return ( wellLogCollection->findOrCreateSimWellExtractor( simWellName, return ( wellLogCollection->findOrCreateSimWellExtractor( simWellName,
QString( "Find or create sim well extractor" ), QString( "Find or create sim well extractor" ),

View File

@ -108,13 +108,18 @@ public:
int widthScaleFactor() const; int widthScaleFactor() const;
void setWidthScaleFactor( WidthScaleFactor scaleFactor ); void setWidthScaleFactor( WidthScaleFactor scaleFactor );
void setFormationWellPath( RimWellPath* wellPath ); void setFormationWellPath( RimWellPath* wellPath );
RimWellPath* formationWellPath() const; RimWellPath* formationWellPath() const;
void setFormationSimWellName( const QString& simWellName ); void setFormationSimWellName( const QString& simWellName );
void setFormationBranchIndex( int branchIndex ); QString formationSimWellName() const;
void setFormationCase( RimCase* rimCase ); void setFormationBranchDetection( bool branchDetection );
void setFormationTrajectoryType( TrajectoryType trajectoryType ); bool formationBranchDetection() const;
RimCase* formationNamesCase() const; void setFormationBranchIndex( int branchIndex );
int formationBranchIndex() const;
void setFormationCase( RimCase* rimCase );
RimCase* formationNamesCase() const;
void setFormationTrajectoryType( TrajectoryType trajectoryType );
TrajectoryType formationTrajectoryType() const;
void recreateViewer(); void recreateViewer();
void detachAllCurves(); void detachAllCurves();
@ -140,7 +145,7 @@ public:
void setVisibleXRange( double minValue, double maxValue ); void setVisibleXRange( double minValue, double maxValue );
void setTickIntervals( double majorTickInterval, double minorTickInterval ); void setTickIntervals( double majorTickInterval, double minorTickInterval );
void setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility gridLines ); void setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility gridLines );
void setShowFormations( bool on ); void setShowFormations( RiuPlotAnnotationTool::FormationDisplay formationDisplay );
bool showFormations() const; bool showFormations() const;
void setShowFormationLabels( bool on ); void setShowFormationLabels( bool on );