From a612da649cb79660a608771d9a36d7b2b6ce2aa6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 28 Feb 2020 11:20:02 +0100 Subject: [PATCH] #5593 Saturation Pressure Plot: Clamp time step index --- .../CellFilters/RimPlotCellPropertyFilter.cpp | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellPropertyFilter.cpp b/ApplicationCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellPropertyFilter.cpp index 7730f3e935..9139e5b580 100644 --- a/ApplicationCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellPropertyFilter.cpp +++ b/ApplicationCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellPropertyFilter.cpp @@ -30,6 +30,8 @@ #include "cafPdmUiDoubleSliderEditor.h" +#include + CAF_PDM_SOURCE_INIT( RimPlotCellPropertyFilter, "RimPlotCellPropertyFilter" ); //-------------------------------------------------------------------------------------------------- @@ -142,10 +144,12 @@ void RimPlotCellPropertyFilter::updateCellVisibilityFromFilter( size_t timeStepI RigCaseCellResultsData* cellResultsData = resDef->currentGridCellResults(); if ( !cellResultsData ) return; - if ( !resDef->currentGridCellResults()->hasResultEntry( resDef->eclipseResultAddress() ) ) return; + RigEclipseResultAddress rigEclipseAddress = resDef->eclipseResultAddress(); - const std::vector& cellResultValues = - cellResultsData->cellScalarResults( resDef->eclipseResultAddress(), timeStepIndex ); + if ( !resDef->currentGridCellResults()->hasResultEntry( rigEclipseAddress ) ) return; + + size_t clampedIndex = std::min( timeStepIndex, cellResultsData->timeStepCount( rigEclipseAddress ) - 1 ); + const std::vector& cellResultValues = cellResultsData->cellScalarResults( rigEclipseAddress, clampedIndex ); if ( cellResultValues.empty() ) return; const RigActiveCellInfo* actCellInfo = cellResultsData->activeCellInfo(); @@ -162,12 +166,12 @@ void RimPlotCellPropertyFilter::updateCellVisibilityFromFilter( size_t timeStepI return; } - bool isUsingGlobalActiveIndex = cellResultsData->isUsingGlobalActiveIndex( resDef->eclipseResultAddress() ); - double lowerBound = m_lowerBound; - double upperBound = m_upperBound; - size_t cellResultIndex = 0; - double scalarValue = 0.0; - FilterModeType currentFilterMode = filterMode(); + bool isUsingGlobalActiveIndex = cellResultsData->isUsingGlobalActiveIndex( rigEclipseAddress ); + double lowerBound = m_lowerBound; + double upperBound = m_upperBound; + size_t cellResultIndex = 0; + double scalarValue = 0.0; + FilterModeType currentFilterMode = filterMode(); for ( size_t reservoirCellIndex = 0; reservoirCellIndex < totalReservoirCellCount; ++reservoirCellIndex ) {