#5593 Saturation Pressure Plot: Clamp time step index

This commit is contained in:
Magne Sjaastad 2020-02-28 11:20:02 +01:00
parent 92e579fa73
commit a612da649c

View File

@ -30,6 +30,8 @@
#include "cafPdmUiDoubleSliderEditor.h"
#include <algorithm>
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<double>& 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<double>& 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 )
{