Whtespace

This commit is contained in:
Magne Sjaastad
2019-02-20 14:45:06 +01:00
parent eb28bb8520
commit ec2d2ce559
2 changed files with 282 additions and 259 deletions

View File

@@ -37,10 +37,6 @@
#include "RigMainGrid.h"
#include "RigStatisticsDataCache.h"
#include "RimGeoMechContourMapView.h"
#include "RimEclipseContourMapView.h"
#include "RimGeoMechContourMapProjection.h"
#include "RimEclipseContourMapProjection.h"
#include "Rim2dIntersectionView.h"
#include "Rim2dIntersectionViewCollection.h"
#include "Rim3dView.h"
@@ -48,11 +44,15 @@
#include "RimCellEdgeColors.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseContourMapProjection.h"
#include "RimEclipseContourMapView.h"
#include "RimEclipseFaultColors.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseView.h"
#include "RimFaultInViewCollection.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechContourMapProjection.h"
#include "RimGeoMechContourMapView.h"
#include "RimGeoMechResultDefinition.h"
#include "RimGeoMechView.h"
#include "RimReservoirCellResultsStorage.h"
@@ -61,8 +61,8 @@
#include "RiuViewer.h"
#include <QMessageBox>
#include <QApplication>
#include <QMessageBox>
CAF_PDM_SOURCE_INIT(Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig");
//--------------------------------------------------------------------------------------------------
@@ -71,28 +71,28 @@ CAF_PDM_SOURCE_INIT(Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig");
namespace caf
{
template<>
void caf::AppEnum<Rim3dOverlayInfoConfig::StatisticsTimeRangeType>::setUp()
{
addItem(Rim3dOverlayInfoConfig::ALL_TIMESTEPS, "ALL_TIMESTEPS", "All Time Steps");
addItem(Rim3dOverlayInfoConfig::CURRENT_TIMESTEP, "CURRENT_TIMESTEP", "Current Time Step");
setDefault(Rim3dOverlayInfoConfig::ALL_TIMESTEPS);
}
template<>
void caf::AppEnum<Rim3dOverlayInfoConfig::StatisticsTimeRangeType>::setUp()
{
addItem(Rim3dOverlayInfoConfig::ALL_TIMESTEPS, "ALL_TIMESTEPS", "All Time Steps");
addItem(Rim3dOverlayInfoConfig::CURRENT_TIMESTEP, "CURRENT_TIMESTEP", "Current Time Step");
setDefault(Rim3dOverlayInfoConfig::ALL_TIMESTEPS);
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
namespace caf
{
template<>
void caf::AppEnum<Rim3dOverlayInfoConfig::StatisticsCellRangeType>::setUp()
{
addItem(Rim3dOverlayInfoConfig::ALL_CELLS, "ALL_CELLS", "All Active Cells");
addItem(Rim3dOverlayInfoConfig::VISIBLE_CELLS, "VISIBLE_CELLS", "Visible Cells");
setDefault(Rim3dOverlayInfoConfig::ALL_CELLS);
}
template<>
void caf::AppEnum<Rim3dOverlayInfoConfig::StatisticsCellRangeType>::setUp()
{
addItem(Rim3dOverlayInfoConfig::ALL_CELLS, "ALL_CELLS", "All Active Cells");
addItem(Rim3dOverlayInfoConfig::VISIBLE_CELLS, "VISIBLE_CELLS", "Visible Cells");
setDefault(Rim3dOverlayInfoConfig::ALL_CELLS);
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
@@ -104,16 +104,16 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig()
CAF_PDM_InitField(&m_active, "Active", true, "Active", "", "", "");
m_active.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_showAnimProgress, "ShowAnimProgress", true, "Animation progress", "", "", "");
CAF_PDM_InitField(&m_showCaseInfo, "ShowInfoText", true, "Case Info", "", "", "");
CAF_PDM_InitField(&m_showResultInfo, "ShowResultInfo", true, "Result Info", "", "", "");
CAF_PDM_InitField(&m_showHistogram, "ShowHistogram", true, "Histogram", "", "", "");
CAF_PDM_InitField(&m_showAnimProgress, "ShowAnimProgress", true, "Animation progress", "", "", "");
CAF_PDM_InitField(&m_showCaseInfo, "ShowInfoText", true, "Case Info", "", "", "");
CAF_PDM_InitField(&m_showResultInfo, "ShowResultInfo", true, "Result Info", "", "", "");
CAF_PDM_InitField(&m_showHistogram, "ShowHistogram", true, "Histogram", "", "", "");
CAF_PDM_InitField(&m_showVolumeWeightedMean, "ShowVolumeWeightedMean", true, "Mobile Volume Weighted Mean", "", "", "");
CAF_PDM_InitField(&m_showVersionInfo, "ShowVersionInfo", true, "Version Info", "", "", "");
CAF_PDM_InitField(&m_showVersionInfo, "ShowVersionInfo", true, "Version Info", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_statisticsTimeRange, "StatisticsTimeRange", "Statistics Time Range", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_statisticsCellRange, "StatisticsCellRange", "Statistics Cell Range", "", "", "");
//m_statisticsCellRange.uiCapability()->setUiHidden(true);
// m_statisticsCellRange.uiCapability()->setUiHidden(true);
m_isVisCellStatUpToDate = false;
@@ -123,22 +123,20 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dOverlayInfoConfig::~Rim3dOverlayInfoConfig()
{
}
Rim3dOverlayInfoConfig::~Rim3dOverlayInfoConfig() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dOverlayInfoConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
void Rim3dOverlayInfoConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
{
if ( hasInvalidStatisticsCombination() )
if (hasInvalidStatisticsCombination())
{
displayPropertyFilteredStatisticsMessage(false);
if ( changedField == &m_statisticsTimeRange ) m_statisticsTimeRange = CURRENT_TIMESTEP;
if ( changedField == &m_statisticsCellRange ) m_statisticsCellRange = ALL_CELLS;
if (changedField == &m_statisticsTimeRange) m_statisticsTimeRange = CURRENT_TIMESTEP;
if (changedField == &m_statisticsCellRange) m_statisticsCellRange = ALL_CELLS;
}
if (changedField == &m_showResultInfo)
@@ -161,7 +159,6 @@ void Rim3dOverlayInfoConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed
{
m_viewDef->viewer()->update();
}
}
//--------------------------------------------------------------------------------------------------
@@ -177,15 +174,19 @@ void Rim3dOverlayInfoConfig::setPosition(cvf::Vec2ui position)
//--------------------------------------------------------------------------------------------------
Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData()
{
auto eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
auto geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
auto eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
auto geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
auto eclipseContourMap = dynamic_cast<RimEclipseContourMapView*>(eclipseView);
auto geoMechContourMap = dynamic_cast<RimGeoMechContourMapView*>(geoMechView);
if (eclipseContourMap) return histogramData(eclipseContourMap);
else if (geoMechContourMap) return histogramData(geoMechContourMap);
else if (eclipseView) return histogramData(eclipseView);
else if (geoMechView) return histogramData(geoMechView);
if (eclipseContourMap)
return histogramData(eclipseContourMap);
else if (geoMechContourMap)
return histogramData(geoMechContourMap);
else if (eclipseView)
return histogramData(eclipseView);
else if (geoMechView)
return histogramData(geoMechView);
return HistogramData();
}
@@ -194,8 +195,8 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData()
//--------------------------------------------------------------------------------------------------
QString Rim3dOverlayInfoConfig::timeStepText()
{
RimEclipseView * eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
if (eclipseView) return timeStepText(eclipseView);
if (geoMechView) return timeStepText(geoMechView);
@@ -301,10 +302,10 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData(RimE
if (isResultsInfoRelevant)
{
histData.min = contourMap->contourMapProjection()->minValue();
histData.max = contourMap->contourMapProjection()->maxValue();
histData.min = contourMap->contourMapProjection()->minValue();
histData.max = contourMap->contourMapProjection()->maxValue();
histData.mean = contourMap->contourMapProjection()->meanValue();
histData.sum = contourMap->contourMapProjection()->sumAllValues();
histData.sum = contourMap->contourMapProjection()->sumAllValues();
}
}
return histData;
@@ -332,7 +333,6 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData(RimG
return histData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -369,13 +369,17 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData(RimE
currentTimeStep = 0;
}
eclipseView->currentGridCellResults()->minMaxCellScalarValues(eclResAddr, currentTimeStep, histData.min, histData.max);
eclipseView->currentGridCellResults()->p10p90CellScalarValues(eclResAddr, currentTimeStep, histData.p10, histData.p90);
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);
eclipseView->currentGridCellResults()->mobileVolumeWeightedMean(
eclResAddr, currentTimeStep, histData.weightedMean);
histData.histogram = &(eclipseView->currentGridCellResults()->cellScalarValuesHistogram(eclResAddr, currentTimeStep));
histData.histogram =
&(eclipseView->currentGridCellResults()->cellScalarValuesHistogram(eclResAddr, currentTimeStep));
}
else
{
@@ -416,14 +420,15 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData(RimE
}
else if (eclipseView->cellResult()->isFlowDiagOrInjectionFlooding())
{
if (m_statisticsTimeRange == CURRENT_TIMESTEP || m_statisticsTimeRange == ALL_TIMESTEPS) // All timesteps is ignored
if (m_statisticsTimeRange == CURRENT_TIMESTEP ||
m_statisticsTimeRange == ALL_TIMESTEPS) // All timesteps is ignored
{
int currentTimeStep = eclipseView->currentTimeStep();
if (m_statisticsCellRange == ALL_CELLS)
{
RigFlowDiagResults* fldResults = eclipseView->cellResult()->flowDiagSolution()->flowDiagResults();
RigFlowDiagResultAddress resAddr = eclipseView->cellResult()->flowDiagResAddress();
RigFlowDiagResults* fldResults = eclipseView->cellResult()->flowDiagSolution()->flowDiagResults();
RigFlowDiagResultAddress resAddr = eclipseView->cellResult()->flowDiagResAddress();
fldResults->minMaxScalarValues(resAddr, currentTimeStep, &histData.min, &histData.max);
fldResults->p10p90ScalarValues(resAddr, currentTimeStep, &histData.p10, &histData.p90);
@@ -461,9 +466,10 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData(RimG
if (geoMechView)
{
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;
bool isResultsInfoRelevant = caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;
bool isResultsInfoRelevant =
caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
if (isResultsInfoRelevant)
{
@@ -534,46 +540,51 @@ QString Rim3dOverlayInfoConfig::caseInfoText(RimEclipseView* eclipseView)
RimEclipseContourMapView* contourMap = dynamic_cast<RimEclipseContourMapView*>(eclipseView);
if (contourMap && contourMap->contourMapProjection())
{
QString totCellCount = QString::number(contourMap->contourMapProjection()->numberOfCells());
cvf::uint validCellCount = contourMap->contourMapProjection()->numberOfValidCells();
QString activeCellCountText = QString::number(validCellCount);
QString iSize = QString::number(contourMap->contourMapProjection()->numberOfElementsIJ().x());
QString jSize = QString::number(contourMap->contourMapProjection()->numberOfElementsIJ().y());
QString aggregationType = contourMap->contourMapProjection()->resultAggregationText();
QString weightingParameterString;
QString totCellCount = QString::number(contourMap->contourMapProjection()->numberOfCells());
cvf::uint validCellCount = contourMap->contourMapProjection()->numberOfValidCells();
QString activeCellCountText = QString::number(validCellCount);
QString iSize = QString::number(contourMap->contourMapProjection()->numberOfElementsIJ().x());
QString jSize = QString::number(contourMap->contourMapProjection()->numberOfElementsIJ().y());
QString aggregationType = contourMap->contourMapProjection()->resultAggregationText();
QString weightingParameterString;
if (contourMap->contourMapProjection()->weightingParameter() != "None")
{
weightingParameterString += QString(" (Weight: %1)").arg(contourMap->contourMapProjection()->weightingParameter());
weightingParameterString +=
QString(" (Weight: %1)").arg(contourMap->contourMapProjection()->weightingParameter());
}
infoText += QString(
"<p><b>-- Contour Map: %1 --</b><p> "
"<b>Sample Count. Total:</b> %2 <b>Valid Results:</b> %3 <br>"
"<b>Projection Type:</b> %4%5<br>").arg(caseName, totCellCount, activeCellCountText, aggregationType, weightingParameterString);
infoText += QString("<p><b>-- Contour Map: %1 --</b><p> "
"<b>Sample Count. Total:</b> %2 <b>Valid Results:</b> %3 <br>"
"<b>Projection Type:</b> %4%5<br>")
.arg(caseName, totCellCount, activeCellCountText, aggregationType, weightingParameterString);
}
else if (eclipseView->mainGrid())
{
QString totCellCount = QString::number(eclipseView->mainGrid()->globalCellArray().size());
size_t mxActCellCount = eclipseView->eclipseCase()->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL)->reservoirActiveCellCount();
size_t frActCellCount = eclipseView->eclipseCase()->eclipseCaseData()->activeCellInfo(RiaDefines::FRACTURE_MODEL)->reservoirActiveCellCount();
QString totCellCount = QString::number(eclipseView->mainGrid()->globalCellArray().size());
size_t mxActCellCount = eclipseView->eclipseCase()
->eclipseCaseData()
->activeCellInfo(RiaDefines::MATRIX_MODEL)
->reservoirActiveCellCount();
size_t frActCellCount = eclipseView->eclipseCase()
->eclipseCaseData()
->activeCellInfo(RiaDefines::FRACTURE_MODEL)
->reservoirActiveCellCount();
QString activeCellCountText;
if (frActCellCount > 0) activeCellCountText += "Matrix : ";
if (frActCellCount > 0) activeCellCountText += "Matrix : ";
activeCellCountText += QString::number(mxActCellCount);
if (frActCellCount > 0) activeCellCountText += " Fracture : " + QString::number(frActCellCount);
if (frActCellCount > 0) activeCellCountText += " Fracture : " + QString::number(frActCellCount);
QString iSize = QString::number(eclipseView->mainGrid()->cellCountI());
QString jSize = QString::number(eclipseView->mainGrid()->cellCountJ());
QString kSize = QString::number(eclipseView->mainGrid()->cellCountK());
QString zScale = QString::number(eclipseView->scaleZ());
infoText += QString(
"<p><b>-- %1 --</b><p> "
"<b>Cell count. Total:</b> %2 <b>Active:</b> %3 <br>"
"<b>Main Grid I,J,K:</b> %4, %5, %6 <b>Z-Scale:</b> %7<br>").arg(caseName, totCellCount, activeCellCountText, iSize, jSize, kSize, zScale);
infoText += QString("<p><b>-- %1 --</b><p> "
"<b>Cell count. Total:</b> %2 <b>Active:</b> %3 <br>"
"<b>Main Grid I,J,K:</b> %4, %5, %6 <b>Z-Scale:</b> %7<br>")
.arg(caseName, totCellCount, activeCellCountText, iSize, jSize, kSize, zScale);
}
}
return infoText;
@@ -589,37 +600,36 @@ QString Rim3dOverlayInfoConfig::caseInfoText(RimGeoMechView* geoMechView)
if (geoMechView)
{
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;
RigFemPartCollection* femParts = caseData ? caseData->femParts() : nullptr;
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;
RigFemPartCollection* femParts = caseData ? caseData->femParts() : nullptr;
if (femParts)
{
QString caseName = geoMechCase->caseUserDescription();
QString caseName = geoMechCase->caseUserDescription();
RimGeoMechContourMapView* contourMap = dynamic_cast<RimGeoMechContourMapView*>(geoMechView);
if (contourMap && contourMap->contourMapProjection())
{
QString totCellCount = QString::number(contourMap->contourMapProjection()->numberOfCells());
cvf::uint validCellCount = contourMap->contourMapProjection()->numberOfValidCells();
QString totCellCount = QString::number(contourMap->contourMapProjection()->numberOfCells());
cvf::uint validCellCount = contourMap->contourMapProjection()->numberOfValidCells();
QString activeCellCountText = QString::number(validCellCount);
QString iSize = QString::number(contourMap->contourMapProjection()->numberOfElementsIJ().x());
QString jSize = QString::number(contourMap->contourMapProjection()->numberOfElementsIJ().y());
QString aggregationType = contourMap->contourMapProjection()->resultAggregationText();
QString iSize = QString::number(contourMap->contourMapProjection()->numberOfElementsIJ().x());
QString jSize = QString::number(contourMap->contourMapProjection()->numberOfElementsIJ().y());
QString aggregationType = contourMap->contourMapProjection()->resultAggregationText();
infoText += QString("<p><b>-- Contour Map: %1 --</b><p> "
"<b>Sample Count. Total:</b> %2 <b>Valid Results:</b> %3 <br>"
"<b>Projection Type:</b> %4<br>")
.arg(caseName, totCellCount, activeCellCountText, aggregationType);
"<b>Sample Count. Total:</b> %2 <b>Valid Results:</b> %3 <br>"
"<b>Projection Type:</b> %4<br>")
.arg(caseName, totCellCount, activeCellCountText, aggregationType);
}
else
{
QString cellCount = QString("%1").arg(femParts->totalElementCount());
QString zScale = QString::number(geoMechView->scaleZ());
QString zScale = QString::number(geoMechView->scaleZ());
infoText = QString(
"<p><b>-- %1 --</b><p>"
"<b>Cell count:</b> %2 <b>Z-Scale:</b> %3<br>").arg(caseName, cellCount, zScale);
infoText = QString("<p><b>-- %1 --</b><p>"
"<b>Cell count:</b> %2 <b>Z-Scale:</b> %3<br>")
.arg(caseName, cellCount, zScale);
}
}
}
@@ -629,7 +639,9 @@ QString Rim3dOverlayInfoConfig::caseInfoText(RimGeoMechView* geoMechView)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, RimEclipseView* eclipseView, bool showVolumeWeightedMean)
QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData,
RimEclipseView* eclipseView,
bool showVolumeWeightedMean)
{
QString infoText;
@@ -640,7 +652,7 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
bool isResultsInfoRelevant = contourMap->contourMapProjection()->numberOfValidCells() > 0u;
if (isResultsInfoRelevant)
{
QString propName = eclipseView->cellResult()->resultVariableUiShortName();
QString propName = eclipseView->cellResult()->resultVariableUiShortName();
QString diffResString = eclipseView->cellResult()->diffResultUiName();
if (!contourMap->contourMapProjection()->isColumnResult())
{
@@ -652,9 +664,13 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
}
infoText += QString("<br><b>Statistics:</b> Current Time Step and Visible Cells");
infoText += QString("<table border=0 cellspacing=5 >"
"<tr> <td>Min</td> <td>Mean</td> <td>Max</td> <td>Sum</td> </tr>"
"<tr> <td>%1</td> <td> %2</td> <td> %3</td> <td> %4</td> </tr>"
"</table>").arg(histData.min).arg(histData.mean).arg(histData.max).arg(histData.sum);
"<tr> <td>Min</td> <td>Mean</td> <td>Max</td> <td>Sum</td> </tr>"
"<tr> <td>%1</td> <td> %2</td> <td> %3</td> <td> %4</td> </tr>"
"</table>")
.arg(histData.min)
.arg(histData.mean)
.arg(histData.max)
.arg(histData.sum);
}
}
else if (eclipseView)
@@ -669,7 +685,7 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
if (isResultsInfoRelevant)
{
QString propName = eclipseView->cellResult()->resultVariableUiShortName();
QString propName = eclipseView->cellResult()->resultVariableUiShortName();
QString diffResString = eclipseView->cellResult()->diffResultUiName();
QString timeRangeText = m_statisticsTimeRange().uiText();
if (eclipseView->cellResult()->isFlowDiagOrInjectionFlooding())
@@ -686,12 +702,18 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
infoText += QString("<table border=0 cellspacing=5 >"
"<tr> <td>Min</td> <td>P90</td> <td>Mean</td> <td>P10</td> <td>Max</td> <td>Sum</td> </tr>"
"<tr> <td>%1</td> <td> %2</td> <td> %3</td> <td> %4</td> <td> %5</td> <td> %6</td> </tr>"
"</table>").arg(histData.min).arg(histData.p10).arg(histData.mean).arg(histData.p90).arg(histData.max).arg(histData.sum);
"</table>")
.arg(histData.min)
.arg(histData.p10)
.arg(histData.mean)
.arg(histData.p90)
.arg(histData.max)
.arg(histData.sum);
if (eclipseView->faultResultSettings()->hasValidCustomResult())
{
QString faultMapping;
bool isShowingGrid = eclipseView->faultCollection()->isGridVisualizationMode();
bool isShowingGrid = eclipseView->faultCollection()->isGridVisualizationMode();
if (!isShowingGrid)
{
if (eclipseView->faultCollection()->faultResult() == RimFaultInViewCollection::FAULT_BACK_FACE_CULLING)
@@ -713,20 +735,23 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
}
infoText += QString("<b>Fault results: </b> %1<br>").arg(faultMapping);
infoText += QString("<b>Fault Property:</b> %1 <br>").arg(eclipseView->faultResultSettings()->customFaultResult()->resultVariableUiShortName());
infoText += QString("<b>Fault Property:</b> %1 <br>")
.arg(eclipseView->faultResultSettings()->customFaultResult()->resultVariableUiShortName());
}
}
if (eclipseView->hasUserRequestedAnimation() && eclipseView->cellEdgeResult()->hasResult())
{
double min, max;
double min, max;
QString cellEdgeName = eclipseView->cellEdgeResult()->resultVariableUiShortName();
eclipseView->cellEdgeResult()->minMaxCellEdgeValues(min, max);
infoText += QString("<b>Cell Edge Property:</b> %1 ").arg(cellEdgeName);
infoText += QString("<table border=0 cellspacing=5 >"
"<tr> <td>Min</td> <td></td> <td></td> <td></td> <td>Max</td> </tr>"
"<tr> <td>%1</td> <td></td> <td></td> <td></td> <td> %2</td></tr>"
"</table>").arg(min).arg(max);
"</table>")
.arg(min)
.arg(max);
}
if (showVolumeWeightedMean && histData.weightedMean != HUGE_VAL)
@@ -746,9 +771,10 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
if (geoMechView)
{
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;
bool isResultsInfoRelevant = caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;
bool isResultsInfoRelevant =
caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
if (isResultsInfoRelevant)
{
@@ -758,23 +784,23 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
QString diffResString = geoMechView->cellResultResultDefinition()->diffResultUiName();
switch (geoMechView->cellResultResultDefinition()->resultPositionType())
{
case RIG_NODAL:
resultPos = "Nodal";
break;
case RIG_NODAL:
resultPos = "Nodal";
break;
case RIG_ELEMENT_NODAL:
resultPos = "Element nodal";
break;
case RIG_ELEMENT_NODAL:
resultPos = "Element nodal";
break;
case RIG_INTEGRATION_POINT:
resultPos = "Integration point";
break;
case RIG_INTEGRATION_POINT:
resultPos = "Integration point";
break;
case RIG_ELEMENT:
resultPos = "Element";
break;
default:
break;
case RIG_ELEMENT:
resultPos = "Element";
break;
default:
break;
}
if (compName == "")
{
@@ -789,11 +815,18 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
{
infoText += QString("%1<br>").arg(diffResString);
}
infoText += QString("<br><b>Statistics:</b> ") + m_statisticsTimeRange().uiText() + " and " + m_statisticsCellRange().uiText();
infoText += QString("<br><b>Statistics:</b> ") + m_statisticsTimeRange().uiText() + " and " +
m_statisticsCellRange().uiText();
infoText += QString("<table border=0 cellspacing=5 >"
"<tr> <td>Min</td> <td>P90</td> <td>Mean</td> <td>P10</td> <td>Max</td> <td>Sum</td> </tr>"
"<tr> <td>%1</td> <td> %2</td> <td> %3</td> <td> %4</td> <td> %5</td> <td> %6</td> </tr>"
"</table>").arg(histData.min).arg(histData.p10).arg(histData.mean).arg(histData.p90).arg(histData.max).arg(histData.sum);
"</table>")
.arg(histData.min)
.arg(histData.p10)
.arg(histData.mean)
.arg(histData.p90)
.arg(histData.max)
.arg(histData.sum);
}
else
{
@@ -858,7 +891,7 @@ void Rim3dOverlayInfoConfig::update3DInfo()
m_statisticsTimeRange = CURRENT_TIMESTEP;
}
RimEclipseView * reservoirView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
RimEclipseView* reservoirView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
if (reservoirView)
{
updateEclipse3DInfo(reservoirView);
@@ -867,7 +900,7 @@ void Rim3dOverlayInfoConfig::update3DInfo()
m_gridStatisticsDialog->updateFromRimView(reservoirView);
}
RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
if (geoMechView)
{
m_showVolumeWeightedMean = false;
@@ -889,7 +922,6 @@ caf::PdmFieldHandle* Rim3dOverlayInfoConfig::objectToggleField()
return &m_active;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -897,9 +929,9 @@ void Rim3dOverlayInfoConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
{
caf::PdmUiGroup* visGroup = uiOrdering.addNewGroup("Visibility");
RimEclipseView * eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
RimEclipseContourMapView* contourMap = dynamic_cast<RimEclipseContourMapView*>(eclipseView);
RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
RimEclipseContourMapView* contourMap = dynamic_cast<RimEclipseContourMapView*>(eclipseView);
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
visGroup->add(&m_showAnimProgress);
visGroup->add(&m_showCaseInfo);
@@ -945,7 +977,7 @@ void Rim3dOverlayInfoConfig::setReservoirView(RimGridView* ownerReservoirView)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView* eclipseView)
{
HistogramData histData;
@@ -987,7 +1019,7 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView* geoMechView)
{
HistogramData histData;
@@ -1019,9 +1051,10 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
if (m_showHistogram())
{
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;
bool isResultsInfoRelevant = caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;
bool isResultsInfoRelevant =
caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
if (isResultsInfoRelevant)
{
@@ -1053,8 +1086,8 @@ void Rim3dOverlayInfoConfig::update3DInfoIn2dViews() const
//--------------------------------------------------------------------------------------------------
QString Rim3dOverlayInfoConfig::timeStepText(RimEclipseView* eclipseView)
{
int currTimeStepIndex = eclipseView->currentTimeStep();
std::vector<QDateTime> timeSteps = eclipseView->currentGridCellResults()->allTimeStepDatesFromEclipseReader();
int currTimeStepIndex = eclipseView->currentTimeStep();
std::vector<QDateTime> timeSteps = eclipseView->currentGridCellResults()->allTimeStepDatesFromEclipseReader();
QString dateTimeString;
if (currTimeStepIndex >= 0 && currTimeStepIndex < (int)timeSteps.size())
@@ -1063,13 +1096,12 @@ QString Rim3dOverlayInfoConfig::timeStepText(RimEclipseView* eclipseView)
QString dateString = RiaQDateTimeTools::toStringUsingApplicationLocale(timeSteps[currTimeStepIndex], dateFormat);
dateTimeString = QString("Time Step: %1/%2 %3").arg(QString::number(currTimeStepIndex),
QString::number(timeSteps.size() - 1),
dateString);
dateTimeString = QString("Time Step: %1/%2 %3")
.arg(QString::number(currTimeStepIndex), QString::number(timeSteps.size() - 1), dateString);
}
return QString("<p><b><center>-- %1 --</center></b>").arg(dateTimeString) +
QString("<center>------------------------------------------------</center>");
QString("<center>------------------------------------------------</center>");
}
//--------------------------------------------------------------------------------------------------
@@ -1085,13 +1117,13 @@ QString Rim3dOverlayInfoConfig::timeStepText(RimGeoMechView* geoMechView)
QString dateTimeString;
if (currTimeStepIndex >= 0 && currTimeStepIndex < timeSteps.size())
{
dateTimeString = QString("Time Step: %1/%2 %3").arg(QString::number(currTimeStepIndex),
QString::number(timeSteps.size() - 1),
timeSteps[currTimeStepIndex]);
dateTimeString =
QString("Time Step: %1/%2 %3")
.arg(QString::number(currTimeStepIndex), QString::number(timeSteps.size() - 1), timeSteps[currTimeStepIndex]);
}
return QString("<p><b><center>-- %1 --</center></b>").arg(dateTimeString) +
QString("<center>------------------------------------------------</center>");
QString("<center>------------------------------------------------</center>");
}
//--------------------------------------------------------------------------------------------------
@@ -1099,8 +1131,8 @@ QString Rim3dOverlayInfoConfig::timeStepText(RimGeoMechView* geoMechView)
//--------------------------------------------------------------------------------------------------
void Rim3dOverlayInfoConfig::updateVisCellStatsIfNeeded()
{
RimEclipseView * eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
if (!m_isVisCellStatUpToDate)
{
@@ -1108,28 +1140,22 @@ void Rim3dOverlayInfoConfig::updateVisCellStatsIfNeeded()
if (geoMechView)
{
RigFemResultAddress resAddress = geoMechView->cellResultResultDefinition()->resultAddress();
calc = new RigFemNativeVisibleCellsStatCalc(geoMechView->geoMechCase()->geoMechData(),
resAddress,
geoMechView->currentTotalCellVisibility().p());
calc = new RigFemNativeVisibleCellsStatCalc(
geoMechView->geoMechCase()->geoMechData(), resAddress, geoMechView->currentTotalCellVisibility().p());
}
else if (eclipseView)
{
if (eclipseView->cellResult()->isFlowDiagOrInjectionFlooding())
{
RigFlowDiagResultAddress resAddr = eclipseView->cellResult()->flowDiagResAddress();
RigFlowDiagResults* fldResults = eclipseView->cellResult()->flowDiagSolution()->flowDiagResults();
calc = new RigFlowDiagVisibleCellsStatCalc(fldResults,
resAddr,
eclipseView->currentTotalCellVisibility().p());
RigFlowDiagResultAddress resAddr = eclipseView->cellResult()->flowDiagResAddress();
RigFlowDiagResults* fldResults = eclipseView->cellResult()->flowDiagSolution()->flowDiagResults();
calc = new RigFlowDiagVisibleCellsStatCalc(fldResults, resAddr, eclipseView->currentTotalCellVisibility().p());
}
else
{
RigEclipseResultAddress scalarIndex = eclipseView->cellResult()->eclipseResultAddress();
calc = new RigEclipseNativeVisibleCellsStatCalc(eclipseView->currentGridCellResults(),
scalarIndex,
eclipseView->currentTotalCellVisibility().p());
calc = new RigEclipseNativeVisibleCellsStatCalc(
eclipseView->currentGridCellResults(), scalarIndex, eclipseView->currentTotalCellVisibility().p());
}
}
@@ -1149,19 +1175,20 @@ void Rim3dOverlayInfoConfig::displayPropertyFilteredStatisticsMessage(bool showS
if (showSwitchToCurrentTimestep)
{
switchString = QString("<br>"
"Switching to statistics for <b>Current Time Step</b>");
"Switching to statistics for <b>Current Time Step</b>");
}
if (!isShowing)
{
isShowing = true;
QMessageBox::information(m_viewDef->viewer()->layoutWidget(),
QMessageBox::information(
m_viewDef->viewer()->layoutWidget(),
QString("ResInsight"),
QString("Statistics not available<br>"
"<br>"
"Statistics calculations of <b>Visible Cells</b> for <b>All Time Steps</b> is not supported<br>"
"when you have an active Property filter on a time varying result.<br>")
+ switchString);
"<br>"
"Statistics calculations of <b>Visible Cells</b> for <b>All Time Steps</b> is not supported<br>"
"when you have an active Property filter on a time varying result.<br>") +
switchString);
isShowing = false;
}
}
@@ -1171,13 +1198,13 @@ void Rim3dOverlayInfoConfig::displayPropertyFilteredStatisticsMessage(bool showS
//--------------------------------------------------------------------------------------------------
bool Rim3dOverlayInfoConfig::hasInvalidStatisticsCombination()
{
if (m_viewDef->propertyFilterCollection()
&& m_viewDef->propertyFilterCollection()->hasActiveDynamicFilters()
&& m_statisticsCellRange() == VISIBLE_CELLS
&& m_statisticsTimeRange() == ALL_TIMESTEPS )
if (m_viewDef->propertyFilterCollection() && m_viewDef->propertyFilterCollection()->hasActiveDynamicFilters() &&
m_statisticsCellRange() == VISIBLE_CELLS && m_statisticsTimeRange() == ALL_TIMESTEPS)
{
RimEclipseView * eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
if (!(eclipseView && eclipseView->cellResult()->isFlowDiagOrInjectionFlooding())) // If isFlowDiagOrInjFlooding then skip this check as ALL_TIMESTEPS is overridden to CURRENT behind the scenes
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
if (!(eclipseView && eclipseView->cellResult()
->isFlowDiagOrInjectionFlooding())) // If isFlowDiagOrInjFlooding then skip this check as
// ALL_TIMESTEPS is overridden to CURRENT behind the scenes
{
return true;
}

View File

@@ -27,6 +27,7 @@
#include "cvfObject.h"
#include "cvfVector2.h"
#include <cmath>
#include <memory>
@@ -102,49 +103,44 @@ public:
VISIBLE_CELLS
};
protected:
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
caf::PdmFieldHandle* objectToggleField() override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
private:
void updateEclipse3DInfo(RimEclipseView * reservoirView);
void updateGeoMech3DInfo(RimGeoMechView * geoMechView);
void update3DInfoIn2dViews() const;
QString timeStepText(RimEclipseView* eclipseView);
QString timeStepText(RimGeoMechView* geoMechView);
HistogramData histogramData(RimEclipseContourMapView* contourMap);
HistogramData histogramData(RimGeoMechContourMapView* contourMap);
HistogramData histogramData(RimEclipseView* eclipseView);
HistogramData histogramData(RimGeoMechView* geoMechView);
QString caseInfoText(RimEclipseView* eclipseView);
QString caseInfoText(RimGeoMechView* geoMechView);
QString resultInfoText(const HistogramData& histData, RimEclipseView* eclipseView, bool showVolumeWeightedMean);
QString resultInfoText(const HistogramData& histData, RimGeoMechView* geoMechView);
caf::PdmField<bool> m_active;
caf::PdmField<bool> m_showAnimProgress;
caf::PdmField<bool> m_showCaseInfo;
caf::PdmField<bool> m_showResultInfo;
caf::PdmField<bool> m_showVolumeWeightedMean;
caf::PdmField<bool> m_showHistogram;
caf::PdmField<bool> m_showVersionInfo;
caf::PdmField<caf::AppEnum<StatisticsTimeRangeType> > m_statisticsTimeRange;
caf::PdmField<caf::AppEnum<StatisticsCellRangeType> > m_statisticsCellRange;
caf::PdmPointer<RimGridView> m_viewDef;
cvf::Vec2ui m_position;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
caf::PdmFieldHandle* objectToggleField() override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void updateEclipse3DInfo(RimEclipseView* reservoirView);
void updateGeoMech3DInfo(RimGeoMechView* geoMechView);
void update3DInfoIn2dViews() const;
QString timeStepText(RimEclipseView* eclipseView);
QString timeStepText(RimGeoMechView* geoMechView);
HistogramData histogramData(RimEclipseContourMapView* contourMap);
HistogramData histogramData(RimGeoMechContourMapView* contourMap);
HistogramData histogramData(RimEclipseView* eclipseView);
HistogramData histogramData(RimGeoMechView* geoMechView);
QString caseInfoText(RimEclipseView* eclipseView);
QString caseInfoText(RimGeoMechView* geoMechView);
QString resultInfoText(const HistogramData& histData, RimEclipseView* eclipseView, bool showVolumeWeightedMean);
QString resultInfoText(const HistogramData& histData, RimGeoMechView* geoMechView);
void updateVisCellStatsIfNeeded();
void displayPropertyFilteredStatisticsMessage(bool showSwitchToCurrentTimestep);
bool hasInvalidStatisticsCombination();
bool m_isVisCellStatUpToDate;
cvf::ref<RigStatisticsDataCache> m_visibleCellStatistics;
private:
caf::PdmField<bool> m_active;
caf::PdmField<bool> m_showAnimProgress;
caf::PdmField<bool> m_showCaseInfo;
caf::PdmField<bool> m_showResultInfo;
caf::PdmField<bool> m_showVolumeWeightedMean;
caf::PdmField<bool> m_showHistogram;
caf::PdmField<bool> m_showVersionInfo;
caf::PdmField<caf::AppEnum<StatisticsTimeRangeType> > m_statisticsTimeRange;
caf::PdmField<caf::AppEnum<StatisticsCellRangeType> > m_statisticsCellRange;
caf::PdmPointer<RimGridView> m_viewDef;
cvf::Vec2ui m_position;
bool m_isVisCellStatUpToDate;
cvf::ref<RigStatisticsDataCache> m_visibleCellStatistics;
std::unique_ptr<RicGridStatisticsDialog> m_gridStatisticsDialog;
};