Merge branch 'main' into dev

This commit is contained in:
Magne Sjaastad
2024-04-25 09:34:11 +02:00
12 changed files with 125 additions and 40 deletions

View File

@@ -102,6 +102,10 @@ bool RiaResultNames::isFlowResultWithBothPosAndNegValues( const QString& resultN
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaResultNames::isCategoryResult( const QString& resultName ) bool RiaResultNames::isCategoryResult( const QString& resultName )
{ {
static std::set<QString> excludedResultNames = { "FIPOIL", "FIPGAS", "FIPWAT" };
if ( excludedResultNames.find( resultName.toUpper() ) != excludedResultNames.end() ) return false;
if ( resultName.endsWith( "NUM", Qt::CaseInsensitive ) ) return true; if ( resultName.endsWith( "NUM", Qt::CaseInsensitive ) ) return true;
if ( resultName.startsWith( "FIP", Qt::CaseInsensitive ) ) return true; if ( resultName.startsWith( "FIP", Qt::CaseInsensitive ) ) return true;

View File

@@ -22,6 +22,7 @@
#include "RigEclipseCaseData.h" #include "RigEclipseCaseData.h"
#include "RigFemPartCollection.h" #include "RigFemPartCollection.h"
#include "Polygons/RimPolygonInView.h"
#include "Rim3dView.h" #include "Rim3dView.h"
#include "RimCellEdgeColors.h" #include "RimCellEdgeColors.h"
#include "RimCellFilterCollection.h" #include "RimCellFilterCollection.h"
@@ -37,8 +38,7 @@
#include "RimGeoMechContourMapView.h" #include "RimGeoMechContourMapView.h"
#include "RimGeoMechContourMapViewCollection.h" #include "RimGeoMechContourMapViewCollection.h"
#include "RimGeoMechView.h" #include "RimGeoMechView.h"
#include "RimOilField.h" #include "RimPolygonFilter.h"
#include "RimProject.h"
#include "RimRegularLegendConfig.h" #include "RimRegularLegendConfig.h"
#include "RimSimWellInViewCollection.h" #include "RimSimWellInViewCollection.h"
#include "RimSurfaceInViewCollection.h" #include "RimSurfaceInViewCollection.h"
@@ -277,6 +277,30 @@ RimEclipseContourMapView* RicNewContourMapViewFeature::createEclipseContourMapFr
eclipseCase->contourMapCollection()->updateConnectedEditors(); eclipseCase->contourMapCollection()->updateConnectedEditors();
// Polygon cell filters are not working due to different organization of the project tree for Eclipse view and contour map view
// Manually assign pointers to polygon objects
//
// TODO: Find a more robust solution, perhaps introduce a root token making it possible to have a reference string pointing to objects
// relative root "$root$ PolygonCollection 0 Polygon 2"
// Make sure this concept works for geomech contour maps
auto sourceFilters = sourceView->cellFilterCollection()->filters();
auto destinationFilters = contourMap->cellFilterCollection()->filters();
if ( sourceFilters.size() == destinationFilters.size() )
{
for ( size_t i = 0; i < sourceFilters.size(); ++i )
{
auto sourcePolygonFilter = dynamic_cast<RimPolygonFilter*>( sourceFilters[i] );
auto destinationPolygonFilter = dynamic_cast<RimPolygonFilter*>( destinationFilters[i] );
if ( sourcePolygonFilter && sourcePolygonFilter->polygonInView() && destinationPolygonFilter )
{
destinationPolygonFilter->setPolygon( sourcePolygonFilter->polygonInView()->polygon() );
destinationPolygonFilter->configurePolygonEditor();
}
}
}
return contourMap; return contourMap;
} }

View File

@@ -19,6 +19,8 @@
#include "RicNewPltPlotFeature.h" #include "RicNewPltPlotFeature.h"
#include "RiaLogging.h"
#include "RicNewWellLogPlotFeatureImpl.h" #include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogPlotCurveFeatureImpl.h" #include "RicWellLogPlotCurveFeatureImpl.h"
@@ -84,6 +86,15 @@ bool RicNewPltPlotFeature::isCommandEnabled() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewPltPlotFeature::onActionTriggered( bool isChecked ) void RicNewPltPlotFeature::onActionTriggered( bool isChecked )
{ {
if ( RimWellPlotTools::wellPathsContainingFlow().empty() )
{
QString displayMessage =
"To create a PLT plot, either import a LAS file with observed production data or import a well path trajectory.";
RiaLogging::errorInMessageBox( nullptr, "No well data available to create a PLT plot", displayMessage );
return;
}
RimPltPlotCollection* pltPlotColl = RimMainPlotCollection::current()->pltPlotCollection(); RimPltPlotCollection* pltPlotColl = RimMainPlotCollection::current()->pltPlotCollection();
if ( pltPlotColl ) if ( pltPlotColl )
{ {
@@ -116,7 +127,6 @@ void RicNewPltPlotFeature::onActionTriggered( bool isChecked )
pltPlot->nameConfig()->setCustomName( plotName ); pltPlot->nameConfig()->setCustomName( plotName );
pltPlot->setNamingMethod( RiaDefines::ObjectNamingMethod::CUSTOM ); pltPlot->setNamingMethod( RiaDefines::ObjectNamingMethod::CUSTOM );
// pltPlot->applyInitialSelections();
pltPlot->loadDataAndUpdate(); pltPlot->loadDataAndUpdate();
pltPlotColl->updateConnectedEditors(); pltPlotColl->updateConnectedEditors();

View File

@@ -705,6 +705,20 @@ RimWellPath* RimWellPlotTools::wellPathByWellPathNameOrSimWellName( const QStrin
return wellPath != nullptr ? wellPath : proj->wellPathFromSimWellName( wellPathNameOrSimwellName ); return wellPath != nullptr ? wellPath : proj->wellPathFromSimWellName( wellPathNameOrSimwellName );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPath*> RimWellPlotTools::wellPathsContainingFlow()
{
std::vector<RimWellPath*> wellPaths;
for ( RimWellPath* wellPath : RimProject::current()->allWellPaths() )
{
if ( wellPath->wellPathGeometry() || RimWellPlotTools::hasFlowData( wellPath ) ) wellPaths.push_back( wellPath );
}
return wellPaths;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -77,6 +77,7 @@ public:
static std::vector<RimWellLogFile*> wellLogFilesContainingFlow( const QString& wellName ); static std::vector<RimWellLogFile*> wellLogFilesContainingFlow( const QString& wellName );
static RimWellPath* wellPathByWellPathNameOrSimWellName( const QString& wellPathNameOrSimwellName ); static RimWellPath* wellPathByWellPathNameOrSimWellName( const QString& wellPathNameOrSimwellName );
static std::vector<RimWellPath*> wellPathsContainingFlow();
// RFT Only // RFT Only
private: private:

View File

@@ -1031,18 +1031,11 @@ void RimWellPltPlot::syncSourcesIoFieldFromGuiField()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellPltPlot::calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo>& options ) void RimWellPltPlot::calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo>& options )
{ {
RimProject* proj = RimProject::current(); auto wellPathsContainingFlowData = RimWellPlotTools::wellPathsContainingFlow();
for ( const RimWellPath* const wellPath : wellPathsContainingFlowData )
if ( proj != nullptr )
{ {
// Observed wells const QString wellName = wellPath->name();
for ( const RimWellPath* const wellPath : proj->allWellPaths() ) options.push_back( caf::PdmOptionItemInfo( wellName, wellName ) );
{
const QString wellName = wellPath->name();
if ( wellPath->wellPathGeometry() || RimWellPlotTools::hasFlowData( wellPath ) )
options.push_back( caf::PdmOptionItemInfo( wellName, wellName ) );
}
} }
options.push_back( caf::PdmOptionItemInfo( "None", "" ) ); options.push_back( caf::PdmOptionItemInfo( "None", "" ) );

View File

@@ -23,6 +23,7 @@
#include "RiuViewer.h" #include "RiuViewer.h"
#include "RivContourMapProjectionPartMgr.h" #include "RivContourMapProjectionPartMgr.h"
#include "Polygons/RimPolygonInViewCollection.h"
#include "Rim3dOverlayInfoConfig.h" #include "Rim3dOverlayInfoConfig.h"
#include "RimAnnotationInViewCollection.h" #include "RimAnnotationInViewCollection.h"
#include "RimCase.h" #include "RimCase.h"
@@ -231,9 +232,10 @@ void RimEclipseContourMapView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiT
cellResult()->uiCapability()->setUiReadOnly( m_contourMapProjection->isColumnResult() ); cellResult()->uiCapability()->setUiReadOnly( m_contourMapProjection->isColumnResult() );
uiTreeOrdering.add( wellCollection() ); uiTreeOrdering.add( wellCollection() );
uiTreeOrdering.add( faultCollection() ); uiTreeOrdering.add( faultCollection() );
uiTreeOrdering.add( annotationCollection() );
uiTreeOrdering.add( m_cellFilterCollection() ); uiTreeOrdering.add( m_cellFilterCollection() );
uiTreeOrdering.add( nativePropertyFilterCollection() ); uiTreeOrdering.add( nativePropertyFilterCollection() );
uiTreeOrdering.add( m_polygonInViewCollection );
uiTreeOrdering.add( annotationCollection() );
uiTreeOrdering.skipRemainingChildren(); uiTreeOrdering.skipRemainingChildren();
} }

View File

@@ -20,6 +20,7 @@
#include "RiaColorTables.h" #include "RiaColorTables.h"
#include "RiaColorTools.h" #include "RiaColorTools.h"
#include "RiaLogging.h"
#include "RigAllanDiagramData.h" #include "RigAllanDiagramData.h"
#include "RigCaseCellResultsData.h" #include "RigCaseCellResultsData.h"
@@ -633,12 +634,6 @@ void RimEclipseResultDefinitionTools::updateCellResultLegend( const RimEclipseRe
std::iota( uniqueValues.begin(), uniqueValues.end(), 0 ); std::iota( uniqueValues.begin(), uniqueValues.end(), 0 );
} }
cvf::Color3ubArray legendBaseColors = legendConfigToUpdate->colorLegend()->colorArray();
cvf::ref<caf::CategoryMapper> categoryMapper = new caf::CategoryMapper;
categoryMapper->setCategories( uniqueValues );
categoryMapper->setInterpolateColors( legendBaseColors );
std::vector<int> visibleCategoryValues = uniqueValues; std::vector<int> visibleCategoryValues = uniqueValues;
if ( resultDefinition->showOnlyVisibleCategoriesInLegend() ) if ( resultDefinition->showOnlyVisibleCategoriesInLegend() )
@@ -658,6 +653,26 @@ void RimEclipseResultDefinitionTools::updateCellResultLegend( const RimEclipseRe
} }
} }
} }
const size_t maxCategoryCount = 500;
if ( legendConfigToUpdate->mappingMode() == RimRegularLegendConfig::MappingType::CATEGORY_INTEGER &&
visibleCategoryValues.size() > maxCategoryCount )
{
QString txt = QString( "Detected %1 category values. Maximum number of categories is %2. Only the first %2 "
"categories will be displayed. Please use a different color mapping." )
.arg( visibleCategoryValues.size() )
.arg( maxCategoryCount );
RiaLogging::error( txt );
visibleCategoryValues.resize( maxCategoryCount );
}
cvf::Color3ubArray legendBaseColors = legendConfigToUpdate->colorLegend()->colorArray();
cvf::ref<caf::CategoryMapper> categoryMapper = new caf::CategoryMapper;
categoryMapper->setCategories( visibleCategoryValues );
categoryMapper->setInterpolateColors( legendBaseColors );
std::vector<std::tuple<QString, int, cvf::Color3ub>> categoryVector; std::vector<std::tuple<QString, int, cvf::Color3ub>> categoryVector;
for ( auto value : visibleCategoryValues ) for ( auto value : visibleCategoryValues )

