diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index ffd069bd20..5685f9e142 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -208,6 +208,9 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView) if (isResultsInfoRelevant) { size_t scalarIndex = eclipseView->cellResult()->scalarResultIndex(); + if (scalarIndex != cvf::UNDEFINED_SIZE_T) + { + if (m_statisticsCellRange == ALL_CELLS) { if (m_statisticsTimeRange == ALL_TIMESTEPS) @@ -256,6 +259,7 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView) histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram(currentTimeStep)); } } + } } } @@ -364,7 +368,7 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView) if (showHistogram()) { - if (isResultsInfoRelevant) + if (isResultsInfoRelevant && histogram) { eclipseView->viewer()->showHistogram(true); eclipseView->viewer()->setHistogram(min, max, *histogram); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 3b6e3aab44..500d1d3d63 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -506,6 +506,8 @@ void RimEclipseResultDefinition::loadResult() //-------------------------------------------------------------------------------------------------- bool RimEclipseResultDefinition::hasStaticResult() const { + if (this->resultType() == RimDefines::FLOW_DIAGNOSTICS) return false; + const RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults(); size_t gridScalarResultIndex = this->scalarResultIndex(); @@ -524,7 +526,11 @@ bool RimEclipseResultDefinition::hasStaticResult() const //-------------------------------------------------------------------------------------------------- bool RimEclipseResultDefinition::hasResult() const { - if (this->currentGridCellResults() && this->currentGridCellResults()->cellResults()) + if (this->resultType() == RimDefines::FLOW_DIAGNOSTICS) + { + if (m_flowSolution() && !m_resultVariable().isEmpty()) return true; + } + else if (this->currentGridCellResults() && this->currentGridCellResults()->cellResults()) { const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults()->cellResults(); size_t gridScalarResultIndex = gridCellResults->findScalarResultIndex(m_resultType(), m_resultVariable()); @@ -546,6 +552,10 @@ bool RimEclipseResultDefinition::hasDynamicResult() const { return true; } + else if (m_resultType() == RimDefines::FLOW_DIAGNOSTICS) + { + return true; + } if (this->currentGridCellResults() && this->currentGridCellResults()->cellResults()) { diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index c90e0a6709..700d4d8958 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -992,47 +992,54 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R { if (resultColors->hasResult()) { - double globalMin, globalMax; - double globalPosClosestToZero, globalNegClosestToZero; - cellResultsData->minMaxCellScalarValues(resultColors->scalarResultIndex(), globalMin, globalMax); - cellResultsData->posNegClosestToZero(resultColors->scalarResultIndex(), globalPosClosestToZero, globalNegClosestToZero); - - double localMin, localMax; - double localPosClosestToZero, localNegClosestToZero; - if (resultColors->hasDynamicResult()) + if (resultColors->resultType() == RimDefines::FLOW_DIAGNOSTICS) { - cellResultsData->minMaxCellScalarValues(resultColors->scalarResultIndex(), m_currentTimeStep, localMin, localMax); - cellResultsData->posNegClosestToZero(resultColors->scalarResultIndex(), m_currentTimeStep, localPosClosestToZero, localNegClosestToZero); + // Todo } else { - localMin = globalMin; - localMax = globalMax; + double globalMin, globalMax; + double globalPosClosestToZero, globalNegClosestToZero; + cellResultsData->minMaxCellScalarValues(resultColors->scalarResultIndex(), globalMin, globalMax); + cellResultsData->posNegClosestToZero(resultColors->scalarResultIndex(), globalPosClosestToZero, globalNegClosestToZero); - localPosClosestToZero = globalPosClosestToZero; - localNegClosestToZero = globalNegClosestToZero; - } - - CVF_ASSERT(resultColors->legendConfig()); - - resultColors->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero); - resultColors->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax); - - if (resultColors->hasCategoryResult()) - { - if(resultColors->resultType() != RimDefines::FORMATION_NAMES) + double localMin, localMax; + double localPosClosestToZero, localNegClosestToZero; + if ( resultColors->hasDynamicResult() ) { - resultColors->legendConfig()->setIntegerCategories(cellResultsData->uniqueCellScalarValues(resultColors->scalarResultIndex())); + cellResultsData->minMaxCellScalarValues(resultColors->scalarResultIndex(), m_currentTimeStep, localMin, localMax); + cellResultsData->posNegClosestToZero(resultColors->scalarResultIndex(), m_currentTimeStep, localPosClosestToZero, localNegClosestToZero); } else { - const std::vector& fnVector = eclipseCase()->reservoirData()->activeFormationNames()->formationNames(); - resultColors->legendConfig()->setNamedCategoriesInverse(fnVector); - } - } + localMin = globalMin; + localMax = globalMax; - m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend()); - resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariable())); + localPosClosestToZero = globalPosClosestToZero; + localNegClosestToZero = globalNegClosestToZero; + } + + CVF_ASSERT(resultColors->legendConfig()); + + resultColors->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero); + resultColors->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax); + + if ( resultColors->hasCategoryResult() ) + { + if ( resultColors->resultType() != RimDefines::FORMATION_NAMES ) + { + resultColors->legendConfig()->setIntegerCategories(cellResultsData->uniqueCellScalarValues(resultColors->scalarResultIndex())); + } + else + { + const std::vector& fnVector = eclipseCase()->reservoirData()->activeFormationNames()->formationNames(); + resultColors->legendConfig()->setNamedCategoriesInverse(fnVector); + } + } + + m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend()); + resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariable())); + } }