mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
ResInsight: Added mean value to 3D info text
p4#: 19268
This commit is contained in:
parent
1d90bd680e
commit
a8b4d35b4f
@ -99,7 +99,7 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
||||
|
||||
QString infoText = QString(
|
||||
"<p><b><center>-- %1 --</center></b><p> "
|
||||
"<b>Cell count:</b> Total: %2 Active: %3 <br>"
|
||||
"<b>Cell count. Total:</b> %2 <b>Active:</b> %3 <br>"
|
||||
"<b>Main Grid I,J,K:</b> %4, %5, %6 <br>").arg(caseName, totCellCount, activeCellCount, iSize, jSize, kSize);
|
||||
|
||||
if (m_reservoirView->animationMode() && m_reservoirView->cellResult()->hasResult())
|
||||
@ -108,11 +108,14 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
||||
|
||||
double min, max;
|
||||
double p10, p90;
|
||||
double mean;
|
||||
size_t scalarIndex = m_reservoirView->cellResult()->gridScalarIndex();
|
||||
m_reservoirView->gridCellResults()->minMaxCellScalarValues(scalarIndex, min, max);
|
||||
m_reservoirView->gridCellResults()->p10p90CellScalarValues(scalarIndex, p10, p90);
|
||||
m_reservoirView->gridCellResults()->meanCellScalarValues(scalarIndex, mean);
|
||||
|
||||
infoText += QString("<blockquote> Min: %1 P10: %2 P90: %3 Max: %4 </blockquote>").arg(min).arg(p10).arg(p90).arg(max);
|
||||
infoText += QString("<blockquote><b>Min:</b> %1 <b>P10:</b> %2 <b>Mean:</b> %3 <b>P90:</b> %4 <b>Max:</b> %5 </blockquote>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
|
||||
//infoText += QString("<blockquote><pre>Min: %1 P10: %2 Mean: %3 \n P90: %4 Max: %5 </pre></blockquote>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
|
||||
}
|
||||
|
||||
|
||||
@ -142,13 +145,16 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
||||
{
|
||||
double min, max;
|
||||
double p10, p90;
|
||||
double mean;
|
||||
|
||||
size_t scalarIndex = m_reservoirView->cellResult()->gridScalarIndex();
|
||||
m_reservoirView->gridCellResults()->minMaxCellScalarValues(scalarIndex, min, max);
|
||||
m_reservoirView->gridCellResults()->p10p90CellScalarValues(scalarIndex, p10, p90);
|
||||
m_reservoirView->gridCellResults()->meanCellScalarValues(scalarIndex, mean);
|
||||
|
||||
m_reservoirView->viewer()->showHistogram(true);
|
||||
m_reservoirView->viewer()->setHistogram(min, max, m_reservoirView->gridCellResults()->cellScalarValuesHistogram(scalarIndex));
|
||||
m_reservoirView->viewer()->setHistogramPercentiles(p10, p90);
|
||||
m_reservoirView->viewer()->setHistogramPercentiles(p10, p90, mean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,6 +172,42 @@ void RigReservoirCellResults::p10p90CellScalarValues(size_t scalarResultIndex, d
|
||||
p90 = m_p10p90[scalarResultIndex].second;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirCellResults::meanCellScalarValues(size_t scalarResultIndex, double& meanValue)
|
||||
{
|
||||
CVF_ASSERT(scalarResultIndex < resultCount());
|
||||
|
||||
// Extend array and cache vars
|
||||
|
||||
if (scalarResultIndex >= m_meanValues.size() )
|
||||
{
|
||||
m_meanValues.resize(scalarResultIndex+1, HUGE_VAL);
|
||||
}
|
||||
|
||||
if (m_meanValues[scalarResultIndex] != HUGE_VAL)
|
||||
{
|
||||
meanValue = m_meanValues[scalarResultIndex];
|
||||
return;
|
||||
}
|
||||
|
||||
double valueSum = 0.0;
|
||||
size_t count = 0;
|
||||
for (size_t tIdx = 0; tIdx < timeStepCount(scalarResultIndex); tIdx++)
|
||||
{
|
||||
std::vector<double>& values = m_cellScalarResults[scalarResultIndex][tIdx];
|
||||
for (size_t cIdx = 0; cIdx < values.size(); ++cIdx)
|
||||
{
|
||||
valueSum += values[cIdx];
|
||||
}
|
||||
count += values.size();
|
||||
}
|
||||
|
||||
m_meanValues[scalarResultIndex] = valueSum/count;
|
||||
meanValue = m_meanValues[scalarResultIndex];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
void minMaxCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& min, double& max);
|
||||
const std::vector<size_t>& cellScalarValuesHistogram(size_t scalarResultIndex);
|
||||
void p10p90CellScalarValues(size_t scalarResultIndex, double& p10, double& p90);
|
||||
void meanCellScalarValues(size_t scalarResultIndex, double& meanValue);
|
||||
|
||||
// Access meta-information about the results
|
||||
size_t resultCount() const;
|
||||
@ -76,6 +77,7 @@ private:
|
||||
std::vector< std::pair<double, double> > m_maxMinValues; ///< Max min values for each Result index
|
||||
std::vector< std::vector<size_t> > m_histograms; ///< Histogram for each Result Index
|
||||
std::vector< std::pair<double, double> > m_p10p90; ///< P10 and p90 values for each Result Index
|
||||
std::vector< double > m_meanValues; ///< Mean value for each Result Index
|
||||
|
||||
std::vector< std::vector< std::pair<double, double> > > m_maxMinValuesPrTs; ///< Max min values for each timestep and Result index
|
||||
|
||||
|
@ -481,9 +481,10 @@ void RIViewer::setHistogram(double min, double max, const std::vector<size_t>& h
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIViewer::setHistogramPercentiles(double pmin, double pmax)
|
||||
void RIViewer::setHistogramPercentiles(double pmin, double pmax, double mean)
|
||||
{
|
||||
m_histogramWidget->setPercentiles(pmin, pmax);
|
||||
m_histogramWidget->setMean(mean);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
void setInfoText(QString text);
|
||||
void showHistogram(bool enable);
|
||||
void setHistogram(double min, double max, const std::vector<size_t>& histogram);
|
||||
void setHistogramPercentiles(double pmin, double pmax);
|
||||
void setHistogramPercentiles(double pmin, double pmax, double mean);
|
||||
|
||||
void showAnimationProgress(bool enable);
|
||||
|
||||
|
@ -10,6 +10,8 @@ QWidget(parent, f)
|
||||
{
|
||||
m_minPercentile = HUGE_VAL;
|
||||
m_maxPercentile = HUGE_VAL;
|
||||
m_mean = HUGE_VAL;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -78,6 +80,14 @@ void RiuSimpleHistogramWidget::draw(QPainter *painter,int x, int y, int width, i
|
||||
painter->setPen(QColor(255, 0, 0, 200));
|
||||
painter->drawLine(xpos, y+1, xpos, y + height -1);
|
||||
}
|
||||
|
||||
// Vertical lines for percentiles
|
||||
if (m_mean != HUGE_VAL)
|
||||
{
|
||||
int xpos = xPosFromDomainValue(m_mean);
|
||||
painter->setPen(QColor(0, 0, 255, 200));
|
||||
painter->drawLine(xpos, y+1, xpos, y + height -1);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -11,6 +11,7 @@ public:
|
||||
|
||||
void setHistogramData(double min, double max, const std::vector<size_t>& histogram);
|
||||
void setPercentiles(double pmin, double pmax) {m_minPercentile = pmin; m_maxPercentile = pmax;}
|
||||
void setMean(double mean) {m_mean = mean;}
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
@ -28,6 +29,7 @@ private:
|
||||
double m_min;
|
||||
double m_minPercentile;
|
||||
double m_maxPercentile;
|
||||
double m_mean;
|
||||
size_t m_maxHistogramCount;
|
||||
|
||||
double m_width;
|
||||
|
Loading…
Reference in New Issue
Block a user