#12121 Fix wrong display of fracture values in grid cross plot

This commit is contained in:
Magne Sjaastad 2025-02-03 14:11:52 +01:00
parent 10afd3a7cd
commit 0c8a056b0d
3 changed files with 44 additions and 45 deletions

View File

@ -508,20 +508,16 @@ void RimGridCrossPlotDataSet::onLoadDataAndUpdate( bool updateParentPlot )
legendConfig()->setMappingMode( RimRegularLegendConfig::MappingType::LINEAR_DISCRETE );
}
RigEclipseResultAddress xAddress( m_xAxisProperty->resultType(), m_xAxisProperty->resultVariable() );
RigEclipseResultAddress yAddress( m_yAxisProperty->resultType(), m_yAxisProperty->resultVariable() );
RigEclipseResultAddress groupAddress( m_groupingProperty->resultType(), m_groupingProperty->resultVariable() );
std::map<int, cvf::UByteArray> timeStepCellVisibilityMap = calculateCellVisibility( eclipseCase );
updateLegendRange();
RigEclipseCrossPlotResult result = RigEclipseCrossPlotDataExtractor::extract( eclipseCase->eclipseCaseData(),
m_timeStep(),
xAddress,
yAddress,
*m_xAxisProperty,
*m_yAxisProperty,
m_grouping(),
groupAddress,
*m_groupingProperty,
timeStepCellVisibilityMap );
if ( isXAxisLogarithmic() || isYAxisLogarithmic() )

View File

