mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Statistics dialog. Fix crash when no results exist
This commit is contained in:
parent
c59c167bbf
commit
985388e60f
@ -122,6 +122,8 @@ void RicGridStatisticsDialog::setHistogramData(RimEclipseView* eclipseView)
|
||||
|
||||
Rim3dOverlayInfoConfig::HistogramData histogramData = overlayInfo->histogramData();
|
||||
|
||||
if (histogramData.isValid())
|
||||
{
|
||||
QVector<QwtIntervalSample> histSamples;
|
||||
QVector<QPointF> aggrSamples;
|
||||
double xStep = (histogramData.max - histogramData.min) / (*histogramData.histogram).size();
|
||||
@ -151,12 +153,13 @@ void RicGridStatisticsDialog::setHistogramData(RimEclipseView* eclipseView)
|
||||
// Markers
|
||||
setMarkers(histogramData, m_historgramPlot);
|
||||
setMarkers(histogramData, m_aggregatedPlot);
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh plot
|
||||
m_historgramPlot->replot();
|
||||
m_aggregatedPlot->replot();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -47,7 +47,7 @@ class Rim3dOverlayInfoConfig : public caf::PdmObject
|
||||
class HistogramData
|
||||
{
|
||||
public:
|
||||
HistogramData() : min(HUGE_VAL), max(HUGE_VAL), p10(HUGE_VAL), p90(HUGE_VAL), mean(HUGE_VAL), weightedMean(HUGE_VAL), sum(0.0) {}
|
||||
HistogramData() : min(HUGE_VAL), max(HUGE_VAL), p10(HUGE_VAL), p90(HUGE_VAL), mean(HUGE_VAL), weightedMean(HUGE_VAL), sum(0.0), histogram(nullptr) {}
|
||||
|
||||
double min;
|
||||
double max;
|
||||
@ -57,6 +57,8 @@ class Rim3dOverlayInfoConfig : public caf::PdmObject
|
||||
double sum;
|
||||
double weightedMean;
|
||||
const std::vector<size_t>* histogram;
|
||||
|
||||
bool isValid() { return histogram && histogram->size() > 0; }
|
||||
};
|
||||
|
||||
public:
|
||||
@ -97,6 +99,9 @@ private:
|
||||
void updateEclipse3DInfo(RimEclipseView * reservoirView);
|
||||
void updateGeoMech3DInfo(RimGeoMechView * geoMechView);
|
||||
|
||||
HistogramData histogramData(RimEclipseView* eclipseView);
|
||||
HistogramData histogramData(RimGeoMechView* geoMechView);
|
||||
|
||||
caf::PdmField<bool> active;
|
||||
caf::PdmField<bool> showAnimProgress;
|
||||
caf::PdmField<bool> showCaseInfo;
|
||||
|
Loading…
Reference in New Issue
Block a user