mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6941 Use property and time step from grid statistics plot (instead of view)
This commit is contained in:
parent
e02fb1135e
commit
d9fc389abf
@ -17,18 +17,9 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicCreateGridStatisticsPlotFeature.h"
|
||||
//#include "RicGridStatisticsUi.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
// #include "RiaLogging.h"
|
||||
// #include "RiaPorosityModel.h"
|
||||
|
||||
// #include "RigCaseCellResultsData.h"
|
||||
// #include "RigEclipseCaseData.h"
|
||||
// #include "RigEclipseResultAddress.h"
|
||||
// #include "RigEquil.h"
|
||||
|
||||
// #include "RimEclipseResultCase.h"
|
||||
#include "RimGridStatisticsPlot.h"
|
||||
#include "RimGridStatisticsPlotCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
@ -37,8 +28,6 @@
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicCreateGridStatisticsPlotFeature, "RicCreateGridStatisticsPlotFeature" );
|
||||
@ -61,10 +50,10 @@ void RicCreateGridStatisticsPlotFeature::onActionTriggered( bool isChecked )
|
||||
RimGridStatisticsPlotCollection* collection = project->mainPlotCollection()->gridStatisticsPlotCollection();
|
||||
|
||||
RimGridStatisticsPlot* plot = new RimGridStatisticsPlot();
|
||||
plot->loadDataAndUpdate();
|
||||
plot->zoomAll();
|
||||
plot->updateConnectedEditors();
|
||||
plot->setAsPlotMdiWindow();
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
collection->addGridStatisticsPlot( plot );
|
||||
collection->updateAllRequiredEditors();
|
||||
|
@ -67,6 +67,10 @@
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#ifdef USE_QTCHARTS
|
||||
#include "RimGridStatisticsPlot.h"
|
||||
#endif
|
||||
|
||||
#include "cafCategoryMapper.h"
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
@ -616,6 +620,15 @@ void RimEclipseResultDefinition::loadDataAndUpdate()
|
||||
{
|
||||
rim3dWellLogCurve->updateCurveIn3dView();
|
||||
}
|
||||
|
||||
#ifdef USE_QTCHARTS
|
||||
RimGridStatisticsPlot* gridStatisticsPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType( gridStatisticsPlot );
|
||||
if ( gridStatisticsPlot )
|
||||
{
|
||||
gridStatisticsPlot->loadDataAndUpdate();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -83,6 +83,10 @@
|
||||
#include "RimWellMeasurementInViewCollection.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#ifdef USE_QTCHARTS
|
||||
#include "RimGridStatisticsPlot.h"
|
||||
#endif
|
||||
|
||||
#include "Riu3dSelectionManager.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuViewer.h"
|
||||
@ -661,6 +665,18 @@ void RimEclipseView::onCreateDisplayModel()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_QTCHARTS
|
||||
std::vector<RimGridStatisticsPlot*> gridStatisticsPlots;
|
||||
this->objectsWithReferringPtrFieldsOfType( gridStatisticsPlots );
|
||||
for ( auto gridStatisticsPlot : gridStatisticsPlots )
|
||||
{
|
||||
if ( gridStatisticsPlot != nullptr )
|
||||
{
|
||||
gridStatisticsPlot->cellFilterViewUpdated();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
RicExportToSharingServerScheduler::instance()->scheduleUpdateSession();
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,8 @@ RimGridStatisticsPlot::RimGridStatisticsPlot()
|
||||
|
||||
m_plotLegendsHorizontal.uiCapability()->setUiHidden( true );
|
||||
|
||||
setDefaults();
|
||||
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
@ -281,19 +283,11 @@ void RimGridStatisticsPlot::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
else if ( changedField == &m_timeStep )
|
||||
{
|
||||
// if ( m_timeStep != -1 && m_grouping == GROUP_BY_TIME )
|
||||
// {
|
||||
// m_grouping = NO_GROUPING;
|
||||
// }
|
||||
|
||||
// destroyCurves();
|
||||
}
|
||||
else
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
@ -373,6 +367,14 @@ void RimGridStatisticsPlot::initAfterRead()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridStatisticsPlot::cellFilterViewUpdated()
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -389,91 +391,110 @@ void RimGridStatisticsPlot::onLoadDataAndUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridStatisticsPlot::updatePlots()
|
||||
{
|
||||
if ( m_viewer )
|
||||
if ( m_viewer && m_case() && m_property() )
|
||||
{
|
||||
std::unique_ptr<RimHistogramCalculator> histogramCalculator;
|
||||
histogramCalculator.reset( new RimHistogramCalculator );
|
||||
|
||||
RimHistogramData histogramData;
|
||||
|
||||
RimHistogramCalculator::StatisticsCellRangeType cellRange =
|
||||
RimHistogramCalculator::StatisticsCellRangeType::ALL_CELLS;
|
||||
|
||||
RimHistogramCalculator::StatisticsTimeRangeType timeRange =
|
||||
RimHistogramCalculator::StatisticsTimeRangeType::ALL_TIMESTEPS;
|
||||
int timeStep = 0;
|
||||
if ( m_timeStep() != -1 && !m_property()->hasStaticResult() )
|
||||
{
|
||||
timeStep = m_timeStep();
|
||||
timeRange = RimHistogramCalculator::StatisticsTimeRangeType::CURRENT_TIMESTEP;
|
||||
}
|
||||
|
||||
if ( m_cellFilterView.value() )
|
||||
{
|
||||
// Filter by visible cells of the view
|
||||
cellRange = RimHistogramCalculator::StatisticsCellRangeType::VISIBLE_CELLS;
|
||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( m_cellFilterView.value() );
|
||||
RimHistogramCalculator::StatisticsCellRangeType cellRange =
|
||||
RimHistogramCalculator::StatisticsCellRangeType::ALL_CELLS;
|
||||
RimHistogramCalculator::StatisticsTimeRangeType timeRange =
|
||||
RimHistogramCalculator::StatisticsTimeRangeType::CURRENT_TIMESTEP;
|
||||
histogramData =
|
||||
histogramCalculator->histogramData( eclipseView, m_property.value(), cellRange, timeRange, timeStep );
|
||||
}
|
||||
else
|
||||
{
|
||||
RimEclipseView* eclipseView = nullptr;
|
||||
histogramData =
|
||||
histogramCalculator->histogramData( eclipseView, m_property.value(), cellRange, timeRange, timeStep );
|
||||
}
|
||||
|
||||
std::unique_ptr<RimHistogramCalculator> histogramCalculator;
|
||||
histogramCalculator.reset( new RimHistogramCalculator );
|
||||
|
||||
RimHistogramData histogramData = histogramCalculator->histogramData( eclipseView, cellRange, timeRange );
|
||||
if ( histogramData.isHistogramVectorValid() )
|
||||
if ( histogramData.isHistogramVectorValid() )
|
||||
{
|
||||
QBarSet* set0 = new QBarSet( m_plotWindowTitle );
|
||||
double minValue = std::numeric_limits<double>::max();
|
||||
double maxValue = -std::numeric_limits<double>::max();
|
||||
for ( double value : *histogramData.histogram )
|
||||
{
|
||||
QBarSet* set0 = new QBarSet( "data" );
|
||||
double minValue = std::numeric_limits<double>::max();
|
||||
double maxValue = std::numeric_limits<double>::min();
|
||||
for ( double value : *histogramData.histogram )
|
||||
{
|
||||
*set0 << value;
|
||||
minValue = std::min( minValue, value );
|
||||
maxValue = std::max( maxValue, value );
|
||||
}
|
||||
|
||||
QBarSeries* series = new QBarSeries();
|
||||
series->append( set0 );
|
||||
|
||||
QChart* chart = new QChart();
|
||||
chart->addSeries( series );
|
||||
chart->setTitle( uiName() );
|
||||
|
||||
// Axis
|
||||
double xAxisSize = histogramData.max - histogramData.min;
|
||||
double xAxisExtension = xAxisSize * 0.02;
|
||||
|
||||
QValueAxis* axisX = new QValueAxis();
|
||||
axisX->setRange( histogramData.min - xAxisExtension, histogramData.max + xAxisExtension );
|
||||
chart->addAxis( axisX, Qt::AlignBottom );
|
||||
|
||||
QValueAxis* axisY = new QValueAxis();
|
||||
axisY->setRange( minValue, maxValue );
|
||||
chart->addAxis( axisY, Qt::AlignLeft );
|
||||
|
||||
QLineSeries* p10series = new QLineSeries();
|
||||
chart->addSeries( p10series );
|
||||
p10series->setName( "P10" );
|
||||
p10series->append( histogramData.p10, minValue );
|
||||
p10series->append( histogramData.p10, maxValue );
|
||||
p10series->attachAxis( axisX );
|
||||
p10series->attachAxis( axisY );
|
||||
|
||||
QLineSeries* p90series = new QLineSeries();
|
||||
chart->addSeries( p90series );
|
||||
p90series->setName( "P90" );
|
||||
p90series->append( histogramData.p90, minValue );
|
||||
p90series->append( histogramData.p90, maxValue );
|
||||
p90series->attachAxis( axisX );
|
||||
p90series->attachAxis( axisY );
|
||||
|
||||
QLineSeries* meanSeries = new QLineSeries();
|
||||
chart->addSeries( meanSeries );
|
||||
meanSeries->setName( "Mean" );
|
||||
meanSeries->append( histogramData.mean, minValue );
|
||||
meanSeries->append( histogramData.mean, maxValue );
|
||||
meanSeries->attachAxis( axisX );
|
||||
meanSeries->attachAxis( axisY );
|
||||
|
||||
// Set font sizes
|
||||
QFont titleFont = chart->titleFont();
|
||||
titleFont.setPixelSize( titleFontSize() );
|
||||
chart->setTitleFont( titleFont );
|
||||
|
||||
QLegend* legend = chart->legend();
|
||||
if ( legend )
|
||||
{
|
||||
QFont legendFont = legend->font();
|
||||
legendFont.setPixelSize( legendFontSize() );
|
||||
legend->setFont( legendFont );
|
||||
legend->setVisible( legendsVisible() );
|
||||
}
|
||||
|
||||
m_viewer->setChart( chart );
|
||||
*set0 << value;
|
||||
minValue = std::min( minValue, value );
|
||||
maxValue = std::max( maxValue, value );
|
||||
}
|
||||
|
||||
QBarSeries* series = new QBarSeries();
|
||||
series->append( set0 );
|
||||
|
||||
QChart* chart = new QChart();
|
||||
chart->addSeries( series );
|
||||
chart->setTitle( uiName() );
|
||||
|
||||
// Axis
|
||||
double xAxisSize = histogramData.max - histogramData.min;
|
||||
double xAxisExtension = xAxisSize * 0.02;
|
||||
|
||||
QValueAxis* axisX = new QValueAxis();
|
||||
axisX->setRange( histogramData.min - xAxisExtension, histogramData.max + xAxisExtension );
|
||||
chart->addAxis( axisX, Qt::AlignBottom );
|
||||
|
||||
QValueAxis* axisY = new QValueAxis();
|
||||
axisY->setRange( minValue, maxValue );
|
||||
chart->addAxis( axisY, Qt::AlignLeft );
|
||||
|
||||
QLineSeries* p10series = new QLineSeries();
|
||||
chart->addSeries( p10series );
|
||||
p10series->setName( "P10" );
|
||||
p10series->append( histogramData.p10, minValue );
|
||||
p10series->append( histogramData.p10, maxValue );
|
||||
p10series->attachAxis( axisX );
|
||||
p10series->attachAxis( axisY );
|
||||
|
||||
QLineSeries* p90series = new QLineSeries();
|
||||
chart->addSeries( p90series );
|
||||
p90series->setName( "P90" );
|
||||
p90series->append( histogramData.p90, minValue );
|
||||
p90series->append( histogramData.p90, maxValue );
|
||||
p90series->attachAxis( axisX );
|
||||
p90series->attachAxis( axisY );
|
||||
|
||||
QLineSeries* meanSeries = new QLineSeries();
|
||||
chart->addSeries( meanSeries );
|
||||
meanSeries->setName( "Mean" );
|
||||
meanSeries->append( histogramData.mean, minValue );
|
||||
meanSeries->append( histogramData.mean, maxValue );
|
||||
meanSeries->attachAxis( axisX );
|
||||
meanSeries->attachAxis( axisY );
|
||||
|
||||
// Set font sizes
|
||||
QFont titleFont = chart->titleFont();
|
||||
titleFont.setPixelSize( titleFontSize() );
|
||||
chart->setTitleFont( titleFont );
|
||||
|
||||
QLegend* legend = chart->legend();
|
||||
if ( legend )
|
||||
{
|
||||
QFont legendFont = legend->font();
|
||||
legendFont.setPixelSize( legendFontSize() );
|
||||
legend->setFont( legendFont );
|
||||
legend->setVisible( legendsVisible() );
|
||||
}
|
||||
|
||||
m_viewer->setChart( chart );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -497,6 +518,7 @@ QString RimGridStatisticsPlot::createAutoName() const
|
||||
}
|
||||
|
||||
QStringList nameTags;
|
||||
nameTags += m_property()->resultVariable();
|
||||
nameTags += m_case()->caseUserDescription();
|
||||
|
||||
QString timeStepStr = timeStepString();
|
||||
@ -505,7 +527,7 @@ QString RimGridStatisticsPlot::createAutoName() const
|
||||
nameTags += timeStepStr;
|
||||
}
|
||||
|
||||
return nameTags.join( "," );
|
||||
return nameTags.join( ", " );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -57,6 +57,8 @@ public:
|
||||
|
||||
void zoomAll() override;
|
||||
|
||||
void cellFilterViewUpdated();
|
||||
|
||||
protected:
|
||||
QImage snapshotWindowContent() override;
|
||||
|
||||
|
@ -129,136 +129,129 @@ RimHistogramData RimHistogramCalculator::histogramData( RimEclipseView*
|
||||
StatisticsCellRangeType cellRange,
|
||||
StatisticsTimeRangeType timeRange )
|
||||
{
|
||||
RimHistogramData histData;
|
||||
|
||||
if ( eclipseView )
|
||||
{
|
||||
bool isResultsInfoRelevant = eclipseView->hasUserRequestedAnimation() && eclipseView->cellResult()->hasResult();
|
||||
RimEclipseResultDefinition* eclResultDefinition = eclipseView->cellResult();
|
||||
bool isResultsInfoRelevant = eclipseView->hasUserRequestedAnimation() && eclResultDefinition->hasResult();
|
||||
|
||||
if ( isResultsInfoRelevant )
|
||||
{
|
||||
RigEclipseResultAddress eclResAddr = eclipseView->cellResult()->eclipseResultAddress();
|
||||
RigEclipseResultAddress eclResAddr = eclResultDefinition->eclipseResultAddress();
|
||||
|
||||
if ( eclResAddr.isValid() )
|
||||
{
|
||||
if ( cellRange == StatisticsCellRangeType::ALL_CELLS )
|
||||
int currentTimeStep = eclipseView->currentTimeStep();
|
||||
if ( eclipseView->cellResult()->hasStaticResult() )
|
||||
{
|
||||
if ( timeRange == StatisticsTimeRangeType::ALL_TIMESTEPS )
|
||||
{
|
||||
eclipseView->currentGridCellResults()->minMaxCellScalarValues( eclResAddr,
|
||||
histData.min,
|
||||
histData.max );
|
||||
eclipseView->currentGridCellResults()->p10p90CellScalarValues( eclResAddr,
|
||||
histData.p10,
|
||||
histData.p90 );
|
||||
eclipseView->currentGridCellResults()->meanCellScalarValues( eclResAddr, histData.mean );
|
||||
eclipseView->currentGridCellResults()->sumCellScalarValues( eclResAddr, histData.sum );
|
||||
eclipseView->currentGridCellResults()->mobileVolumeWeightedMean( eclResAddr, histData.weightedMean );
|
||||
histData.histogram =
|
||||
&( eclipseView->currentGridCellResults()->cellScalarValuesHistogram( eclResAddr ) );
|
||||
}
|
||||
else if ( timeRange == StatisticsTimeRangeType::CURRENT_TIMESTEP )
|
||||
{
|
||||
int currentTimeStep = eclipseView->currentTimeStep();
|
||||
if ( eclipseView->cellResult()->hasStaticResult() )
|
||||
{
|
||||
currentTimeStep = 0;
|
||||
}
|
||||
|
||||
eclipseView->currentGridCellResults()->minMaxCellScalarValues( eclResAddr,
|
||||
currentTimeStep,
|
||||
histData.min,
|
||||
histData.max );
|
||||
eclipseView->currentGridCellResults()->p10p90CellScalarValues( eclResAddr,
|
||||
currentTimeStep,
|
||||
histData.p10,
|
||||
histData.p90 );
|
||||
eclipseView->currentGridCellResults()->meanCellScalarValues( eclResAddr,
|
||||
currentTimeStep,
|
||||
histData.mean );
|
||||
eclipseView->currentGridCellResults()->sumCellScalarValues( eclResAddr,
|
||||
currentTimeStep,
|
||||
histData.sum );
|
||||
eclipseView->currentGridCellResults()->mobileVolumeWeightedMean( eclResAddr,
|
||||
currentTimeStep,
|
||||
histData.weightedMean );
|
||||
|
||||
histData.histogram =
|
||||
&( eclipseView->currentGridCellResults()->cellScalarValuesHistogram( eclResAddr,
|
||||
currentTimeStep ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT( false );
|
||||
}
|
||||
currentTimeStep = 0;
|
||||
}
|
||||
else if ( cellRange == StatisticsCellRangeType::VISIBLE_CELLS )
|
||||
{
|
||||
updateVisCellStatsIfNeeded( eclipseView );
|
||||
if ( timeRange == StatisticsTimeRangeType::ALL_TIMESTEPS )
|
||||
{
|
||||
// TODO: Only valid if we have no dynamic property filter
|
||||
m_visibleCellStatistics->meanCellScalarValues( histData.mean );
|
||||
m_visibleCellStatistics->minMaxCellScalarValues( histData.min, histData.max );
|
||||
m_visibleCellStatistics->p10p90CellScalarValues( histData.p10, histData.p90 );
|
||||
m_visibleCellStatistics->sumCellScalarValues( histData.sum );
|
||||
m_visibleCellStatistics->mobileVolumeWeightedMean( histData.weightedMean );
|
||||
|
||||
histData.histogram = &( m_visibleCellStatistics->cellScalarValuesHistogram() );
|
||||
}
|
||||
else if ( timeRange == StatisticsTimeRangeType::CURRENT_TIMESTEP )
|
||||
{
|
||||
int currentTimeStep = eclipseView->currentTimeStep();
|
||||
if ( eclipseView->cellResult()->hasStaticResult() )
|
||||
{
|
||||
currentTimeStep = 0;
|
||||
}
|
||||
|
||||
m_visibleCellStatistics->meanCellScalarValues( currentTimeStep, histData.mean );
|
||||
m_visibleCellStatistics->minMaxCellScalarValues( currentTimeStep, histData.min, histData.max );
|
||||
m_visibleCellStatistics->p10p90CellScalarValues( currentTimeStep, histData.p10, histData.p90 );
|
||||
m_visibleCellStatistics->sumCellScalarValues( currentTimeStep, histData.sum );
|
||||
m_visibleCellStatistics->mobileVolumeWeightedMean( currentTimeStep, histData.weightedMean );
|
||||
|
||||
histData.histogram = &( m_visibleCellStatistics->cellScalarValuesHistogram( currentTimeStep ) );
|
||||
}
|
||||
}
|
||||
return histogramData( eclipseView, eclResultDefinition, cellRange, timeRange, currentTimeStep );
|
||||
}
|
||||
else if ( eclipseView->cellResult()->isFlowDiagOrInjectionFlooding() )
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
RimHistogramData data;
|
||||
return data;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimHistogramData RimHistogramCalculator::histogramData( RimEclipseView* eclipseView,
|
||||
RimEclipseResultDefinition* eclResultDefinition,
|
||||
StatisticsCellRangeType cellRange,
|
||||
StatisticsTimeRangeType timeRange,
|
||||
int timeStep )
|
||||
{
|
||||
CVF_ASSERT( eclResultDefinition );
|
||||
|
||||
RimHistogramData histData;
|
||||
|
||||
eclResultDefinition->loadResult();
|
||||
|
||||
if ( eclResultDefinition->isFlowDiagOrInjectionFlooding() )
|
||||
{
|
||||
// All timesteps is ignored
|
||||
if ( timeRange == StatisticsTimeRangeType::CURRENT_TIMESTEP || timeRange == StatisticsTimeRangeType::ALL_TIMESTEPS )
|
||||
{
|
||||
if ( cellRange == StatisticsCellRangeType::ALL_CELLS )
|
||||
{
|
||||
// All timesteps is ignored
|
||||
if ( timeRange == StatisticsTimeRangeType::CURRENT_TIMESTEP ||
|
||||
timeRange == StatisticsTimeRangeType::ALL_TIMESTEPS )
|
||||
{
|
||||
int currentTimeStep = eclipseView->currentTimeStep();
|
||||
RigFlowDiagResults* fldResults = eclResultDefinition->flowDiagSolution()->flowDiagResults();
|
||||
RigFlowDiagResultAddress resAddr = eclResultDefinition->flowDiagResAddress();
|
||||
|
||||
if ( cellRange == StatisticsCellRangeType::ALL_CELLS )
|
||||
{
|
||||
RigFlowDiagResults* fldResults = eclipseView->cellResult()->flowDiagSolution()->flowDiagResults();
|
||||
RigFlowDiagResultAddress resAddr = eclipseView->cellResult()->flowDiagResAddress();
|
||||
fldResults->minMaxScalarValues( resAddr, timeStep, &histData.min, &histData.max );
|
||||
fldResults->p10p90ScalarValues( resAddr, timeStep, &histData.p10, &histData.p90 );
|
||||
fldResults->meanScalarValue( resAddr, timeStep, &histData.mean );
|
||||
fldResults->sumScalarValue( resAddr, timeStep, &histData.sum );
|
||||
fldResults->mobileVolumeWeightedMean( resAddr, timeStep, &histData.weightedMean );
|
||||
|
||||
fldResults->minMaxScalarValues( resAddr, currentTimeStep, &histData.min, &histData.max );
|
||||
fldResults->p10p90ScalarValues( resAddr, currentTimeStep, &histData.p10, &histData.p90 );
|
||||
fldResults->meanScalarValue( resAddr, currentTimeStep, &histData.mean );
|
||||
fldResults->sumScalarValue( resAddr, currentTimeStep, &histData.sum );
|
||||
fldResults->mobileVolumeWeightedMean( resAddr, currentTimeStep, &histData.weightedMean );
|
||||
|
||||
histData.histogram = &( fldResults->scalarValuesHistogram( resAddr, currentTimeStep ) );
|
||||
}
|
||||
else if ( cellRange == StatisticsCellRangeType::VISIBLE_CELLS )
|
||||
{
|
||||
updateVisCellStatsIfNeeded( eclipseView );
|
||||
|
||||
m_visibleCellStatistics->meanCellScalarValues( currentTimeStep, histData.mean );
|
||||
m_visibleCellStatistics->minMaxCellScalarValues( currentTimeStep, histData.min, histData.max );
|
||||
m_visibleCellStatistics->p10p90CellScalarValues( currentTimeStep, histData.p10, histData.p90 );
|
||||
m_visibleCellStatistics->sumCellScalarValues( currentTimeStep, histData.sum );
|
||||
m_visibleCellStatistics->mobileVolumeWeightedMean( currentTimeStep, histData.weightedMean );
|
||||
|
||||
histData.histogram = &( m_visibleCellStatistics->cellScalarValuesHistogram( currentTimeStep ) );
|
||||
}
|
||||
}
|
||||
histData.histogram = &( fldResults->scalarValuesHistogram( resAddr, timeStep ) );
|
||||
}
|
||||
else if ( cellRange == StatisticsCellRangeType::VISIBLE_CELLS )
|
||||
{
|
||||
CVF_ASSERT( eclipseView );
|
||||
|
||||
updateVisCellStatsIfNeeded( eclipseView, eclResultDefinition );
|
||||
|
||||
m_visibleCellStatistics->meanCellScalarValues( timeStep, histData.mean );
|
||||
m_visibleCellStatistics->minMaxCellScalarValues( timeStep, histData.min, histData.max );
|
||||
m_visibleCellStatistics->p10p90CellScalarValues( timeStep, histData.p10, histData.p90 );
|
||||
m_visibleCellStatistics->sumCellScalarValues( timeStep, histData.sum );
|
||||
m_visibleCellStatistics->mobileVolumeWeightedMean( timeStep, histData.weightedMean );
|
||||
|
||||
histData.histogram = &( m_visibleCellStatistics->cellScalarValuesHistogram( timeStep ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( cellRange == StatisticsCellRangeType::ALL_CELLS )
|
||||
{
|
||||
RigEclipseResultAddress eclResAddr = eclResultDefinition->eclipseResultAddress();
|
||||
RigCaseCellResultsData* cellResults = eclResultDefinition->currentGridCellResults();
|
||||
if ( timeRange == StatisticsTimeRangeType::ALL_TIMESTEPS )
|
||||
{
|
||||
cellResults->minMaxCellScalarValues( eclResAddr, histData.min, histData.max );
|
||||
cellResults->p10p90CellScalarValues( eclResAddr, histData.p10, histData.p90 );
|
||||
cellResults->meanCellScalarValues( eclResAddr, histData.mean );
|
||||
cellResults->sumCellScalarValues( eclResAddr, histData.sum );
|
||||
cellResults->mobileVolumeWeightedMean( eclResAddr, histData.weightedMean );
|
||||
histData.histogram = &( cellResults->cellScalarValuesHistogram( eclResAddr ) );
|
||||
}
|
||||
else if ( timeRange == StatisticsTimeRangeType::CURRENT_TIMESTEP )
|
||||
{
|
||||
cellResults->minMaxCellScalarValues( eclResAddr, timeStep, histData.min, histData.max );
|
||||
cellResults->p10p90CellScalarValues( eclResAddr, timeStep, histData.p10, histData.p90 );
|
||||
cellResults->meanCellScalarValues( eclResAddr, timeStep, histData.mean );
|
||||
cellResults->sumCellScalarValues( eclResAddr, timeStep, histData.sum );
|
||||
cellResults->mobileVolumeWeightedMean( eclResAddr, timeStep, histData.weightedMean );
|
||||
histData.histogram = &( cellResults->cellScalarValuesHistogram( eclResAddr, timeStep ) );
|
||||
}
|
||||
}
|
||||
else if ( cellRange == StatisticsCellRangeType::VISIBLE_CELLS )
|
||||
{
|
||||
CVF_ASSERT( eclipseView );
|
||||
updateVisCellStatsIfNeeded( eclipseView, eclResultDefinition );
|
||||
if ( timeRange == StatisticsTimeRangeType::ALL_TIMESTEPS )
|
||||
{
|
||||
// TODO: Only valid if we have no dynamic property filter
|
||||
m_visibleCellStatistics->meanCellScalarValues( histData.mean );
|
||||
m_visibleCellStatistics->minMaxCellScalarValues( histData.min, histData.max );
|
||||
m_visibleCellStatistics->p10p90CellScalarValues( histData.p10, histData.p90 );
|
||||
m_visibleCellStatistics->sumCellScalarValues( histData.sum );
|
||||
m_visibleCellStatistics->mobileVolumeWeightedMean( histData.weightedMean );
|
||||
|
||||
histData.histogram = &( m_visibleCellStatistics->cellScalarValuesHistogram() );
|
||||
}
|
||||
else if ( timeRange == StatisticsTimeRangeType::CURRENT_TIMESTEP )
|
||||
{
|
||||
m_visibleCellStatistics->meanCellScalarValues( timeStep, histData.mean );
|
||||
m_visibleCellStatistics->minMaxCellScalarValues( timeStep, histData.min, histData.max );
|
||||
m_visibleCellStatistics->p10p90CellScalarValues( timeStep, histData.p10, histData.p90 );
|
||||
m_visibleCellStatistics->sumCellScalarValues( timeStep, histData.sum );
|
||||
m_visibleCellStatistics->mobileVolumeWeightedMean( timeStep, histData.weightedMean );
|
||||
|
||||
histData.histogram = &( m_visibleCellStatistics->cellScalarValuesHistogram( timeStep ) );
|
||||
}
|
||||
}
|
||||
return histData;
|
||||
@ -358,21 +351,27 @@ void RimHistogramCalculator::updateVisCellStatsIfNeeded( RimGeoMechView* geoMech
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimHistogramCalculator::updateVisCellStatsIfNeeded( RimEclipseView* eclipseView )
|
||||
void RimHistogramCalculator::updateVisCellStatsIfNeeded( RimEclipseView* eclipseView,
|
||||
RimEclipseResultDefinition* eclResultDefinition )
|
||||
{
|
||||
CVF_ASSERT( eclipseView );
|
||||
CVF_ASSERT( eclResultDefinition );
|
||||
|
||||
if ( m_isVisCellStatUpToDate ) return;
|
||||
|
||||
eclipseView->cellResult()->loadResult();
|
||||
|
||||
cvf::ref<RigStatisticsCalculator> calc;
|
||||
|
||||
if ( eclipseView->cellResult()->isFlowDiagOrInjectionFlooding() )
|
||||
if ( eclResultDefinition->isFlowDiagOrInjectionFlooding() )
|
||||
{
|
||||
RigFlowDiagResultAddress resAddr = eclipseView->cellResult()->flowDiagResAddress();
|
||||
RigFlowDiagResults* fldResults = eclipseView->cellResult()->flowDiagSolution()->flowDiagResults();
|
||||
RigFlowDiagResultAddress resAddr = eclResultDefinition->flowDiagResAddress();
|
||||
RigFlowDiagResults* fldResults = eclResultDefinition->flowDiagSolution()->flowDiagResults();
|
||||
calc = new RigFlowDiagVisibleCellsStatCalc( fldResults, resAddr, eclipseView->currentTotalCellVisibility().p() );
|
||||
}
|
||||
else
|
||||
{
|
||||
RigEclipseResultAddress resAddr = eclipseView->cellResult()->eclipseResultAddress();
|
||||
RigEclipseResultAddress resAddr = eclResultDefinition->eclipseResultAddress();
|
||||
|
||||
QString resultName = resAddr.m_resultName;
|
||||
|
||||
@ -384,7 +383,7 @@ void RimHistogramCalculator::updateVisCellStatsIfNeeded( RimEclipseView* eclipse
|
||||
for ( RigEclipseResultAddress& compResAddr : addresses )
|
||||
{
|
||||
cvf::ref<RigEclipseNativeVisibleCellsStatCalc> singleCalc =
|
||||
new RigEclipseNativeVisibleCellsStatCalc( eclipseView->currentGridCellResults(),
|
||||
new RigEclipseNativeVisibleCellsStatCalc( eclResultDefinition->currentGridCellResults(),
|
||||
compResAddr,
|
||||
eclipseView->currentTotalCellVisibility().p() );
|
||||
multicalc->addStatisticsCalculator( singleCalc.p() );
|
||||
@ -394,7 +393,7 @@ void RimHistogramCalculator::updateVisCellStatsIfNeeded( RimEclipseView* eclipse
|
||||
}
|
||||
else
|
||||
{
|
||||
calc = new RigEclipseNativeVisibleCellsStatCalc( eclipseView->currentGridCellResults(),
|
||||
calc = new RigEclipseNativeVisibleCellsStatCalc( eclResultDefinition->currentGridCellResults(),
|
||||
resAddr,
|
||||
eclipseView->currentTotalCellVisibility().p() );
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "cvfObject.h"
|
||||
|
||||
class RimEclipseResultDefinition;
|
||||
class RimGeoMechContourMapView;
|
||||
class RimEclipseContourMapView;
|
||||
class RimEclipseView;
|
||||
@ -60,10 +61,17 @@ public:
|
||||
RimHistogramData
|
||||
histogramData( RimGeoMechView* geoMechView, StatisticsCellRangeType cellRange, StatisticsTimeRangeType timeRange );
|
||||
|
||||
RimHistogramData histogramData( RimEclipseView* eclipseView,
|
||||
RimEclipseResultDefinition* eclResultDefinition,
|
||||
StatisticsCellRangeType cellRange,
|
||||
StatisticsTimeRangeType timeRange,
|
||||
int timeStep );
|
||||
|
||||
void invalidateVisibleCellsCache();
|
||||
|
||||
private:
|
||||
void updateVisCellStatsIfNeeded( RimEclipseView* eclipseView );
|
||||
void updateVisCellStatsIfNeeded( RimEclipseView* eclipseView, RimEclipseResultDefinition* eclResultDefinition );
|
||||
|
||||
void updateVisCellStatsIfNeeded( RimGeoMechView* geoMechView );
|
||||
|
||||
std::vector<RigEclipseResultAddress> sourcesForMultiPropertyResults( const QString& resultName );
|
||||
|
Loading…
Reference in New Issue
Block a user