@ -15,10 +15,13 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigEclipseCrossPlotDataExtractor.h"
#include "RiaQDateTimeTools.h"
#include "RimEclipseResultDefinition.h"
#include "RigActiveCellInfo.h"
#include "RigActiveCellsResultAccessor.h"
#include "RigCaseCellResultsData.h"
@ -33,44 +36,42 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseCrossPlotResult RigEclipseCrossPlotDataExtractor::extract( RigEclipseCaseData* caseData,
int resultTimeStep,
const RigEclipseResultAddress& xAddress,
const RigEclipseResultAddress& yAddress,
RigGridCrossPlotCurveGrouping groupingType,
const RigEclipseResultAddress& groupAddress,
std::map<int, cvf::UByteArray> timeStepCellVisibilityMap )
RigEclipseCrossPlotResult RigEclipseCrossPlotDataExtractor::extract( RigEclipseCaseData* caseData,
int resultTimeStep,
const RimEclipseResultDefinition& xAddress,
const RimEclipseResultDefinition& yAddress,
RigGridCrossPlotCurveGrouping groupingType,
const RimEclipseResultDefinition& groupAddress,
std::map<int, cvf::UByteArray> timeStepCellVisibilityMap )
{
RigEclipseCrossPlotResult result;
RigCaseCellResultsData* resultData = caseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
if ( !resultData ) return result;
const std::vector<std::vector<double>>* catValuesForAllSteps = nullptr;
if ( xAddress.isValid() && yAddress.isValid() )
if ( xAddress.eclipseResultAddress().isValid() && yAddress.eclipseResultAddress().isValid() )
{
RigActiveCellInfo* activeCellInfo = resultData->activeCellInfo();
const RigMainGrid* mainGrid = caseData->mainGrid();
if ( !resultData->ensureKnownResultLoaded( xAddress ) )
RigCaseCellResultsData* xResultData = caseData->results( xAddress.porosityModel() );
if ( !xResultData->ensureKnownResultLoaded( xAddress.eclipseResultAddress() ) )
{
return result;
}
if ( !resultData->ensureKnownResultLoaded( yAddress ) )
RigCaseCellResultsData* yResultData = caseData->results( yAddress.porosityModel() );
if ( !yResultData->ensureKnownResultLoaded( yAddress.eclipseResultAddress() ) )
{
return result;
}
const std::vector<std::vector<double>>& xValuesForAllSteps = resultData->cellScalarResults( xAddress );
const std::vector<std::vector<double>>& yValuesForAllSteps = resultData->cellScalarResults( yAddress );
const std::vector<std::vector<double>>& xValuesForAllSteps = xResultData->cellScalarResults( xAddress.eclipseResultAddress() );
const std::vector<std::vector<double>>& yValuesForAllSteps = yResultData->cellScalarResults( yAddress.eclipseResultAddress() );
if ( groupingType == GROUP_BY_RESULT && groupAddress.isValid() )
RigCaseCellResultsData* groupResultData = nullptr;
const std::vector<std::vector<double>>* catValuesForAllSteps = nullptr;
if ( groupingType == GROUP_BY_RESULT && groupAddress.eclipseResultAddress().isValid() )
{
if ( resultData->ensureKnownResultLoaded( groupAddress ) )
groupResultData = caseData->results( groupAddress.porosityModel() );
if ( groupResultData->ensureKnownResultLoaded( groupAddress.eclipseResultAddress() ) )
{
catValuesForAllSteps = &resultData->cellScalarResults( groupAddress );
catValuesForAllSteps = &groupResultData->cellScalarResults( groupAddress.eclipseResultAddress() );
}
}
@ -104,17 +105,20 @@ RigEclipseCrossPlotResult RigEclipseCrossPlotDataExtractor::extract( RigEclipseC
int xIndex = timeStep >= (int)xValuesForAllSteps.size() ? 0 : timeStep;
int yIndex = timeStep >= (int)yValuesForAllSteps.size() ? 0 : timeStep;
RigActiveCellsResultAccessor xAccessor( mainGrid, &xValuesForAllSteps[xIndex], activeCellInfo );
RigActiveCellsResultAccessor yAccessor( mainGrid, &yValuesForAllSteps[yIndex], activeCellInfo );
const RigMainGrid* mainGrid = caseData->mainGrid();
RigActiveCellsResultAccessor xAccessor( mainGrid, &xValuesForAllSteps[xIndex], xResultData->activeCellInfo() );
RigActiveCellsResultAccessor yAccessor( mainGrid, &yValuesForAllSteps[yIndex], yResultData->activeCellInfo() );
std::unique_ptr<RigActiveCellsResultAccessor> catAccessor;
if ( catValuesForAllSteps )
{
int catIndex = timeStep >= (int)catValuesForAllSteps->size() ? 0 : timeStep;
catAccessor =
std::make_unique<RigActiveCellsResultAccessor>( mainGrid, &( catValuesForAllSteps->at( catIndex ) ), activeCellInfo );
catAccessor = std::make_unique<RigActiveCellsResultAccessor>( mainGrid,
&( catValuesForAllSteps->at( catIndex ) ),
groupResultData->activeCellInfo() );
}
for ( size_t globalCellIdx = 0; globalCellIdx < activeCellInfo->reservoirCellCount(); ++globalCellIdx )
for ( size_t globalCellIdx = 0; globalCellIdx < xResultData->activeCellInfo()->reservoirCellCount(); ++globalCellIdx )
{
if ( cellVisibility && !( *cellVisibility )[globalCellIdx] ) continue;
@ -132,8 +136,7 @@ RigEclipseCrossPlotResult RigEclipseCrossPlotDataExtractor::extract( RigEclipseC
}
else if ( groupingType == GROUP_BY_FORMATION )
{
const RigFormationNames* activeFormationNames = resultData->activeFormationNames();
const RigFormationNames* activeFormationNames = xResultData->activeFormationNames();
if ( activeFormationNames )
{
int category = 0;

View File

@ -26,7 +26,7 @@
#include <vector>
class RigEclipseCaseData;
class RigEclipseResultAddress;
class RimEclipseResultDefinition;
class QString;
@ -41,11 +41,11 @@ struct RigEclipseCrossPlotResult
class RigEclipseCrossPlotDataExtractor
{
public:
static RigEclipseCrossPlotResult extract( RigEclipseCaseData* eclipseCase,
int resultTimeStep,
const RigEclipseResultAddress& xAddress,
const RigEclipseResultAddress& yAddress,
RigGridCrossPlotCurveGrouping groupingType,
const RigEclipseResultAddress& groupAddress,
std::map<int, cvf::UByteArray> timeStepCellVisibilityMap );
static RigEclipseCrossPlotResult extract( RigEclipseCaseData* eclipseCase,
int resultTimeStep,
const RimEclipseResultDefinition& xAddress,
const RimEclipseResultDefinition& yAddress,
RigGridCrossPlotCurveGrouping groupingType,
const RimEclipseResultDefinition& groupAddress,
std::map<int, cvf::UByteArray> timeStepCellVisibilityMap );
};