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");
//--------------------------------------------------------------------------------------------------
@@ -78,7 +78,7 @@ namespace caf
addItem(Rim3dOverlayInfoConfig::CURRENT_TIMESTEP, "CURRENT_TIMESTEP", "Current Time Step");
setDefault(Rim3dOverlayInfoConfig::ALL_TIMESTEPS);
}
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -92,7 +92,7 @@ namespace caf
addItem(Rim3dOverlayInfoConfig::VISIBLE_CELLS, "VISIBLE_CELLS", "Visible Cells");
setDefault(Rim3dOverlayInfoConfig::ALL_CELLS);
}
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
@@ -123,17 +123,15 @@ 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())
{
displayPropertyFilteredStatisticsMessage(false);
@@ -161,7 +159,6 @@ void Rim3dOverlayInfoConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed
{
m_viewDef->viewer()->update();
}
}
//--------------------------------------------------------------------------------------------------
@@ -182,10 +179,14 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData()
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();
}
@@ -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,7 +420,8 @@ 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();
@@ -463,7 +468,8 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData(RimG
{
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;
bool isResultsInfoRelevant = caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
bool isResultsInfoRelevant =
caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
if (isResultsInfoRelevant)
{
@@ -543,19 +549,26 @@ QString Rim3dOverlayInfoConfig::caseInfoText(RimEclipseView* eclipseView)
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> "
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);
"<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();
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 : ";
@@ -567,13 +580,11 @@ QString Rim3dOverlayInfoConfig::caseInfoText(RimEclipseView* eclipseView)
QString kSize = QString::number(eclipseView->mainGrid()->cellCountK());
QString zScale = QString::number(eclipseView->scaleZ());
infoText += QString(
"<p><b>-- %1 --</b><p> "
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);
"<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;
@@ -613,13 +624,12 @@ QString Rim3dOverlayInfoConfig::caseInfoText(RimGeoMechView* geoMechView)
}
else
{
QString cellCount = QString("%1").arg(femParts->totalElementCount());
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;
@@ -654,7 +666,11 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
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);
"</table>")
.arg(histData.min)
.arg(histData.mean)
.arg(histData.max)
.arg(histData.sum);
}
}
else if (eclipseView)
@@ -686,7 +702,13 @@ 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())
{
@@ -713,7 +735,8 @@ 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());
}
}
@@ -726,7 +749,9 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
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)
@@ -748,7 +773,8 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
{
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;
bool isResultsInfoRelevant = caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
bool isResultsInfoRelevant =
caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
if (isResultsInfoRelevant)
{
@@ -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
{
@@ -889,7 +922,6 @@ caf::PdmFieldHandle* Rim3dOverlayInfoConfig::objectToggleField()
return &m_active;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1021,7 +1053,8 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
{
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;
bool isResultsInfoRelevant = caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
bool isResultsInfoRelevant =
caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
if (isResultsInfoRelevant)
{
@@ -1063,9 +1096,8 @@ 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) +
@@ -1085,9 +1117,9 @@ 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) +
@@ -1108,10 +1140,8 @@ 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)
{
@@ -1119,17 +1149,13 @@ void Rim3dOverlayInfoConfig::updateVisCellStatsIfNeeded()
{
RigFlowDiagResultAddress resAddr = eclipseView->cellResult()->flowDiagResAddress();
RigFlowDiagResults* fldResults = eclipseView->cellResult()->flowDiagSolution()->flowDiagResults();
calc = new RigFlowDiagVisibleCellsStatCalc(fldResults,
resAddr,
eclipseView->currentTotalCellVisibility().p());
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());
}
}
@@ -1155,13 +1181,14 @@ void Rim3dOverlayInfoConfig::displayPropertyFilteredStatisticsMessage(bool showS
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);
"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
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,18 +103,13 @@ public:
VISIBLE_CELLS
};
protected:
private:
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);
@@ -125,6 +121,11 @@ private:
QString resultInfoText(const HistogramData& histData, RimEclipseView* eclipseView, bool showVolumeWeightedMean);
QString resultInfoText(const HistogramData& histData, RimGeoMechView* geoMechView);
void updateVisCellStatsIfNeeded();
void displayPropertyFilteredStatisticsMessage(bool showSwitchToCurrentTimestep);
bool hasInvalidStatisticsCombination();
private:
caf::PdmField<bool> m_active;
caf::PdmField<bool> m_showAnimProgress;
caf::PdmField<bool> m_showCaseInfo;
@@ -137,12 +138,7 @@ private:
caf::PdmField<caf::AppEnum<StatisticsCellRangeType> > m_statisticsCellRange;
caf::PdmPointer<RimGridView> m_viewDef;
cvf::Vec2ui m_position;
void updateVisCellStatsIfNeeded();
void displayPropertyFilteredStatisticsMessage(bool showSwitchToCurrentTimestep);
bool hasInvalidStatisticsCombination();
bool m_isVisCellStatUpToDate;
cvf::ref<RigStatisticsDataCache> m_visibleCellStatistics;