View File

@@ -651,23 +651,24 @@ std::vector<caf::PdmFieldHandle*> RimSummaryMultiPlot::fieldsToShowInToolbar()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimSummaryMultiPlot::handleGlobalKeyEvent( QKeyEvent* keyEvent ) bool RimSummaryMultiPlot::handleGlobalKeyEvent( QKeyEvent* keyEvent )
{ {
if ( !RimSummaryPlotControls::handleKeyEvents( m_sourceStepping(), keyEvent ) ) bool isHandled = RimSummaryPlotControls::handleKeyEvents( m_sourceStepping(), keyEvent );
if ( !isHandled && isMouseCursorInsidePlot() )
{ {
if ( isMouseCursorInsidePlot() ) if ( keyEvent->key() == Qt::Key_PageUp )
{ {
if ( keyEvent->key() == Qt::Key_PageUp ) m_viewer->goToPrevPage();
{ return true;
m_viewer->goToPrevPage(); }
return true;
} if ( keyEvent->key() == Qt::Key_PageDown )
else if ( keyEvent->key() == Qt::Key_PageDown ) {
{ m_viewer->goToNextPage();
m_viewer->goToNextPage(); return true;
return true;
}
} }
} }
return false;
return isHandled;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -2942,7 +2942,10 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
RigEclipseResultAddress( RiaDefines::ResultCatType::FORMATION_NAMES, RigEclipseResultAddress( RiaDefines::ResultCatType::FORMATION_NAMES,
RiaResultNames::activeFormationNamesResultName() ) ); RiaResultNames::activeFormationNamesResultName() ) );
curveData = RimWellLogTrack::curveSamplingPointData( eclWellLogExtractor, resultAccessor.p() ); if ( resultAccessor.notNull() )
{
curveData = RimWellLogTrack::curveSamplingPointData( eclWellLogExtractor, resultAccessor.p() );
}
} }
else else
{ {

View File

@@ -1617,11 +1617,7 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResultForTimeStep( const Rig
size_t scalarResultIndex = findScalarResultIndexFromAddress( resVarAddr ); size_t scalarResultIndex = findScalarResultIndexFromAddress( resVarAddr );
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T ) return cvf::UNDEFINED_SIZE_T; if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T ) return cvf::UNDEFINED_SIZE_T;
if ( type == RiaDefines::ResultCatType::GENERATED ) return scalarResultIndex;
if ( type == RiaDefines::ResultCatType::GENERATED )
{
return cvf::UNDEFINED_SIZE_T;
}
if ( m_readerInterface.notNull() ) if ( m_readerInterface.notNull() )
{ {

View File

@@ -737,6 +737,28 @@ std::vector<RigFlowDiagSolverInterface::RelPermCurve> RigFlowDiagSolverInterface
return retCurveArr; return retCurveArr;
} }
// For unknown reasons, the ECLSaturationFunc returns a KROG curve when there is no gas in the system.
// Remove invalid KROG curve if no KRG curve is present
// https://github.com/OPM/ResInsight/issues/11396
bool hasKRG = false;
for ( const RelPermCurve& curve : retCurveArr )
{
if ( curve.ident == RelPermCurve::KRG )
{
hasKRG = true;
break;
}
}
if ( !hasKRG )
{
retCurveArr.erase( std::remove_if( retCurveArr.begin(),
retCurveArr.end(),
[]( const RelPermCurve& curve ) { return curve.ident == RelPermCurve::KROG; } ),
retCurveArr.end() );
}
return retCurveArr; return retCurveArr;
} }