From 5ee764af482d9e03553531afa679bd671cb0a41f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 11 May 2023 08:37:58 +0200 Subject: [PATCH] Refactor result definition --- .../RiaCompletionTypeCalculationScheduler.cpp | 1 + .../RicfExportProperty.cpp | 2 + .../RicExportFractureCompletionsImpl.cpp | 1 + ...ellPathExportCompletionDataFeatureImpl.cpp | 1 + .../RicEclipseCellResultToFileImpl.cpp | 2 + .../RicExportEclipseSectorModelUi.cpp | 1 + .../RicShowContributingWellsFeatureImpl.cpp | 4 +- .../Commands/RicCreateEnsembleWellLogUi.cpp | 1 + .../RifEclipseInputFileTools.cpp | 1 + .../RifEclipseInputPropertyLoader.cpp | 1 + .../FileInterface/RifRoffFileTools.cpp | 1 + .../RigFemPartResultCalculatorGamma.cpp | 2 +- .../RigFemPartResultCalculatorNormalST.cpp | 2 +- .../RivIntersectionResultsColoringTools.cpp | 5 +- .../ModelVisualization/RivFaultPartMgr.cpp | 1 + .../RivReservoirFaultsPartMgr.cpp | 1 + .../RivTernaryTextureCoordsCreator.cpp | 3 + .../ProjectDataModel/CMakeLists_files.cmake | 2 + .../CellFilters/RimEclipsePropertyFilter.cpp | 1 + .../RimEclipsePropertyFilterCollection.cpp | 2 + .../Flow/RimFlowCharacteristicsPlot.cpp | 3 +- .../Flow/RimFlowDiagSolution.cpp | 8 + .../Flow/RimFlowDiagSolution.h | 7 +- .../Flow/RimFlowDiagnosticsTools.cpp | 55 +- .../Flow/RimFlowDiagnosticsTools.h | 30 +- .../Flow/RimWellPlotTools.cpp | 1 + .../CellFilters/RimPlotCellPropertyFilter.cpp | 2 + .../RimGridCrossPlotDataSet.cpp | 2 + .../RimSaturationPressurePlot.cpp | 1 + .../RimIntersectionResultDefinition.cpp | 3 + .../ProjectDataModel/RimCellEdgeColors.h | 5 +- .../RimColorLegendCollection.cpp | 17 +- .../ProjectDataModel/RimEclipseCase.cpp | 2 +- .../ProjectDataModel/RimEclipseCase.h | 2 +- .../RimEclipseContourMapProjection.cpp | 1 + .../ProjectDataModel/RimEclipseResultCase.cpp | 1 + .../RimEclipseResultDefinition.cpp | 793 ++---------------- .../RimEclipseResultDefinition.h | 20 +- .../RimEclipseResultDefinitionTools.cpp | 776 +++++++++++++++++ .../RimEclipseResultDefinitionTools.h | 62 ++ .../RimEclipseStatisticsCase.cpp | 3 + .../RimMultipleEclipseResults.cpp | 3 + ...StimPlanModelElasticPropertyCalculator.cpp | 1 + .../RimStimPlanModelLayerCalculator.cpp | 1 + .../RimStimPlanModelWellLogCalculator.cpp | 1 + .../WellLog/RimWellLogExtractionCurve.cpp | 1 + ...StimPlanCellTransmissibilityCalculator.cpp | 1 + .../RigResultAccessorFactory.cpp | 1 + .../ResultCalculators/RigAllanUtil.cpp | 2 + .../RigCaseCellResultsData.h | 3 +- .../RigEclipseAllanFaultsStatCalc.h | 1 + .../ReservoirDataModel/RigEclipseCaseData.cpp | 1 + .../RigEclipseNativeStatCalc.h | 1 + .../RigEclipseNativeVisibleCellsStatCalc.h | 1 + .../RigEclipseWellLogExtractor.cpp | 1 + .../RigFlowDiagSolverInterface.cpp | 1 + .../RigFlowDiagStatCalc.cpp | 3 + .../RigFlowDiagVisibleCellsStatCalc.cpp | 3 + ...igNumberOfFloodedPoreVolumesCalculator.cpp | 1 + .../RigResultModifierFactory.cpp | 1 + ...TofAccumulatedPhaseFractionsCalculator.cpp | 1 + .../RigTofWellDistributionCalculator.cpp | 1 + .../UserInterface/RiuPvtPlotUpdater.cpp | 2 + .../RiuRelativePermeabilityPlotUpdater.cpp | 1 + .../UserInterface/RiuResultTextBuilder.cpp | 1 + .../RiuSelectionChangedHandler.cpp | 4 +- 66 files changed, 1045 insertions(+), 822 deletions(-) create mode 100644 ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinitionTools.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinitionTools.h diff --git a/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp b/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp index 8c632941d6..2ed33b53da 100644 --- a/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp +++ b/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp @@ -19,6 +19,7 @@ #include "RiaCompletionTypeCalculationScheduler.h" #include "RiaApplication.h" +#include "RiaResultNames.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportProperty.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportProperty.cpp index 3f94c707ff..047fa8a447 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportProperty.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportProperty.cpp @@ -28,6 +28,8 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" + #include "RimEclipseCase.h" #include "RimEclipseCaseCollection.h" #include "RimEclipseCellColors.h" diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp index b6bc45c2a0..0925ac5ab4 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp @@ -24,6 +24,7 @@ #include "RiaLogging.h" #include "RiaQDateTimeTools.h" #include "RiaSummaryTools.h" +#include "RigEclipseResultAddress.h" #include "RimEclipseCase.h" #include "RimEclipseResultCase.h" diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp index 230d9c3220..c1e92d667d 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp @@ -40,6 +40,7 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigMainGrid.h" #include "RigPerforationTransmissibilityEquations.h" #include "RigResultAccessorFactory.h" diff --git a/ApplicationLibCode/Commands/ExportCommands/RicEclipseCellResultToFileImpl.cpp b/ApplicationLibCode/Commands/ExportCommands/RicEclipseCellResultToFileImpl.cpp index babb9bdb60..c04fde6ed4 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicEclipseCellResultToFileImpl.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicEclipseCellResultToFileImpl.cpp @@ -19,8 +19,10 @@ #include "RicEclipseCellResultToFileImpl.h" #include "RiaLogging.h" + #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigMainGrid.h" #include "RigResultAccessor.h" #include "RigResultAccessorFactory.h" diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp index 9a9725db27..9149c49002 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp @@ -25,6 +25,7 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigMainGrid.h" #include "RimEclipseResultDefinition.h" diff --git a/ApplicationLibCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.cpp b/ApplicationLibCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.cpp index 1268c87e29..c6c6c459bb 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.cpp @@ -110,10 +110,10 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells( Rim switch ( tracerStatus ) { case RimFlowDiagSolution::TracerStatusType::PRODUCER: - viewToModify->cellResult()->setFlowDiagTracerSelectionType( RimEclipseResultDefinition::FLOW_TR_INJECTORS ); + viewToModify->cellResult()->setFlowDiagTracerSelectionType( RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_INJECTORS ); break; case RimFlowDiagSolution::TracerStatusType::INJECTOR: - viewToModify->cellResult()->setFlowDiagTracerSelectionType( RimEclipseResultDefinition::FLOW_TR_PRODUCERS ); + viewToModify->cellResult()->setFlowDiagTracerSelectionType( RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_PRODUCERS ); break; default: diff --git a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp index ec0f9dc97b..5d2bfe2617 100644 --- a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp +++ b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp @@ -21,6 +21,7 @@ #include "RiaApplication.h" #include "RiaDefines.h" +#include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" diff --git a/ApplicationLibCode/FileInterface/RifEclipseInputFileTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseInputFileTools.cpp index 535385896f..c87d3e49d5 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseInputFileTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseInputFileTools.cpp @@ -35,6 +35,7 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigFault.h" #include "RigMainGrid.h" diff --git a/ApplicationLibCode/FileInterface/RifEclipseInputPropertyLoader.cpp b/ApplicationLibCode/FileInterface/RifEclipseInputPropertyLoader.cpp index 14c9d24441..9afa42eae3 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseInputPropertyLoader.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseInputPropertyLoader.cpp @@ -27,6 +27,7 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigMainGrid.h" #include "RimEclipseInputProperty.h" diff --git a/ApplicationLibCode/FileInterface/RifRoffFileTools.cpp b/ApplicationLibCode/FileInterface/RifRoffFileTools.cpp index 8ac6278670..e204130e56 100644 --- a/ApplicationLibCode/FileInterface/RifRoffFileTools.cpp +++ b/ApplicationLibCode/FileInterface/RifRoffFileTools.cpp @@ -24,6 +24,7 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigMainGrid.h" #include "RimColorLegendCollection.h" diff --git a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorGamma.cpp b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorGamma.cpp index 9974f6343b..21a893ce55 100644 --- a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorGamma.cpp +++ b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorGamma.cpp @@ -144,7 +144,7 @@ void RigFemPartResultCalculatorGamma::calculateGammaFromFrames( int int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx( elmNodResIdx ); float por = inf; - if ( nodeIdx < srcPORFrameData.size() ) por = srcPORFrameData[nodeIdx]; + if ( nodeIdx < static_cast( srcPORFrameData.size() ) ) por = srcPORFrameData[nodeIdx]; if ( por == inf || fabs( por ) < 0.01e6 * 1.0e-5 ) dstFrameData[elmNodResIdx] = inf; diff --git a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorNormalST.cpp b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorNormalST.cpp index a163abeb21..3a595f3269 100644 --- a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorNormalST.cpp +++ b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorNormalST.cpp @@ -108,7 +108,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorNormalST::calculate( int par const size_t elmNodResIdx = femPart->elementNodeResultIdx( elmIdx, elmNodIdx ); const int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx( elmNodResIdx ); float por = 0.0f; - if ( nodeIdx < srcPORFrameData.size() ) + if ( nodeIdx < static_cast( srcPORFrameData.size() ) ) { por = srcPORFrameData[nodeIdx]; if ( por == inf ) por = 0.0f; diff --git a/ApplicationLibCode/ModelVisualization/Intersections/RivIntersectionResultsColoringTools.cpp b/ApplicationLibCode/ModelVisualization/Intersections/RivIntersectionResultsColoringTools.cpp index 936f1bb99c..ce1323ee18 100644 --- a/ApplicationLibCode/ModelVisualization/Intersections/RivIntersectionResultsColoringTools.cpp +++ b/ApplicationLibCode/ModelVisualization/Intersections/RivIntersectionResultsColoringTools.cpp @@ -18,7 +18,8 @@ #include "RivIntersectionResultsColoringTools.h" -#include "RiuGeoMechXfTensorResultAccessor.h" +#include "RiaOffshoreSphericalCoords.h" +#include "RiaResultNames.h" #include "RimEclipseCase.h" #include "RimEclipseCellColors.h" @@ -42,7 +43,7 @@ #include "RivScalarMapperUtils.h" #include "RivTernaryTextureCoordsCreator.h" -#include "RiaOffshoreSphericalCoords.h" +#include "RiuGeoMechXfTensorResultAccessor.h" #include "cvfGeometryTools.h" #include "cvfStructGridGeometryGenerator.h" diff --git a/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.cpp index 2722c468b0..16e2ea7564 100644 --- a/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.cpp @@ -23,6 +23,7 @@ #include "RiaPreferences.h" #include "RigCaseCellResultsData.h" +#include "RigEclipseResultAddress.h" #include "RigMainGrid.h" #include "RigNNCData.h" #include "RigResultAccessor.h" diff --git a/ApplicationLibCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp index c3e9681334..7cee3adaa9 100644 --- a/ApplicationLibCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp @@ -19,6 +19,7 @@ #include "RivReservoirFaultsPartMgr.h" +#include "RigEclipseResultAddress.h" #include "RigMainGrid.h" #include "RigNNCData.h" diff --git a/ApplicationLibCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp b/ApplicationLibCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp index 67220f7fad..066e7278c7 100644 --- a/ApplicationLibCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp +++ b/ApplicationLibCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp @@ -19,8 +19,11 @@ #include "RivTernaryTextureCoordsCreator.h" +#include "RiaResultNames.h" + #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigPipeInCellEvaluator.h" #include "RigResultAccessorFactory.h" #include "RigTernaryResultAccessor.h" diff --git a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake index 66ae1d9476..c090ce9f01 100644 --- a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake @@ -130,6 +130,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseTools.h ${CMAKE_CURRENT_LIST_DIR}/RimMultipleEclipseResults.h ${CMAKE_CURRENT_LIST_DIR}/RimPressureDepthData.h + ${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultDefinitionTools.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -259,6 +260,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RimMultipleEclipseResults.cpp ${CMAKE_CURRENT_LIST_DIR}/RimPressureDepthData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultDefinitionTools.cpp ) if(RESINSIGHT_USE_QT_CHARTS) diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp index 4318838912..80207276ee 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp @@ -26,6 +26,7 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigFlowDiagResults.h" #include "RigFormationNames.h" diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp index 216594bab6..ab54b7a4cd 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp @@ -20,6 +20,8 @@ #include "RimEclipsePropertyFilterCollection.h" +#include "RiaResultNames.h" + #include "RimEclipseCellColors.h" #include "RimEclipsePropertyFilter.h" #include "RimEclipseResultDefinition.h" diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp index da4d65329c..1c98dcae9d 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp @@ -542,7 +542,8 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch { view->faultCollection()->showFaultCollection = false; view->cellResult()->setResultType( RiaDefines::ResultCatType::FLOW_DIAGNOSTICS ); - view->cellResult()->setFlowDiagTracerSelectionType( RimEclipseResultDefinition::FLOW_TR_BY_SELECTION ); + view->cellResult()->setFlowDiagTracerSelectionType( + RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_BY_SELECTION ); view->cellResult()->setSelectedTracers( m_selectedTracerNames ); if ( m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION ) diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp index 190a2794fd..b5d644517d 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp @@ -116,6 +116,14 @@ RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults() return m_flowDiagResults.p(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults() const +{ + return m_flowDiagResults.p(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.h b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.h index b6cd92c8b3..73d20c0e6f 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.h @@ -38,9 +38,10 @@ public: RimFlowDiagSolution(); ~RimFlowDiagSolution() override; - QString userDescription() const; - RigFlowDiagResults* flowDiagResults(); - std::vector tracerNames() const; + QString userDescription() const; + RigFlowDiagResults* flowDiagResults(); + const RigFlowDiagResults* flowDiagResults() const; + std::vector tracerNames() const; std::map> allInjectorTracerActiveCellIndices( size_t timeStepIndex ) const; std::map> allProducerTracerActiveCellIndices( size_t timeStepIndex ) const; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagnosticsTools.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagnosticsTools.cpp index 6b014ff6b7..b04627d4b8 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagnosticsTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagnosticsTools.cpp @@ -29,20 +29,19 @@ bool RimFlowDiagnosticsTools::TracerComp::operator()( const QString& lhs, const { return true; } - else if ( lhs.endsWith( "-XF" ) && !rhs.endsWith( "-XF" ) ) + + if ( lhs.endsWith( "-XF" ) && !rhs.endsWith( "-XF" ) ) { return false; } - else - { - return lhs < rhs; - } + + return lhs < rhs; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimFlowDiagnosticsTools::calcOptionsForSelectedTracerField( RimFlowDiagSolution* flowSol, bool isInjector ) +QList RimFlowDiagnosticsTools::calcOptionsForSelectedTracerField( FDS* flowSol, bool isInjector ) { if ( !flowSol ) return {}; @@ -50,13 +49,13 @@ QList RimFlowDiagnosticsTools::calcOptionsForSelectedTra std::set sortedTracers = setOfTracersOfType( flowSol, isInjector ); for ( const QString& tracerName : sortedTracers ) { - QString postfix; - RimFlowDiagSolution::TracerStatusType status = flowSol->tracerStatusOverall( tracerName ); - if ( status == RimFlowDiagSolution::TracerStatusType::VARYING ) + QString postfix; + FDS::TracerStatusType status = flowSol->tracerStatusOverall( tracerName ); + if ( status == FDS::TracerStatusType::VARYING ) { postfix = " [I/P]"; } - else if ( status == RimFlowDiagSolution::TracerStatusType::UNDEFINED ) + else if ( status == FDS::TracerStatusType::UNDEFINED ) { postfix = " [U]"; } @@ -68,8 +67,7 @@ QList RimFlowDiagnosticsTools::calcOptionsForSelectedTra //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::set RimFlowDiagnosticsTools::setOfTracersOfType( RimFlowDiagSolution* flowSol, - bool isInjector ) +std::set RimFlowDiagnosticsTools::setOfTracersOfType( const FDS* flowSol, bool isInjector ) { if ( !flowSol ) return {}; @@ -77,11 +75,10 @@ std::set RimFlowDiagnosticsTools:: std::vector tracerNames = flowSol->tracerNames(); for ( const QString& tracerName : tracerNames ) { - RimFlowDiagSolution::TracerStatusType status = flowSol->tracerStatusOverall( tracerName ); - bool includeTracer = status == RimFlowDiagSolution::TracerStatusType::VARYING || - status == RimFlowDiagSolution::TracerStatusType::UNDEFINED; - includeTracer |= isInjector && status == RimFlowDiagSolution::TracerStatusType::INJECTOR; - includeTracer |= !isInjector && status == RimFlowDiagSolution::TracerStatusType::PRODUCER; + FDS::TracerStatusType status = flowSol->tracerStatusOverall( tracerName ); + bool includeTracer = status == FDS::TracerStatusType::VARYING || status == FDS::TracerStatusType::UNDEFINED; + includeTracer |= isInjector && status == FDS::TracerStatusType::INJECTOR; + includeTracer |= !isInjector && status == FDS::TracerStatusType::PRODUCER; if ( includeTracer ) { @@ -94,25 +91,23 @@ std::set RimFlowDiagnosticsTools:: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimFlowDiagnosticsTools::producerTracersInTimeStep( RimFlowDiagSolution* flowSol, int timeStepIndex ) +std::vector RimFlowDiagnosticsTools::producerTracersInTimeStep( const FDS* flowSol, int timeStepIndex ) { - return tracersOfStatusInTimeStep( flowSol, RimFlowDiagSolution::TracerStatusType::PRODUCER, timeStepIndex ); + return tracersOfStatusInTimeStep( flowSol, FDS::TracerStatusType::PRODUCER, timeStepIndex ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimFlowDiagnosticsTools::injectorTracersInTimeStep( RimFlowDiagSolution* flowSol, int timeStepIndex ) +std::vector RimFlowDiagnosticsTools::injectorTracersInTimeStep( const FDS* flowSol, int timeStepIndex ) { - return tracersOfStatusInTimeStep( flowSol, RimFlowDiagSolution::TracerStatusType::INJECTOR, timeStepIndex ); + return tracersOfStatusInTimeStep( flowSol, FDS::TracerStatusType::INJECTOR, timeStepIndex ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimFlowDiagnosticsTools::tracersOfStatusInTimeStep( RimFlowDiagSolution* flowSol, - RimFlowDiagSolution::TracerStatusType status, - int timeStepIndex ) +std::vector RimFlowDiagnosticsTools::tracersOfStatusInTimeStep( const FDS* flowSol, FDS::TracerStatusType status, int timeStepIndex ) { if ( !flowSol || timeStepIndex < 0 ) return {}; @@ -131,7 +126,7 @@ std::vector RimFlowDiagnosticsTools::tracersOfStatusInTimeStep( RimFlow /// //-------------------------------------------------------------------------------------------------- std::set - RimFlowDiagnosticsTools::setOfInjectorTracersFromProducers( RimFlowDiagSolution* flowSol, + RimFlowDiagnosticsTools::setOfInjectorTracersFromProducers( FDS* flowSol, const std::vector& producerTracers, std::vector timeStepIndices ) { @@ -164,9 +159,7 @@ std::set /// //-------------------------------------------------------------------------------------------------- std::set - RimFlowDiagnosticsTools::setOfInjectorTracersFromProducers( RimFlowDiagSolution* flowSol, - const std::vector& producerTracers, - int timeStepIndex ) + RimFlowDiagnosticsTools::setOfInjectorTracersFromProducers( FDS* flowSol, const std::vector& producerTracers, int timeStepIndex ) { if ( timeStepIndex < 0 ) return {}; @@ -178,7 +171,7 @@ std::set /// //-------------------------------------------------------------------------------------------------- std::set - RimFlowDiagnosticsTools::setOfProducerTracersFromInjectors( RimFlowDiagSolution* flowSol, + RimFlowDiagnosticsTools::setOfProducerTracersFromInjectors( FDS* flowSol, const std::vector& injectorTracers, std::vector timeStepIndices ) { @@ -211,9 +204,7 @@ std::set /// //-------------------------------------------------------------------------------------------------- std::set - RimFlowDiagnosticsTools::setOfProducerTracersFromInjectors( RimFlowDiagSolution* flowSol, - const std::vector& injectorTracers, - int timeStepIndex ) + RimFlowDiagnosticsTools::setOfProducerTracersFromInjectors( FDS* flowSol, const std::vector& injectorTracers, int timeStepIndex ) { if ( timeStepIndex < 0 ) return {}; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagnosticsTools.h b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagnosticsTools.h index 3d9e80942a..75300fdf26 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagnosticsTools.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagnosticsTools.h @@ -30,32 +30,30 @@ //================================================================================================== namespace RimFlowDiagnosticsTools { -// --- Structures --- struct TracerComp { bool operator()( const QString& lhs, const QString& rhs ) const; }; -// --- Methods --- -QList calcOptionsForSelectedTracerField( RimFlowDiagSolution* flowSol, bool isInjector ); -std::set setOfTracersOfType( RimFlowDiagSolution* flowSol, bool isInjector ); +using FDS = RimFlowDiagSolution; -std::vector producerTracersInTimeStep( RimFlowDiagSolution* flowSol, int timeStepIndex ); -std::vector injectorTracersInTimeStep( RimFlowDiagSolution* flowSol, int timeStepIndex ); -std::vector tracersOfStatusInTimeStep( RimFlowDiagSolution* flowSol, RimFlowDiagSolution::TracerStatusType status, int timeStepIndex ); +QList calcOptionsForSelectedTracerField( FDS* flowSol, bool isInjector ); +std::set setOfTracersOfType( const FDS* flowSol, bool isInjector ); -std::set setOfInjectorTracersFromProducers( RimFlowDiagSolution* flowSol, - const std::vector& producerTracers, - std::vector timeStepIndices ); +std::vector producerTracersInTimeStep( const FDS* flowSol, int timeStepIndex ); +std::vector injectorTracersInTimeStep( const FDS* flowSol, int timeStepIndex ); +std::vector tracersOfStatusInTimeStep( const FDS* flowSol, FDS::TracerStatusType status, int timeStepIndex ); std::set - setOfInjectorTracersFromProducers( RimFlowDiagSolution* flowSol, const std::vector& producerTracers, int timeStepIndex ); - -std::set setOfProducerTracersFromInjectors( RimFlowDiagSolution* flowSol, - const std::vector& injectorTracers, - std::vector timeStepIndices ); + setOfInjectorTracersFromProducers( FDS* flowSol, const std::vector& producerTracers, std::vector timeStepIndices ); std::set - setOfProducerTracersFromInjectors( RimFlowDiagSolution* flowSol, const std::vector& injectorTracers, int timeStepIndex ); + setOfInjectorTracersFromProducers( FDS* flowSol, const std::vector& producerTracers, int timeStepIndex ); + +std::set + setOfProducerTracersFromInjectors( FDS* flowSol, const std::vector& injectorTracers, std::vector timeStepIndices ); + +std::set + setOfProducerTracersFromInjectors( FDS* flowSol, const std::vector& injectorTracers, int timeStepIndex ); }; // namespace RimFlowDiagnosticsTools diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp index 3b3ce4baf6..68464d5e67 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp @@ -25,6 +25,7 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigSimWellData.h" #include "RimEclipseCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellPropertyFilter.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellPropertyFilter.cpp index f0eedb92ab..7ebb04711f 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellPropertyFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellPropertyFilter.cpp @@ -21,6 +21,8 @@ #include "RiaLogging.h" #include "RigActiveCellInfo.h" +#include "RigCaseCellResultsData.h" +#include "RigEclipseResultAddress.h" #include "RigResultAccessor.h" #include "RigResultAccessorFactory.h" diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp index 20f6622c8e..ba802890a2 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp @@ -26,8 +26,10 @@ #include "RigActiveCellInfo.h" #include "RigActiveCellsResultAccessor.h" #include "RigCaseCellResultCalculator.h" +#include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseCrossPlotDataExtractor.h" +#include "RigEclipseResultAddress.h" #include "RigFormationNames.h" #include "RigMainGrid.h" diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp index fb5ed81a39..0171fa8a85 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp @@ -23,6 +23,7 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigEquil.h" #include "RimEclipseResultCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp index f8f605bc8f..7c59277c61 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp @@ -18,6 +18,9 @@ #include "RimIntersectionResultDefinition.h" +#include "RiaResultNames.h" +#include "RigCaseCellResultsData.h" + #include "Rim2dIntersectionView.h" #include "RimCase.h" #include "RimEclipseCase.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.h b/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.h index a8e517c680..bad77c7421 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.h +++ b/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.h @@ -20,6 +20,9 @@ #pragma once +#include "RigCaseCellResultsData.h" +#include "RigEclipseResultAddress.h" + #include "cafAppEnum.h" #include "cafPdmChildField.h" #include "cafPdmField.h" @@ -27,8 +30,6 @@ #include -#include "RigCaseCellResultsData.h" - class RigCaseCellResultsData; class RimEclipseCase; class RimEclipseCellColors; diff --git a/ApplicationLibCode/ProjectDataModel/RimColorLegendCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimColorLegendCollection.cpp index b2ff5167cf..c4e283ab84 100644 --- a/ApplicationLibCode/ProjectDataModel/RimColorLegendCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimColorLegendCollection.cpp @@ -64,7 +64,7 @@ void RimColorLegendCollection::appendCustomColorLegend( RimColorLegend* colorLeg //-------------------------------------------------------------------------------------------------- bool RimColorLegendCollection::isStandardColorLegend( RimColorLegend* legend ) { - for ( auto standardLegend : m_standardColorLegends ) + for ( const auto& standardLegend : m_standardColorLegends ) { if ( legend == standardLegend ) return true; } @@ -135,7 +135,7 @@ void RimColorLegendCollection::setDefaultColorLegendForResult( int caseId, const //-------------------------------------------------------------------------------------------------- void RimColorLegendCollection::createStandardColorLegends() { - typedef caf::AppEnum ColorRangeEnum; + using ColorRangeEnum = caf::AppEnum; for ( size_t typeIdx = 0; typeIdx < ColorRangeEnum::size(); typeIdx++ ) { @@ -158,14 +158,17 @@ void RimColorLegendCollection::createStandardColorLegends() } } - RimColorLegend* colorLegend = new RimColorLegend; + auto* colorLegend = new RimColorLegend; colorLegend->setColorLegendName( legendName ); for ( size_t i = 0; i < colorArray.size(); i++ ) { cvf::Color3f color3f( colorArray[i] ); - RimColorLegendItem* colorLegendItem = new RimColorLegendItem; + auto* colorLegendItem = new RimColorLegendItem; + + // Set empty text for color legend items + // The text defined is used in RimEclipseResultDefinitionTools::updateCellResultLegend() colorLegendItem->setValues( "", static_cast( i ), color3f ); colorLegend->appendColorLegendItem( colorLegendItem ); @@ -241,7 +244,7 @@ RimColorLegend* RimColorLegendCollection::findDefaultLegendForResult( int caseId //-------------------------------------------------------------------------------------------------- RimColorLegendItem* RimColorLegendCollection::createColorLegendItem( const QString& name, int r, int g, int b ) const { - RimColorLegendItem* item = new RimColorLegendItem; + auto* item = new RimColorLegendItem; item->setValues( name, 0, cvf::Color3f::fromByteColor( r, g, b ) ); return item; } @@ -251,7 +254,7 @@ RimColorLegendItem* RimColorLegendCollection::createColorLegendItem( const QStri //-------------------------------------------------------------------------------------------------- RimColorLegend* RimColorLegendCollection::createRockTypeColorLegend() const { - RimColorLegend* colorLegend = new RimColorLegend; + auto* colorLegend = new RimColorLegend; colorLegend->setColorLegendName( RiaDefines::rockTypeColorLegendName() ); // Rock types colors taken from "Equinor GeoStandard - May 2020" document. @@ -325,7 +328,7 @@ QString RimColorLegendCollection::createLookupKey( int caseId, const QString& re //-------------------------------------------------------------------------------------------------- void RimColorLegendCollection::initAfterRead() { - for ( auto legend : m_customColorLegends ) + for ( const auto& legend : m_customColorLegends ) { legend->addReorderCapability(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp index 64f960bfba..a9b2f14238 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp @@ -680,7 +680,7 @@ RimEclipseContourMapViewCollection* RimEclipseCase::contourMapCollection() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimEclipseInputPropertyCollection* RimEclipseCase::inputPropertyCollection() +RimEclipseInputPropertyCollection* RimEclipseCase::inputPropertyCollection() const { return m_inputPropertyCollection(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.h b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.h index bde445c597..e0ed0596be 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.h @@ -100,7 +100,7 @@ public: RimCaseCollection* parentCaseCollection(); RimEclipseContourMapViewCollection* contourMapCollection(); - RimEclipseInputPropertyCollection* inputPropertyCollection(); + RimEclipseInputPropertyCollection* inputPropertyCollection() const; QStringList timeStepStrings() const override; QString timeStepName( int frameIdx ) const override; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp index a8adac3cf9..0c6fffdfb7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp @@ -27,6 +27,7 @@ #include "RigCell.h" #include "RigCellGeometryTools.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigHexIntersectionTools.h" #include "RigMainGrid.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp index 5ee7fd0af5..3fa3cad1c4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -25,6 +25,7 @@ #include "RiaLogging.h" #include "RiaPreferences.h" #include "RiaRegressionTestRunner.h" +#include "RiaResultNames.h" #include "RicfCommandObject.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 99e2986321..9b03d17797 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -20,39 +20,31 @@ #include "RimEclipseResultDefinition.h" -#include "RiaColorTables.h" -#include "RiaColorTools.h" #include "RiaLogging.h" -#include "RiaNncDefines.h" #include "RiaQDateTimeTools.h" #include "RicfCommandObject.h" #include "RigActiveCellInfo.h" -#include "RigAllanDiagramData.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultInfo.h" #include "RigFlowDiagResultAddress.h" #include "RigFlowDiagResults.h" #include "RigFormationNames.h" -#include "RigVisibleCategoriesCalculator.h" #include "Rim3dView.h" #include "Rim3dWellLogCurve.h" #include "RimCellEdgeColors.h" -#include "RimColorLegend.h" -#include "RimColorLegendItem.h" #include "RimContourMapProjection.h" #include "RimEclipseCase.h" #include "RimEclipseCellColors.h" #include "RimEclipseContourMapProjection.h" #include "RimEclipseContourMapView.h" #include "RimEclipseFaultColors.h" -#include "RimEclipseInputProperty.h" -#include "RimEclipseInputPropertyCollection.h" #include "RimEclipsePropertyFilter.h" #include "RimEclipseResultCase.h" +#include "RimEclipseResultDefinitionTools.h" #include "RimEclipseView.h" #include "RimFlowDiagSolution.h" #include "RimFlowDiagnosticsTools.h" @@ -65,9 +57,6 @@ #include "RimProject.h" #include "RimRegularLegendConfig.h" #include "RimReservoirCellResultsStorage.h" -#include "RimSimWellInView.h" -#include "RimSimWellInViewCollection.h" -#include "RimTernaryLegendConfig.h" #include "RimViewLinker.h" #include "RimWellLogExtractionCurve.h" #include "RimWellLogTrack.h" @@ -76,7 +65,6 @@ #include "RimGridStatisticsPlot.h" #endif -#include "cafCategoryMapper.h" #include "cafPdmFieldScriptingCapability.h" #include "cafPdmUiListEditor.h" #include "cafPdmUiToolButtonEditor.h" @@ -90,12 +78,12 @@ namespace caf template <> void RimEclipseResultDefinition::FlowTracerSelectionEnum::setUp() { - addItem( RimEclipseResultDefinition::FLOW_TR_INJ_AND_PROD, "FLOW_TR_INJ_AND_PROD", "All Injectors and Producers" ); - addItem( RimEclipseResultDefinition::FLOW_TR_PRODUCERS, "FLOW_TR_PRODUCERS", "All Producers" ); - addItem( RimEclipseResultDefinition::FLOW_TR_INJECTORS, "FLOW_TR_INJECTORS", "All Injectors" ); - addItem( RimEclipseResultDefinition::FLOW_TR_BY_SELECTION, "FLOW_TR_BY_SELECTION", "By Selection" ); + addItem( RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_INJ_AND_PROD, "FLOW_TR_INJ_AND_PROD", "All Injectors and Producers" ); + addItem( RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_PRODUCERS, "FLOW_TR_PRODUCERS", "All Producers" ); + addItem( RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_INJECTORS, "FLOW_TR_INJECTORS", "All Injectors" ); + addItem( RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_BY_SELECTION, "FLOW_TR_BY_SELECTION", "By Selection" ); - setDefault( RimEclipseResultDefinition::FLOW_TR_INJ_AND_PROD ); + setDefault( RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_INJ_AND_PROD ); } } // namespace caf @@ -265,7 +253,8 @@ void RimEclipseResultDefinition::fieldChangedByUi( const caf::PdmFieldHandle* ch // If the user are seeing the list with the actually selected result, // select that result in the list. Otherwise select nothing. - QStringList varList = getResultNamesForResultType( m_resultTypeUiField(), this->currentGridCellResults() ); + QStringList varList = + RimEclipseResultDefinitionTools::getResultNamesForResultType( m_resultTypeUiField(), this->currentGridCellResults() ); bool isFlowDiagFieldsRelevant = ( m_resultType() == RiaDefines::ResultCatType::FLOW_DIAGNOSTICS ); @@ -314,7 +303,7 @@ void RimEclipseResultDefinition::fieldChangedByUi( const caf::PdmFieldHandle* ch } else if ( m_resultTypeUiField() == RiaDefines::ResultCatType::INPUT_PROPERTY ) { - m_inputPropertyFileName = getInputPropertyFileName( newValue.toString() ); + m_inputPropertyFileName = RimEclipseResultDefinitionTools::getInputPropertyFileName( eclipseCase(), newValue.toString() ); } loadDataAndUpdate(); } @@ -520,7 +509,7 @@ void RimEclipseResultDefinition::setTofAndSelectTracer( const QString& tracerNam { setResultType( RiaDefines::ResultCatType::FLOW_DIAGNOSTICS ); setResultVariable( "TOF" ); - setFlowDiagTracerSelectionType( FLOW_TR_BY_SELECTION ); + setFlowDiagTracerSelectionType( FlowTracerSelectionType::FLOW_TR_BY_SELECTION ); if ( m_flowSolution() == nullptr ) { @@ -733,11 +722,17 @@ QList RimEclipseResultDefinition::calculateValueOptions( { if ( fieldNeedingOptions == &m_resultVariableUiField ) { - options.push_back( caf::PdmOptionItemInfo( timeOfFlightString( false ), RIG_FLD_TOF_RESNAME ) ); + options.push_back( caf::PdmOptionItemInfo( RimEclipseResultDefinitionTools::timeOfFlightString( injectorSelectionState(), + producerSelectionState(), + false ), + RIG_FLD_TOF_RESNAME ) ); if ( m_phaseSelection() == RigFlowDiagResultAddress::PHASE_ALL ) { options.push_back( caf::PdmOptionItemInfo( "Tracer Cell Fraction (Sum)", RIG_FLD_CELL_FRACTION_RESNAME ) ); - options.push_back( caf::PdmOptionItemInfo( maxFractionTracerString( false ), RIG_FLD_MAX_FRACTION_TRACER_RESNAME ) ); + options.push_back( caf::PdmOptionItemInfo( RimEclipseResultDefinitionTools::maxFractionTracerString( injectorSelectionState(), + producerSelectionState(), + false ), + RIG_FLD_MAX_FRACTION_TRACER_RESNAME ) ); options.push_back( caf::PdmOptionItemInfo( "Injector Producer Communication", RIG_FLD_COMMUNICATION_RESNAME ) ); } } @@ -949,7 +944,7 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const CVF_ASSERT( timeHistoryCurve == nullptr ); std::set selTracerNames; - if ( m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION ) + if ( m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_BY_SELECTION ) { for ( const QString& tName : m_selectedInjectorTracers() ) { @@ -967,7 +962,8 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const { std::vector tracerNames = flowSol->tracerNames(); - if ( m_flowTracerSelectionMode == FLOW_TR_INJECTORS || m_flowTracerSelectionMode == FLOW_TR_INJ_AND_PROD ) + if ( m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_INJECTORS || + m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_INJ_AND_PROD ) { for ( const QString& tracerName : tracerNames ) { @@ -979,7 +975,8 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const } } - if ( m_flowTracerSelectionMode == FLOW_TR_PRODUCERS || m_flowTracerSelectionMode == FLOW_TR_INJ_AND_PROD ) + if ( m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_PRODUCERS || + m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_INJ_AND_PROD ) { for ( const QString& tracerName : tracerNames ) { @@ -1535,7 +1532,7 @@ void RimEclipseResultDefinition::defineUiOrdering( QString uiConfigName, caf::Pd uiOrdering.add( &m_flowTracerSelectionMode ); - if ( m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION ) + if ( m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_BY_SELECTION ) { caf::PdmUiGroup* selectionGroup = uiOrdering.addNewGroup( "Tracer Selection" ); selectionGroup->setEnableFrame( false ); @@ -1696,24 +1693,21 @@ QString RimEclipseResultDefinition::flowDiagResUiText( bool shortLabel, int maxT QString uiText = QString::fromStdString( flowDiagResAddress().variableName ); if ( flowDiagResAddress().variableName == RIG_FLD_TOF_RESNAME ) { - uiText = timeOfFlightString( shortLabel ); + uiText = RimEclipseResultDefinitionTools::timeOfFlightString( injectorSelectionState(), producerSelectionState(), shortLabel ); } else if ( flowDiagResAddress().variableName == RIG_FLD_MAX_FRACTION_TRACER_RESNAME ) { - uiText = maxFractionTracerString( shortLabel ); + uiText = RimEclipseResultDefinitionTools::maxFractionTracerString( injectorSelectionState(), producerSelectionState(), shortLabel ); } - QString tracersString = selectedTracersString(); + QString tracersString = RimEclipseResultDefinitionTools::selectedTracersString( injectorSelectionState(), + producerSelectionState(), + m_selectedInjectorTracers(), + m_selectedProducerTracers(), + maxTracerStringLength ); if ( !tracersString.isEmpty() ) { - const QString postfix = "..."; - - if ( tracersString.size() > maxTracerStringLength + postfix.size() ) - { - tracersString = tracersString.left( maxTracerStringLength ); - tracersString += postfix; - } uiText += QString( "\n%1" ).arg( tracersString ); } return uiText; @@ -1730,78 +1724,11 @@ QList RimEclipseResultDefinition::calcOptionsForVariable { CVF_ASSERT( resultCatType != RiaDefines::ResultCatType::FLOW_DIAGNOSTICS && resultCatType != RiaDefines::ResultCatType::INJECTION_FLOODING ); - if ( results ) - { - QList optionList; - - QStringList cellCenterResultNames; - QStringList cellFaceResultNames; - - for ( const QString& s : getResultNamesForResultType( resultCatType, results ) ) - { - if ( s == RiaResultNames::completionTypeResultName() ) - { - if ( results->timeStepDates().empty() ) continue; - } - - if ( RiaResultNames::isPerCellFaceResult( s ) ) - { - cellFaceResultNames.push_back( s ); - } - else - { - cellCenterResultNames.push_back( s ); - } - } - - cellCenterResultNames.sort(); - cellFaceResultNames.sort(); - - // Cell Center result names - for ( const QString& s : cellCenterResultNames ) - { - optionList.push_back( caf::PdmOptionItemInfo( s, s ) ); - } - - if ( addPerCellFaceOptionItems ) - { - for ( const QString& s : cellFaceResultNames ) - { - if ( showDerivedResultsFirst ) - { - optionList.push_front( caf::PdmOptionItemInfo( s, s ) ); - } - else - { - optionList.push_back( caf::PdmOptionItemInfo( s, s ) ); - } - } - - // Ternary Result - if ( ternaryEnabled ) - { - bool hasAtLeastOneTernaryComponent = false; - if ( cellCenterResultNames.contains( RiaResultNames::soil() ) ) - hasAtLeastOneTernaryComponent = true; - else if ( cellCenterResultNames.contains( RiaResultNames::sgas() ) ) - hasAtLeastOneTernaryComponent = true; - else if ( cellCenterResultNames.contains( RiaResultNames::swat() ) ) - hasAtLeastOneTernaryComponent = true; - - if ( resultCatType == RiaDefines::ResultCatType::DYNAMIC_NATIVE && hasAtLeastOneTernaryComponent ) - { - optionList.push_front( caf::PdmOptionItemInfo( RiaResultNames::ternarySaturationResultName(), - RiaResultNames::ternarySaturationResultName() ) ); - } - } - } - - optionList.push_front( caf::PdmOptionItemInfo( RiaResultNames::undefinedResultName(), RiaResultNames::undefinedResultName() ) ); - - return optionList; - } - - return QList(); + return RimEclipseResultDefinitionTools::calcOptionsForVariableUiFieldStandard( resultCatType, + results, + showDerivedResultsFirst, + addPerCellFaceOptionItems, + ternaryEnabled ); } //-------------------------------------------------------------------------------------------------- @@ -1812,35 +1739,6 @@ void RimEclipseResultDefinition::setTernaryEnabled( bool enabled ) m_ternaryEnabled = enabled; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool operator<( const cvf::Color3ub first, const cvf::Color3ub second ) -{ - if ( first.r() != second.r() ) return first.r() < second.r(); - if ( first.g() != second.g() ) return first.g() < second.g(); - if ( first.b() != second.b() ) return first.b() < second.b(); - - return false; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -class TupleCompare -{ -public: - bool operator()( const std::tuple& t1, const std::tuple& t2 ) const - { - using namespace std; - if ( get<0>( t1 ) != get<0>( t2 ) ) return get<0>( t1 ) < get<0>( t2 ); - if ( get<1>( t1 ) != get<1>( t2 ) ) return get<1>( t1 ) < get<1>( t2 ); - if ( get<2>( t1 ) != get<2>( t2 ) ) return get<2>( t1 ) < get<2>( t2 ); - - return false; - } -}; - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1849,386 +1747,24 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen int currentTimeStep ) { - RimEclipseCase* rimEclipseCase = this->eclipseCase(); - if ( this->hasResult() ) { if ( this->isFlowDiagOrInjectionFlooding() ) { - CVF_ASSERT( currentTimeStep >= 0 ); - - double globalMin, globalMax; - double globalPosClosestToZero, globalNegClosestToZero; - RigFlowDiagResults* flowResultsData = this->flowDiagSolution()->flowDiagResults(); - RigFlowDiagResultAddress resAddr = this->flowDiagResAddress(); - - flowResultsData->minMaxScalarValues( resAddr, currentTimeStep, &globalMin, &globalMax ); - flowResultsData->posNegClosestToZero( resAddr, currentTimeStep, &globalPosClosestToZero, &globalNegClosestToZero ); - - double localMin, localMax; - double localPosClosestToZero, localNegClosestToZero; - if ( this->hasDynamicResult() ) + if ( currentTimeStep >= 0 ) { - flowResultsData->minMaxScalarValues( resAddr, currentTimeStep, &localMin, &localMax ); - flowResultsData->posNegClosestToZero( resAddr, currentTimeStep, &localPosClosestToZero, &localNegClosestToZero ); - } - else - { - localMin = globalMin; - localMax = globalMax; - - localPosClosestToZero = globalPosClosestToZero; - localNegClosestToZero = globalNegClosestToZero; - } - - CVF_ASSERT( legendConfigToUpdate ); - - legendConfigToUpdate->disableAllTimeStepsRange( true ); - legendConfigToUpdate->setClosestToZeroValues( globalPosClosestToZero, - globalNegClosestToZero, - localPosClosestToZero, - localNegClosestToZero ); - legendConfigToUpdate->setAutomaticRanges( globalMin, globalMax, localMin, localMax ); - - if ( this->hasCategoryResult() ) - { - RimEclipseView* eclView = nullptr; - this->firstAncestorOrThisOfType( eclView ); - - if ( eclView ) - { - std::set, TupleCompare> categories; - - std::vector tracerNames = this->flowDiagSolution()->tracerNames(); - int tracerIndex = 0; - - for ( const auto& tracerName : tracerNames ) - { - cvf::Color3ub color( cvf::Color3::GRAY ); - - RimSimWellInView* well = - eclView->wellCollection()->findWell( RimFlowDiagSolution::removeCrossFlowEnding( tracerName ) ); - - if ( well ) color = cvf::Color3ub( well->wellPipeColor() ); - - categories.insert( std::make_tuple( tracerName, tracerIndex, color ) ); - ++tracerIndex; - } - - std::vector> categoryVector; - - if ( m_showOnlyVisibleCategoriesInLegend ) - { - std::set visibleTracers = - RigVisibleCategoriesCalculator::visibleFlowDiagCategories( *eclView, *flowResultsData, resAddr, currentTimeStep ); - for ( auto tupIt : categories ) - { - int tracerIndex = std::get<1>( tupIt ); - if ( visibleTracers.count( tracerIndex ) ) categoryVector.push_back( tupIt ); - } - } - else - { - for ( auto tupIt : categories ) - { - categoryVector.push_back( tupIt ); - } - } - - legendConfigToUpdate->setCategoryItems( categoryVector ); - } + RimEclipseResultDefinitionTools::updateLegendForFlowDiagnostics( this, legendConfigToUpdate, currentTimeStep ); } } else { - if ( !rimEclipseCase ) return; - - RigEclipseCaseData* eclipseCaseData = rimEclipseCase->eclipseCaseData(); - if ( !eclipseCaseData ) return; - - RigCaseCellResultsData* cellResultsData = eclipseCaseData->results( this->porosityModel() ); - cellResultsData->ensureKnownResultLoaded( this->eclipseResultAddress() ); - - double globalMin, globalMax; - double globalPosClosestToZero, globalNegClosestToZero; - - cellResultsData->minMaxCellScalarValues( this->eclipseResultAddress(), globalMin, globalMax ); - cellResultsData->posNegClosestToZero( this->eclipseResultAddress(), globalPosClosestToZero, globalNegClosestToZero ); - - double localMin, localMax; - double localPosClosestToZero, localNegClosestToZero; - if ( this->hasDynamicResult() && currentTimeStep >= 0 ) - { - cellResultsData->minMaxCellScalarValues( this->eclipseResultAddress(), currentTimeStep, localMin, localMax ); - cellResultsData->posNegClosestToZero( this->eclipseResultAddress(), currentTimeStep, localPosClosestToZero, localNegClosestToZero ); - } - else - { - localMin = globalMin; - localMax = globalMax; - - localPosClosestToZero = globalPosClosestToZero; - localNegClosestToZero = globalNegClosestToZero; - } - - CVF_ASSERT( legendConfigToUpdate ); - - legendConfigToUpdate->disableAllTimeStepsRange( false ); - legendConfigToUpdate->setClosestToZeroValues( globalPosClosestToZero, - globalNegClosestToZero, - localPosClosestToZero, - localNegClosestToZero ); - legendConfigToUpdate->setAutomaticRanges( globalMin, globalMax, localMin, localMax ); - - if ( this->hasCategoryResult() ) - { - if ( this->resultType() == RiaDefines::ResultCatType::ALLAN_DIAGRAMS ) - { - if ( this->resultVariable() == RiaResultNames::formationAllanResultName() ) - { - const std::vector fnVector = eclipseCaseData->formationNames(); - std::vector fnameIdxes; - for ( int i = 0; i < static_cast( fnVector.size() ); i++ ) - { - fnameIdxes.push_back( i ); - } - - cvf::Color3ubArray legendBaseColors = legendConfigToUpdate->colorLegend()->colorArray(); - - cvf::ref formationColorMapper = new caf::CategoryMapper; - formationColorMapper->setCategories( fnameIdxes ); - formationColorMapper->setInterpolateColors( legendBaseColors ); - - const std::map, int>& formationCombToCategory = - eclipseCaseData->allanDiagramData()->formationCombinationToCategory(); - - std::vector> categories; - for ( int frmNameIdx : fnameIdxes ) - { - cvf::Color3ub formationColor = formationColorMapper->mapToColor( frmNameIdx ); - categories.emplace_back( std::make_tuple( fnVector[frmNameIdx], frmNameIdx, formationColor ) ); - } - - std::set visibleAllanCategories; - { - RimEclipseView* eclView = nullptr; - this->firstAncestorOrThisOfType( eclView ); - - visibleAllanCategories = RigVisibleCategoriesCalculator::visibleAllanCategories( eclView ); - } - - for ( auto [formationPair, categoryIndex] : formationCombToCategory ) - { - int frmIdx1 = formationPair.first; - int frmIdx2 = formationPair.second; - - if ( visibleAllanCategories.count( categoryIndex ) == 0 ) continue; - - int fnVectorSize = static_cast( fnVector.size() ); - if ( frmIdx1 >= fnVectorSize || frmIdx2 >= fnVectorSize ) continue; - - QString frmName1 = fnVector[frmIdx1]; - QString frmName2 = fnVector[frmIdx2]; - - cvf::Color3f formationColor1 = cvf::Color3f( formationColorMapper->mapToColor( frmIdx1 ) ); - cvf::Color3f formationColor2 = cvf::Color3f( formationColorMapper->mapToColor( frmIdx2 ) ); - - cvf::Color3ub blendColor = cvf::Color3ub( RiaColorTools::blendCvfColors( formationColor1, formationColor2 ) ); - - categories.emplace_back( std::make_tuple( frmName1 + "-" + frmName2, categoryIndex, blendColor ) ); - } - - legendConfigToUpdate->setCategoryItems( categories ); - } - else if ( this->resultVariable() == RiaResultNames::formationBinaryAllanResultName() ) - { - std::vector> categories; - categories.emplace_back( std::make_tuple( "Same formation", 0, cvf::Color3ub::BROWN ) ); - categories.emplace_back( std::make_tuple( "Different formation", 1, cvf::Color3ub::ORANGE ) ); - - legendConfigToUpdate->setCategoryItems( categories ); - } - } - else if ( this->resultType() == RiaDefines::ResultCatType::DYNAMIC_NATIVE && - this->resultVariable() == RiaResultNames::completionTypeResultName() ) - { - const std::vector& visibleCategories = cellResultsData->uniqueCellScalarValues( this->eclipseResultAddress() ); - - std::vector supportedCompletionTypes = { RiaDefines::WellPathComponentType::WELL_PATH, - RiaDefines::WellPathComponentType::FISHBONES, - RiaDefines::WellPathComponentType::PERFORATION_INTERVAL, - RiaDefines::WellPathComponentType::FRACTURE }; - - RiaColorTables::WellPathComponentColors colors = RiaColorTables::wellPathComponentColors(); - - std::vector> categories; - for ( auto completionType : supportedCompletionTypes ) - { - if ( std::find( visibleCategories.begin(), visibleCategories.end(), static_cast( completionType ) ) != - visibleCategories.end() ) - { - QString categoryText = caf::AppEnum::uiText( completionType ); - categories.push_back( std::make_tuple( categoryText, static_cast( completionType ), colors[completionType] ) ); - } - } - - legendConfigToUpdate->setCategoryItems( categories ); - } - else - { - auto uniqueValues = cellResultsData->uniqueCellScalarValues( this->eclipseResultAddress() ); - if ( this->eclipseResultAddress().resultCatType() == RiaDefines::ResultCatType::FORMATION_NAMES ) - { - std::vector fnVector = eclipseCaseData->formationNames(); - uniqueValues.resize( fnVector.size() ); - std::iota( uniqueValues.begin(), uniqueValues.end(), 0 ); - } - - cvf::Color3ubArray legendBaseColors = legendConfigToUpdate->colorLegend()->colorArray(); - - cvf::ref categoryMapper = new caf::CategoryMapper; - categoryMapper->setCategories( uniqueValues ); - categoryMapper->setInterpolateColors( legendBaseColors ); - - std::vector visibleCategoryValues = uniqueValues; - - if ( m_showOnlyVisibleCategoriesInLegend ) - { - RimEclipseView* eclView = nullptr; - this->firstAncestorOrThisOfType( eclView ); - if ( eclView && eclView->showWindow() ) - { - // Check if current result is cell result, and update the visible set of values - // TODO: Can be extended to the separate geometry results (separate fault result, separate - // intersection results), but this requires some refactoring - if ( eclView->cellResult() == this ) - { - std::set visibleCategorySet = RigVisibleCategoriesCalculator::visibleCategories( eclView ); - - visibleCategoryValues.clear(); - visibleCategoryValues.insert( visibleCategoryValues.begin(), - visibleCategorySet.begin(), - visibleCategorySet.end() ); - } - } - } - std::vector> categoryVector; - - for ( auto value : visibleCategoryValues ) - { - cvf::Color3ub categoryColor = categoryMapper->mapToColor( value ); - - QString valueTxt; - if ( this->resultType() == RiaDefines::ResultCatType::FORMATION_NAMES ) - { - std::vector fnVector = eclipseCaseData->formationNames(); - - if ( value < static_cast( fnVector.size() ) ) - { - valueTxt = fnVector[value]; - } - } - else - { - auto items = legendConfigToUpdate->colorLegend()->colorLegendItems(); - auto it = std::find_if( items.begin(), - items.end(), - [value]( const RimColorLegendItem* const item ) - { return item->categoryValue() == value; } ); - if ( it != items.end() && !( *it )->categoryName().isEmpty() ) - { - valueTxt = QString( "%1 (%2)" ).arg( ( *it )->categoryName() ).arg( value ); - } - else - { - valueTxt = QString( "%1" ).arg( value ); - } - } - - categoryVector.push_back( std::make_tuple( valueTxt, value, categoryColor ) ); - } - legendConfigToUpdate->setCategoryItems( categoryVector ); - } - } + RimEclipseResultDefinitionTools::updateCellResultLegend( this, legendConfigToUpdate, currentTimeStep ); } } - // Ternary legend update + if ( isTernarySaturationSelected() ) { - if ( !rimEclipseCase ) return; - - RigEclipseCaseData* eclipseCase = rimEclipseCase->eclipseCaseData(); - if ( !eclipseCase ) return; - - RigCaseCellResultsData* cellResultsData = eclipseCase->results( this->porosityModel() ); - - size_t maxTimeStepCount = cellResultsData->maxTimeStepCount(); - if ( this->isTernarySaturationSelected() && maxTimeStepCount > 1 ) - { - RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); - { - RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ); - - if ( gridCellResults->ensureKnownResultLoaded( resAddr ) ) - { - double globalMin = 0.0; - double globalMax = 1.0; - double localMin = 0.0; - double localMax = 1.0; - - cellResultsData->minMaxCellScalarValues( resAddr, globalMin, globalMax ); - cellResultsData->minMaxCellScalarValues( resAddr, currentTimeStep, localMin, localMax ); - - ternaryLegendConfigToUpdate->setAutomaticRanges( RimTernaryLegendConfig::TERNARY_SOIL_IDX, - globalMin, - globalMax, - localMin, - localMax ); - } - } - - { - RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ); - - if ( gridCellResults->ensureKnownResultLoaded( resAddr ) ) - { - double globalMin = 0.0; - double globalMax = 1.0; - double localMin = 0.0; - double localMax = 1.0; - - cellResultsData->minMaxCellScalarValues( resAddr, globalMin, globalMax ); - cellResultsData->minMaxCellScalarValues( resAddr, currentTimeStep, localMin, localMax ); - - ternaryLegendConfigToUpdate->setAutomaticRanges( RimTernaryLegendConfig::TERNARY_SGAS_IDX, - globalMin, - globalMax, - localMin, - localMax ); - } - } - - { - RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::swat() ); - - if ( gridCellResults->ensureKnownResultLoaded( resAddr ) ) - { - double globalMin = 0.0; - double globalMax = 1.0; - double localMin = 0.0; - double localMax = 1.0; - - cellResultsData->minMaxCellScalarValues( resAddr, globalMin, globalMax ); - cellResultsData->minMaxCellScalarValues( resAddr, currentTimeStep, localMin, localMax ); - - ternaryLegendConfigToUpdate->setAutomaticRanges( RimTernaryLegendConfig::TERNARY_SWAT_IDX, - globalMin, - globalMax, - localMin, - localMax ); - } - } - } + RimEclipseResultDefinitionTools::updateTernaryLegend( currentGridCellResults(), ternaryLegendConfigToUpdate, currentTimeStep ); } } @@ -2256,146 +1792,9 @@ void RimEclipseResultDefinition::updateLegendTitle( RimRegularLegendConfig* lege //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimEclipseResultDefinition::timeOfFlightString( bool shorter ) const +bool RimEclipseResultDefinition::showOnlyVisibleCategoriesInLegend() const { - QString tofString; - bool multipleSelected = false; - if ( injectorSelectionState() != NONE_SELECTED && producerSelectionState() != NONE_SELECTED ) - { - tofString = shorter ? "Res.Time" : "Residence Time"; - multipleSelected = true; - } - else if ( injectorSelectionState() != NONE_SELECTED ) - { - tofString = shorter ? "Fwd.TOF" : "Forward Time of Flight"; - } - else if ( producerSelectionState() != NONE_SELECTED ) - { - tofString = shorter ? "Rev.TOF" : "Reverse Time of Flight"; - } - else - { - tofString = shorter ? "TOF" : "Time of Flight"; - } - - multipleSelected = multipleSelected || injectorSelectionState() >= MULTIPLE_SELECTED || producerSelectionState() >= MULTIPLE_SELECTED; - - if ( multipleSelected && !shorter ) - { - tofString += " (Average)"; - } - - tofString += " [days]"; - // Conversion from seconds in flow module to days is done in RigFlowDiagTimeStepResult::setTracerTOF() - - return tofString; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimEclipseResultDefinition::maxFractionTracerString( bool shorter ) const -{ - QString mfString; - if ( injectorSelectionState() >= ONE_SELECTED && producerSelectionState() == NONE_SELECTED ) - { - mfString = shorter ? "FloodReg" : "Flooding Region"; - if ( injectorSelectionState() >= MULTIPLE_SELECTED ) mfString += "s"; - } - else if ( injectorSelectionState() == NONE_SELECTED && producerSelectionState() >= ONE_SELECTED ) - { - mfString = shorter ? "DrainReg" : "Drainage Region"; - if ( producerSelectionState() >= MULTIPLE_SELECTED ) mfString += "s"; - } - else - { - mfString = shorter ? "Drain&FloodReg" : "Drainage/Flooding Regions"; - } - return mfString; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimEclipseResultDefinition::selectedTracersString() const -{ - QStringList fullTracersList; - - FlowTracerSelectionState injectorState = injectorSelectionState(); - FlowTracerSelectionState producerState = producerSelectionState(); - - if ( injectorState == ALL_SELECTED && producerState == ALL_SELECTED ) - { - fullTracersList += caf::AppEnum::uiText( FLOW_TR_INJ_AND_PROD ); - } - else - { - if ( injectorState == ALL_SELECTED ) - { - fullTracersList += caf::AppEnum::uiText( FLOW_TR_INJECTORS ); - } - - if ( producerState == ALL_SELECTED ) - { - fullTracersList += caf::AppEnum::uiText( FLOW_TR_PRODUCERS ); - } - - if ( injectorSelectionState() == ONE_SELECTED || injectorSelectionState() == MULTIPLE_SELECTED ) - { - QStringList listOfSelectedInjectors; - for ( const QString& injector : m_selectedInjectorTracers() ) - { - listOfSelectedInjectors.push_back( injector ); - } - if ( !listOfSelectedInjectors.empty() ) - { - fullTracersList += listOfSelectedInjectors.join( ", " ); - } - } - - if ( producerSelectionState() == ONE_SELECTED || producerSelectionState() == MULTIPLE_SELECTED ) - { - QStringList listOfSelectedProducers; - for ( const QString& producer : m_selectedProducerTracers() ) - { - listOfSelectedProducers.push_back( producer ); - } - if ( !listOfSelectedProducers.empty() ) - { - fullTracersList.push_back( listOfSelectedProducers.join( ", " ) ); - } - } - } - - QString tracersText; - if ( !fullTracersList.empty() ) - { - tracersText = fullTracersList.join( ", " ); - } - return tracersText; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QStringList RimEclipseResultDefinition::getResultNamesForResultType( RiaDefines::ResultCatType resultCatType, - const RigCaseCellResultsData* results ) -{ - if ( resultCatType != RiaDefines::ResultCatType::FLOW_DIAGNOSTICS ) - { - if ( !results ) return QStringList(); - - return results->resultNames( resultCatType ); - } - else - { - QStringList flowVars; - flowVars.push_back( RIG_FLD_TOF_RESNAME ); - flowVars.push_back( RIG_FLD_CELL_FRACTION_RESNAME ); - flowVars.push_back( RIG_FLD_MAX_FRACTION_TRACER_RESNAME ); - flowVars.push_back( RIG_FLD_COMMUNICATION_RESNAME ); - return flowVars; - } + return m_showOnlyVisibleCategoriesInLegend(); } //-------------------------------------------------------------------------------------------------- @@ -2403,27 +1802,11 @@ QStringList RimEclipseResultDefinition::getResultNamesForResultType( RiaDefines: //-------------------------------------------------------------------------------------------------- RimEclipseResultDefinition::FlowTracerSelectionState RimEclipseResultDefinition::injectorSelectionState() const { - if ( m_flowTracerSelectionMode == FLOW_TR_INJECTORS || m_flowTracerSelectionMode == FLOW_TR_INJ_AND_PROD ) - { - return ALL_SELECTED; - } - else if ( m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION ) - { - const bool isInjector = true; - if ( m_selectedInjectorTracers().size() == RimFlowDiagnosticsTools::setOfTracersOfType( m_flowSolutionUiField(), isInjector ).size() ) - { - return ALL_SELECTED; - } - else if ( m_selectedInjectorTracers().size() == (size_t)1 ) - { - return ONE_SELECTED; - } - else if ( m_selectedInjectorTracers().size() > (size_t)1 ) - { - return MULTIPLE_SELECTED; - } - } - return NONE_SELECTED; + const bool isInjector = true; + return RimEclipseResultDefinitionTools::getFlowTracerSelectionState( isInjector, + m_flowTracerSelectionMode(), + m_flowSolutionUiField(), + m_selectedInjectorTracers().size() ); } //-------------------------------------------------------------------------------------------------- @@ -2431,27 +1814,11 @@ RimEclipseResultDefinition::FlowTracerSelectionState RimEclipseResultDefinition: //-------------------------------------------------------------------------------------------------- RimEclipseResultDefinition::FlowTracerSelectionState RimEclipseResultDefinition::producerSelectionState() const { - if ( m_flowTracerSelectionMode == FLOW_TR_PRODUCERS || m_flowTracerSelectionMode == FLOW_TR_INJ_AND_PROD ) - { - return ALL_SELECTED; - } - else if ( m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION ) - { - const bool isInjector = false; - if ( m_selectedProducerTracers().size() == RimFlowDiagnosticsTools::setOfTracersOfType( m_flowSolutionUiField(), isInjector ).size() ) - { - return ALL_SELECTED; - } - else if ( m_selectedProducerTracers().size() == (size_t)1 ) - { - return ONE_SELECTED; - } - else if ( m_selectedProducerTracers().size() > (size_t)1 ) - { - return MULTIPLE_SELECTED; - } - } - return NONE_SELECTED; + const bool isInjector = false; + return RimEclipseResultDefinitionTools::getFlowTracerSelectionState( isInjector, + m_flowTracerSelectionMode(), + m_flowSolutionUiField(), + m_selectedProducerTracers().size() ); } //-------------------------------------------------------------------------------------------------- @@ -2469,7 +1836,7 @@ void RimEclipseResultDefinition::syncInjectorToProducerSelection() } RimFlowDiagSolution* flowSol = m_flowSolution(); - if ( flowSol && m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION ) + if ( flowSol && m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_BY_SELECTION ) { std::set newProducerSelection = RimFlowDiagnosticsTools::setOfProducerTracersFromInjectors( m_flowSolutionUiField(), m_selectedInjectorTracers(), timeStep ); @@ -2498,7 +1865,7 @@ void RimEclipseResultDefinition::syncProducerToInjectorSelection() } RimFlowDiagSolution* flowSol = m_flowSolution(); - if ( flowSol && m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION ) + if ( flowSol && m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_BY_SELECTION ) { std::set newInjectorSelection = RimFlowDiagnosticsTools::setOfInjectorTracersFromProducers( m_flowSolutionUiField(), m_selectedProducerTracers(), timeStep ); @@ -2561,31 +1928,7 @@ bool RimEclipseResultDefinition::isDeltaCaseActive() const //-------------------------------------------------------------------------------------------------- bool RimEclipseResultDefinition::isDivideByCellFaceAreaPossible() const { - QString str = m_resultVariable; - - // TODO : Move to RiaDefines or a separate file for cell face results - - if ( str == "FLRWATI+" ) return true; - if ( str == "FLRWATJ+" ) return true; - if ( str == "FLRWATK+" ) return true; - - if ( str == "FLROILI+" ) return true; - if ( str == "FLROILJ+" ) return true; - if ( str == "FLROILK+" ) return true; - - if ( str == "FLRGASI+" ) return true; - if ( str == "FLRGASJ+" ) return true; - if ( str == "FLRGASK+" ) return true; - - if ( str == "TRANX" ) return true; - if ( str == "TRANY" ) return true; - if ( str == "TRANZ" ) return true; - - if ( str == "riTRANX" ) return true; - if ( str == "riTRANY" ) return true; - if ( str == "riTRANZ" ) return true; - - return false; + return RimEclipseResultDefinitionTools::isDivideByCellFaceAreaPossible( m_resultVariable ); } //-------------------------------------------------------------------------------------------------- @@ -2632,27 +1975,3 @@ bool RimEclipseResultDefinition::addPerCellFaceOptionsForVariableUiField() const return true; } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimEclipseResultDefinition::getInputPropertyFileName( const QString& resultName ) const -{ - RimEclipseCase* eclipseCase; - this->firstAncestorOrThisOfType( eclipseCase ); - - if ( eclipseCase ) - { - RimEclipseInputPropertyCollection* inputPropertyCollection = eclipseCase->inputPropertyCollection(); - if ( inputPropertyCollection ) - { - RimEclipseInputProperty* inputProperty = inputPropertyCollection->findInputProperty( resultName ); - if ( inputProperty ) - { - return inputProperty->fileName.v().path(); - } - } - } - - return ""; -} diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.h b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.h index 483123cc76..21b3557059 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.h @@ -24,6 +24,7 @@ #include "RiaPorosityModel.h" #include "RigFlowDiagResultAddress.h" + #include "RimCheckableObject.h" #include "RimFlowDiagSolution.h" @@ -36,14 +37,13 @@ #include -#include "RigCaseCellResultsData.h" - class RigCaseCellResultsData; class RimEclipseCase; class RimEclipseView; class RimReservoirCellResultsStorage; class RimRegularLegendConfig; class RimTernaryLegendConfig; +class RigEclipseResultAddress; //================================================================================================== /// @@ -54,7 +54,7 @@ class RimEclipseResultDefinition : public RimCheckableObject CAF_PDM_HEADER_INIT; public: - enum FlowTracerSelectionType + enum class FlowTracerSelectionType { FLOW_TR_INJ_AND_PROD, FLOW_TR_PRODUCERS, @@ -63,7 +63,7 @@ public: }; using FlowTracerSelectionEnum = caf::AppEnum; - enum FlowTracerSelectionState + enum class FlowTracerSelectionState { NONE_SELECTED, ONE_SELECTED, @@ -139,6 +139,8 @@ public: void updateRangesForExplicitLegends( RimRegularLegendConfig* legendConfig, RimTernaryLegendConfig* ternaryLegendConfig, int currentTimeStep ); void updateLegendTitle( RimRegularLegendConfig* legendConfig, const QString& legendHeading ); + bool showOnlyVisibleCategoriesInLegend() const; + protected: virtual void updateLegendCategorySettings(){}; @@ -197,13 +199,7 @@ private: QString flowDiagResUiText( bool shortLabel, int maxTracerStringLength = std::numeric_limits::max() ) const; - QString timeOfFlightString( bool shorter ) const; - QString maxFractionTracerString( bool shorter ) const; - - QString selectedTracersString() const; - - void changedTracerSelectionField( bool injector ); - static QStringList getResultNamesForResultType( RiaDefines::ResultCatType resultCatType, const RigCaseCellResultsData* results ); + void changedTracerSelectionField( bool injector ); FlowTracerSelectionState injectorSelectionState() const; FlowTracerSelectionState producerSelectionState() const; @@ -225,8 +221,6 @@ private: bool showDerivedResultsFirstInVariableUiField() const; bool addPerCellFaceOptionsForVariableUiField() const; - QString getInputPropertyFileName( const QString& resultName ) const; - private: bool m_isDeltaResultEnabled; caf::PdmUiItemInfo::LabelPosType m_labelPosition; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinitionTools.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinitionTools.cpp new file mode 100644 index 0000000000..ba128be83f --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinitionTools.cpp @@ -0,0 +1,776 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2023- Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimEclipseResultDefinitionTools.h" + +#include "RiaColorTables.h" +#include "RiaColorTools.h" + +#include "RigAllanDiagramData.h" +#include "RigCaseCellResultsData.h" +#include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" +#include "RigFlowDiagResults.h" +#include "RigVisibleCategoriesCalculator.h" + +#include "RimColorLegend.h" +#include "RimColorLegendItem.h" +#include "RimEclipseCase.h" +#include "RimEclipseCellColors.h" +#include "RimEclipseInputProperty.h" +#include "RimEclipseInputPropertyCollection.h" +#include "RimEclipseView.h" +#include "RimFlowDiagnosticsTools.h" +#include "RimRegularLegendConfig.h" +#include "RimSimWellInView.h" +#include "RimSimWellInViewCollection.h" +#include "RimTernaryLegendConfig.h" + +#include + +#include "cafCategoryMapper.h" +#include "cvfColor3.h" +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimEclipseResultDefinitionTools::isDivideByCellFaceAreaPossible( const QString& resultName ) +{ + if ( resultName == "FLRWATI+" ) return true; + if ( resultName == "FLRWATJ+" ) return true; + if ( resultName == "FLRWATK+" ) return true; + + if ( resultName == "FLROILI+" ) return true; + if ( resultName == "FLROILJ+" ) return true; + if ( resultName == "FLROILK+" ) return true; + + if ( resultName == "FLRGASI+" ) return true; + if ( resultName == "FLRGASJ+" ) return true; + if ( resultName == "FLRGASK+" ) return true; + + if ( resultName == "TRANX" ) return true; + if ( resultName == "TRANY" ) return true; + if ( resultName == "TRANZ" ) return true; + + if ( resultName == "riTRANX" ) return true; + if ( resultName == "riTRANY" ) return true; + if ( resultName == "riTRANZ" ) return true; + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RD::FlowTracerSelectionState RimEclipseResultDefinitionTools::getFlowTracerSelectionState( bool isInjector, + RD::FlowTracerSelectionType tracerSelectionType, + const RimFlowDiagSolution* flowDiagSolution, + size_t selectedTracerCount ) +{ + if ( tracerSelectionType == RD::FlowTracerSelectionType::FLOW_TR_INJECTORS || + tracerSelectionType == RD::FlowTracerSelectionType::FLOW_TR_INJ_AND_PROD ) + { + return RD::FlowTracerSelectionState::ALL_SELECTED; + } + + if ( tracerSelectionType == RD::FlowTracerSelectionType::FLOW_TR_BY_SELECTION ) + { + if ( selectedTracerCount == RimFlowDiagnosticsTools::setOfTracersOfType( flowDiagSolution, isInjector ).size() ) + { + return RD::FlowTracerSelectionState::ALL_SELECTED; + } + if ( selectedTracerCount == 1 ) + { + return RD::FlowTracerSelectionState::ONE_SELECTED; + } + if ( selectedTracerCount > 1 ) + { + return RD::FlowTracerSelectionState::MULTIPLE_SELECTED; + } + } + + return RD::FlowTracerSelectionState::NONE_SELECTED; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QStringList RimEclipseResultDefinitionTools::getResultNamesForResultType( RiaDefines::ResultCatType resultCatType, + const RigCaseCellResultsData* results ) +{ + if ( resultCatType != RiaDefines::ResultCatType::FLOW_DIAGNOSTICS ) + { + if ( !results ) return {}; + + return results->resultNames( resultCatType ); + } + + QStringList flowVars; + flowVars.push_back( RIG_FLD_TOF_RESNAME ); + flowVars.push_back( RIG_FLD_CELL_FRACTION_RESNAME ); + flowVars.push_back( RIG_FLD_MAX_FRACTION_TRACER_RESNAME ); + flowVars.push_back( RIG_FLD_COMMUNICATION_RESNAME ); + return flowVars; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimEclipseResultDefinitionTools::timeOfFlightString( RD::FlowTracerSelectionState injectorState, + RD::FlowTracerSelectionState producerState, + bool shorter ) +{ + QString tofString; + bool multipleSelected = false; + if ( injectorState != RD::FlowTracerSelectionState::NONE_SELECTED && producerState != RD::FlowTracerSelectionState::NONE_SELECTED ) + { + tofString = shorter ? "Res.Time" : "Residence Time"; + multipleSelected = true; + } + else if ( injectorState != RD::FlowTracerSelectionState::NONE_SELECTED ) + { + tofString = shorter ? "Fwd.TOF" : "Forward Time of Flight"; + } + else if ( producerState != RD::FlowTracerSelectionState::NONE_SELECTED ) + { + tofString = shorter ? "Rev.TOF" : "Reverse Time of Flight"; + } + else + { + tofString = shorter ? "TOF" : "Time of Flight"; + } + + multipleSelected = multipleSelected || injectorState >= RD::FlowTracerSelectionState::MULTIPLE_SELECTED || + producerState >= RD::FlowTracerSelectionState::MULTIPLE_SELECTED; + + if ( multipleSelected && !shorter ) + { + tofString += " (Average)"; + } + + tofString += " [days]"; + // Conversion from seconds in flow module to days is done in RigFlowDiagTimeStepResult::setTracerTOF() + + return tofString; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimEclipseResultDefinitionTools::maxFractionTracerString( RD::FlowTracerSelectionState injectorState, + RD::FlowTracerSelectionState producerState, + bool shorter ) +{ + QString mfString; + if ( injectorState >= RD::FlowTracerSelectionState::ONE_SELECTED && producerState == RD::FlowTracerSelectionState::NONE_SELECTED ) + { + mfString = shorter ? "FloodReg" : "Flooding Region"; + if ( injectorState >= RD::FlowTracerSelectionState::MULTIPLE_SELECTED ) mfString += "s"; + } + else if ( injectorState == RD::FlowTracerSelectionState::NONE_SELECTED && producerState >= RD::FlowTracerSelectionState::ONE_SELECTED ) + { + mfString = shorter ? "DrainReg" : "Drainage Region"; + if ( producerState >= RD::FlowTracerSelectionState::MULTIPLE_SELECTED ) mfString += "s"; + } + else + { + mfString = shorter ? "Drain&FloodReg" : "Drainage/Flooding Regions"; + } + return mfString; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimEclipseResultDefinitionTools::selectedTracersString( RD::FlowTracerSelectionState injectorState, + RD::FlowTracerSelectionState producerState, + const std::vector& selectedInjectors, + const std::vector& selectedProducers, + int maxTracerStringLength ) +{ + QStringList fullTracersList; + + if ( injectorState == RD::FlowTracerSelectionState::ALL_SELECTED && producerState == RD::FlowTracerSelectionState::ALL_SELECTED ) + { + fullTracersList += caf::AppEnum::uiText( RD::FlowTracerSelectionType::FLOW_TR_INJ_AND_PROD ); + } + else + { + if ( injectorState == RD::FlowTracerSelectionState::ALL_SELECTED ) + { + fullTracersList += caf::AppEnum::uiText( RD::FlowTracerSelectionType::FLOW_TR_INJECTORS ); + } + + if ( producerState == RD::FlowTracerSelectionState::ALL_SELECTED ) + { + fullTracersList += caf::AppEnum::uiText( RD::FlowTracerSelectionType::FLOW_TR_PRODUCERS ); + } + + if ( injectorState == RD::FlowTracerSelectionState::ONE_SELECTED || injectorState == RD::FlowTracerSelectionState::MULTIPLE_SELECTED ) + { + QStringList listOfSelectedInjectors; + for ( const QString& injector : selectedInjectors ) + { + listOfSelectedInjectors.push_back( injector ); + } + if ( !listOfSelectedInjectors.empty() ) + { + fullTracersList += listOfSelectedInjectors.join( ", " ); + } + } + + if ( producerState == RD::FlowTracerSelectionState::ONE_SELECTED || producerState == RD::FlowTracerSelectionState::MULTIPLE_SELECTED ) + { + QStringList listOfSelectedProducers; + for ( const QString& producer : selectedProducers ) + { + listOfSelectedProducers.push_back( producer ); + } + if ( !listOfSelectedProducers.empty() ) + { + fullTracersList.push_back( listOfSelectedProducers.join( ", " ) ); + } + } + } + + QString tracersText; + if ( !fullTracersList.empty() ) + { + tracersText = fullTracersList.join( ", " ); + } + + if ( !tracersText.isEmpty() ) + { + const QString postfix = "..."; + + if ( tracersText.size() > maxTracerStringLength + postfix.size() ) + { + tracersText = tracersText.left( maxTracerStringLength ); + tracersText += postfix; + } + } + + return tracersText; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimEclipseResultDefinitionTools::getInputPropertyFileName( const RimEclipseCase* eclipseCase, const QString& resultName ) +{ + if ( eclipseCase ) + { + RimEclipseInputPropertyCollection* inputPropertyCollection = eclipseCase->inputPropertyCollection(); + if ( inputPropertyCollection ) + { + RimEclipseInputProperty* inputProperty = inputPropertyCollection->findInputProperty( resultName ); + if ( inputProperty ) + { + return inputProperty->fileName.v().path(); + } + } + } + + return ""; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultDefinitionTools::updateTernaryLegend( RigCaseCellResultsData* cellResultsData, + RimTernaryLegendConfig* ternaryLegendConfigToUpdate, + int timeStep ) +{ + if ( !cellResultsData ) return; + + size_t maxTimeStepCount = cellResultsData->maxTimeStepCount(); + if ( maxTimeStepCount > 1 ) + { + { + RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ); + + if ( cellResultsData->ensureKnownResultLoaded( resAddr ) ) + { + double globalMin = 0.0; + double globalMax = 1.0; + double localMin = 0.0; + double localMax = 1.0; + + cellResultsData->minMaxCellScalarValues( resAddr, globalMin, globalMax ); + cellResultsData->minMaxCellScalarValues( resAddr, timeStep, localMin, localMax ); + + ternaryLegendConfigToUpdate->setAutomaticRanges( RimTernaryLegendConfig::TERNARY_SOIL_IDX, globalMin, globalMax, localMin, localMax ); + } + } + + { + RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ); + + if ( cellResultsData->ensureKnownResultLoaded( resAddr ) ) + { + double globalMin = 0.0; + double globalMax = 1.0; + double localMin = 0.0; + double localMax = 1.0; + + cellResultsData->minMaxCellScalarValues( resAddr, globalMin, globalMax ); + cellResultsData->minMaxCellScalarValues( resAddr, timeStep, localMin, localMax ); + + ternaryLegendConfigToUpdate->setAutomaticRanges( RimTernaryLegendConfig::TERNARY_SGAS_IDX, globalMin, globalMax, localMin, localMax ); + } + } + + { + RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::swat() ); + + if ( cellResultsData->ensureKnownResultLoaded( resAddr ) ) + { + double globalMin = 0.0; + double globalMax = 1.0; + double localMin = 0.0; + double localMax = 1.0; + + cellResultsData->minMaxCellScalarValues( resAddr, globalMin, globalMax ); + cellResultsData->minMaxCellScalarValues( resAddr, timeStep, localMin, localMax ); + + ternaryLegendConfigToUpdate->setAutomaticRanges( RimTernaryLegendConfig::TERNARY_SWAT_IDX, globalMin, globalMax, localMin, localMax ); + } + } + } +} + +namespace RimEclipseResultDefinitionTools +{ + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool operator<( const cvf::Color3ub first, const cvf::Color3ub second ) +{ + if ( first.r() != second.r() ) return first.r() < second.r(); + if ( first.g() != second.g() ) return first.g() < second.g(); + if ( first.b() != second.b() ) return first.b() < second.b(); + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class TupleCompare +{ +public: + bool operator()( const std::tuple& t1, const std::tuple& t2 ) const + { + using namespace std; + if ( get<0>( t1 ) != get<0>( t2 ) ) return get<0>( t1 ) < get<0>( t2 ); + if ( get<1>( t1 ) != get<1>( t2 ) ) return get<1>( t1 ) < get<1>( t2 ); + if ( get<2>( t1 ) != get<2>( t2 ) ) return get<2>( t1 ) < get<2>( t2 ); + + return false; + } +}; +} // namespace RimEclipseResultDefinitionTools + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultDefinitionTools::updateLegendForFlowDiagnostics( const RimEclipseResultDefinition* resultDefinition, + RimRegularLegendConfig* legendConfigToUpdate, + int timeStep ) +{ + if ( timeStep < 0 ) return; + if ( !resultDefinition || !legendConfigToUpdate ) return; + + auto flowDiagSolution = resultDefinition->flowDiagSolution(); + if ( !flowDiagSolution ) return; + + RigFlowDiagResults* flowResultsData = flowDiagSolution->flowDiagResults(); + if ( !flowResultsData ) return; + + RigFlowDiagResultAddress resAddr = resultDefinition->flowDiagResAddress(); + + double globalMin, globalMax; + double globalPosClosestToZero, globalNegClosestToZero; + + flowResultsData->minMaxScalarValues( resAddr, timeStep, &globalMin, &globalMax ); + flowResultsData->posNegClosestToZero( resAddr, timeStep, &globalPosClosestToZero, &globalNegClosestToZero ); + + double localMin, localMax; + double localPosClosestToZero, localNegClosestToZero; + if ( resultDefinition->hasDynamicResult() ) + { + flowResultsData->minMaxScalarValues( resAddr, timeStep, &localMin, &localMax ); + flowResultsData->posNegClosestToZero( resAddr, timeStep, &localPosClosestToZero, &localNegClosestToZero ); + } + else + { + localMin = globalMin; + localMax = globalMax; + + localPosClosestToZero = globalPosClosestToZero; + localNegClosestToZero = globalNegClosestToZero; + } + + CVF_ASSERT( legendConfigToUpdate ); + + legendConfigToUpdate->disableAllTimeStepsRange( true ); + legendConfigToUpdate->setClosestToZeroValues( globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero ); + legendConfigToUpdate->setAutomaticRanges( globalMin, globalMax, localMin, localMax ); + + if ( resultDefinition->hasCategoryResult() ) + { + RimEclipseView* eclView = nullptr; + resultDefinition->firstAncestorOrThisOfType( eclView ); + + if ( eclView ) + { + std::set, TupleCompare> categories; + + std::vector tracerNames = flowDiagSolution->tracerNames(); + int tracerIndex = 0; + + for ( const auto& tracerName : tracerNames ) + { + cvf::Color3ub color( cvf::Color3::GRAY ); + + RimSimWellInView* well = eclView->wellCollection()->findWell( RimFlowDiagSolution::removeCrossFlowEnding( tracerName ) ); + + if ( well ) color = cvf::Color3ub( well->wellPipeColor() ); + + categories.insert( std::make_tuple( tracerName, tracerIndex, color ) ); + ++tracerIndex; + } + + std::vector> categoryVector; + + if ( resultDefinition->showOnlyVisibleCategoriesInLegend() ) + { + std::set visibleTracers = + RigVisibleCategoriesCalculator::visibleFlowDiagCategories( *eclView, *flowResultsData, resAddr, timeStep ); + for ( auto tupIt : categories ) + { + int tracerIndex = std::get<1>( tupIt ); + if ( visibleTracers.count( tracerIndex ) ) categoryVector.push_back( tupIt ); + } + } + else + { + for ( const auto& tupIt : categories ) + { + categoryVector.push_back( tupIt ); + } + } + + legendConfigToUpdate->setCategoryItems( categoryVector ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultDefinitionTools::updateCellResultLegend( const RimEclipseResultDefinition* resultDefinition, + RimRegularLegendConfig* legendConfigToUpdate, + int timeStep ) +{ + if ( !resultDefinition || !legendConfigToUpdate ) return; + + auto cellResultsData = resultDefinition->currentGridCellResults(); + if ( !cellResultsData ) return; + + auto eclipseCaseData = resultDefinition->eclipseCase()->eclipseCaseData(); + if ( !eclipseCaseData ) return; + + cellResultsData->ensureKnownResultLoaded( resultDefinition->eclipseResultAddress() ); + + double globalMin, globalMax; + double globalPosClosestToZero, globalNegClosestToZero; + + cellResultsData->minMaxCellScalarValues( resultDefinition->eclipseResultAddress(), globalMin, globalMax ); + cellResultsData->posNegClosestToZero( resultDefinition->eclipseResultAddress(), globalPosClosestToZero, globalNegClosestToZero ); + + double localMin, localMax; + double localPosClosestToZero, localNegClosestToZero; + if ( resultDefinition->hasDynamicResult() && timeStep >= 0 ) + { + cellResultsData->minMaxCellScalarValues( resultDefinition->eclipseResultAddress(), timeStep, localMin, localMax ); + cellResultsData->posNegClosestToZero( resultDefinition->eclipseResultAddress(), timeStep, localPosClosestToZero, localNegClosestToZero ); + } + else + { + localMin = globalMin; + localMax = globalMax; + + localPosClosestToZero = globalPosClosestToZero; + localNegClosestToZero = globalNegClosestToZero; + } + + CVF_ASSERT( legendConfigToUpdate ); + + legendConfigToUpdate->disableAllTimeStepsRange( false ); + legendConfigToUpdate->setClosestToZeroValues( globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero ); + legendConfigToUpdate->setAutomaticRanges( globalMin, globalMax, localMin, localMax ); + + if ( resultDefinition->hasCategoryResult() ) + { + if ( resultDefinition->resultType() == RiaDefines::ResultCatType::ALLAN_DIAGRAMS ) + { + if ( resultDefinition->resultVariable() == RiaResultNames::formationAllanResultName() ) + { + const std::vector fnVector = eclipseCaseData->formationNames(); + std::vector fnameIdxes; + for ( int i = 0; i < static_cast( fnVector.size() ); i++ ) + { + fnameIdxes.push_back( i ); + } + + cvf::Color3ubArray legendBaseColors = legendConfigToUpdate->colorLegend()->colorArray(); + + cvf::ref formationColorMapper = new caf::CategoryMapper; + formationColorMapper->setCategories( fnameIdxes ); + formationColorMapper->setInterpolateColors( legendBaseColors ); + + const std::map, int>& formationCombToCategory = + eclipseCaseData->allanDiagramData()->formationCombinationToCategory(); + + std::vector> categories; + for ( int frmNameIdx : fnameIdxes ) + { + cvf::Color3ub formationColor = formationColorMapper->mapToColor( frmNameIdx ); + categories.emplace_back( std::make_tuple( fnVector[frmNameIdx], frmNameIdx, formationColor ) ); + } + + std::set visibleAllanCategories; + { + RimEclipseView* eclView = nullptr; + resultDefinition->firstAncestorOrThisOfType( eclView ); + + visibleAllanCategories = RigVisibleCategoriesCalculator::visibleAllanCategories( eclView ); + } + + for ( auto [formationPair, categoryIndex] : formationCombToCategory ) + { + int frmIdx1 = formationPair.first; + int frmIdx2 = formationPair.second; + + if ( visibleAllanCategories.count( categoryIndex ) == 0 ) continue; + + auto fnVectorSize = static_cast( fnVector.size() ); + if ( frmIdx1 >= fnVectorSize || frmIdx2 >= fnVectorSize ) continue; + + QString frmName1 = fnVector[frmIdx1]; + QString frmName2 = fnVector[frmIdx2]; + + cvf::Color3f formationColor1 = cvf::Color3f( formationColorMapper->mapToColor( frmIdx1 ) ); + cvf::Color3f formationColor2 = cvf::Color3f( formationColorMapper->mapToColor( frmIdx2 ) ); + + cvf::Color3ub blendColor = cvf::Color3ub( RiaColorTools::blendCvfColors( formationColor1, formationColor2 ) ); + + categories.emplace_back( std::make_tuple( frmName1 + "-" + frmName2, categoryIndex, blendColor ) ); + } + + legendConfigToUpdate->setCategoryItems( categories ); + } + else if ( resultDefinition->resultVariable() == RiaResultNames::formationBinaryAllanResultName() ) + { + std::vector> categories; + categories.emplace_back( std::make_tuple( "Same formation", 0, cvf::Color3ub::BROWN ) ); + categories.emplace_back( std::make_tuple( "Different formation", 1, cvf::Color3ub::ORANGE ) ); + + legendConfigToUpdate->setCategoryItems( categories ); + } + } + else if ( resultDefinition->resultType() == RiaDefines::ResultCatType::DYNAMIC_NATIVE && + resultDefinition->resultVariable() == RiaResultNames::completionTypeResultName() ) + { + const std::vector& visibleCategories = cellResultsData->uniqueCellScalarValues( resultDefinition->eclipseResultAddress() ); + + std::vector supportedCompletionTypes = { RiaDefines::WellPathComponentType::WELL_PATH, + RiaDefines::WellPathComponentType::FISHBONES, + RiaDefines::WellPathComponentType::PERFORATION_INTERVAL, + RiaDefines::WellPathComponentType::FRACTURE }; + + RiaColorTables::WellPathComponentColors colors = RiaColorTables::wellPathComponentColors(); + + std::vector> categories; + for ( auto completionType : supportedCompletionTypes ) + { + if ( std::find( visibleCategories.begin(), visibleCategories.end(), static_cast( completionType ) ) != + visibleCategories.end() ) + { + QString categoryText = caf::AppEnum::uiText( completionType ); + categories.emplace_back( categoryText, static_cast( completionType ), colors[completionType] ); + } + } + + legendConfigToUpdate->setCategoryItems( categories ); + } + else + { + auto uniqueValues = cellResultsData->uniqueCellScalarValues( resultDefinition->eclipseResultAddress() ); + if ( resultDefinition->eclipseResultAddress().resultCatType() == RiaDefines::ResultCatType::FORMATION_NAMES ) + { + std::vector fnVector = eclipseCaseData->formationNames(); + uniqueValues.resize( fnVector.size() ); + std::iota( uniqueValues.begin(), uniqueValues.end(), 0 ); + } + + cvf::Color3ubArray legendBaseColors = legendConfigToUpdate->colorLegend()->colorArray(); + + cvf::ref categoryMapper = new caf::CategoryMapper; + categoryMapper->setCategories( uniqueValues ); + categoryMapper->setInterpolateColors( legendBaseColors ); + + std::vector visibleCategoryValues = uniqueValues; + + if ( resultDefinition->showOnlyVisibleCategoriesInLegend() ) + { + RimEclipseView* eclView = nullptr; + resultDefinition->firstAncestorOrThisOfType( eclView ); + if ( eclView && eclView->showWindow() ) + { + // Check if current result is cell result, and update the visible set of values + // TODO: Can be extended to the separate geometry results (separate fault result, separate + // intersection results), but this requires some refactoring + if ( eclView->cellResult() == resultDefinition ) + { + std::set visibleCategorySet = RigVisibleCategoriesCalculator::visibleCategories( eclView ); + + visibleCategoryValues.clear(); + visibleCategoryValues.insert( visibleCategoryValues.begin(), visibleCategorySet.begin(), visibleCategorySet.end() ); + } + } + } + std::vector> categoryVector; + + for ( auto value : visibleCategoryValues ) + { + cvf::Color3ub categoryColor = categoryMapper->mapToColor( value ); + + QString valueTxt; + if ( resultDefinition->resultType() == RiaDefines::ResultCatType::FORMATION_NAMES ) + { + std::vector fnVector = eclipseCaseData->formationNames(); + + if ( value < static_cast( fnVector.size() ) ) + { + valueTxt = fnVector[value]; + } + } + else + { + auto items = legendConfigToUpdate->colorLegend()->colorLegendItems(); + auto it = std::find_if( items.begin(), + items.end(), + [value]( const RimColorLegendItem* const item ) { return item->categoryValue() == value; } ); + if ( it != items.end() && !( *it )->categoryName().isEmpty() ) + { + valueTxt = QString( "%1 (%2)" ).arg( ( *it )->categoryName() ).arg( value ); + } + else + { + valueTxt = QString( "%1" ).arg( value ); + } + } + + categoryVector.emplace_back( valueTxt, value, categoryColor ); + } + legendConfigToUpdate->setCategoryItems( categoryVector ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimEclipseResultDefinitionTools::calcOptionsForVariableUiFieldStandard( RiaDefines::ResultCatType resultCatType, + const RigCaseCellResultsData* results, + bool showDerivedResultsFirst, + bool addPerCellFaceOptionItems, + bool enableTernary ) +{ + if ( !results ) return {}; + + QList optionList; + + QStringList cellCenterResultNames; + QStringList cellFaceResultNames; + + for ( const QString& s : RimEclipseResultDefinitionTools::getResultNamesForResultType( resultCatType, results ) ) + { + if ( s == RiaResultNames::completionTypeResultName() ) + { + if ( results->timeStepDates().empty() ) continue; + } + + if ( RiaResultNames::isPerCellFaceResult( s ) ) + { + cellFaceResultNames.push_back( s ); + } + else + { + cellCenterResultNames.push_back( s ); + } + } + + cellCenterResultNames.sort(); + cellFaceResultNames.sort(); + + // Cell Center result names + for ( const QString& s : cellCenterResultNames ) + { + optionList.push_back( caf::PdmOptionItemInfo( s, s ) ); + } + + if ( addPerCellFaceOptionItems ) + { + for ( const QString& s : cellFaceResultNames ) + { + if ( showDerivedResultsFirst ) + { + optionList.push_front( caf::PdmOptionItemInfo( s, s ) ); + } + else + { + optionList.push_back( caf::PdmOptionItemInfo( s, s ) ); + } + } + + // Ternary Result + if ( enableTernary ) + { + bool hasAtLeastOneTernaryComponent = false; + if ( cellCenterResultNames.contains( RiaResultNames::soil() ) ) + hasAtLeastOneTernaryComponent = true; + else if ( cellCenterResultNames.contains( RiaResultNames::sgas() ) ) + hasAtLeastOneTernaryComponent = true; + else if ( cellCenterResultNames.contains( RiaResultNames::swat() ) ) + hasAtLeastOneTernaryComponent = true; + + if ( resultCatType == RiaDefines::ResultCatType::DYNAMIC_NATIVE && hasAtLeastOneTernaryComponent ) + { + optionList.push_front( caf::PdmOptionItemInfo( RiaResultNames::ternarySaturationResultName(), + RiaResultNames::ternarySaturationResultName() ) ); + } + } + } + + optionList.push_front( caf::PdmOptionItemInfo( RiaResultNames::undefinedResultName(), RiaResultNames::undefinedResultName() ) ); + + return optionList; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinitionTools.h b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinitionTools.h new file mode 100644 index 0000000000..b9ac6482ed --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinitionTools.h @@ -0,0 +1,62 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2023- Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RimEclipseResultDefinition.h" + +#include + +using RD = RimEclipseResultDefinition; + +namespace RimEclipseResultDefinitionTools +{ +bool isDivideByCellFaceAreaPossible( const QString& resultName ); + +RD::FlowTracerSelectionState getFlowTracerSelectionState( bool isInjector, + RD::FlowTracerSelectionType tracerSelectionType, + const RimFlowDiagSolution* flowDiagSolution, + size_t selectedTracerCount ); + +QStringList getResultNamesForResultType( RiaDefines::ResultCatType resultCatType, const RigCaseCellResultsData* results ); + +QString timeOfFlightString( RD::FlowTracerSelectionState injectorState, RD::FlowTracerSelectionState producerState, bool shorter ); +QString maxFractionTracerString( RD::FlowTracerSelectionState injectorState, RD::FlowTracerSelectionState producerState, bool shorter ); + +QString selectedTracersString( RD::FlowTracerSelectionState injectorState, + RD::FlowTracerSelectionState producerState, + const std::vector& selectedInjectors, + const std::vector& selectedProducers, + int maxTracerStringLength ); + +QString getInputPropertyFileName( const RimEclipseCase* eclipseCase, const QString& resultName ); + +void updateTernaryLegend( RigCaseCellResultsData* cellResultsData, RimTernaryLegendConfig* ternaryLegendConfigToUpdate, int timeStep ); + +void updateLegendForFlowDiagnostics( const RimEclipseResultDefinition* resultDefinition, + RimRegularLegendConfig* legendConfigToUpdate, + int timeStep ); + +void updateCellResultLegend( const RimEclipseResultDefinition* resultDefinition, RimRegularLegendConfig* legendConfigToUpdate, int timeStep ); + +QList calcOptionsForVariableUiFieldStandard( RiaDefines::ResultCatType resultCatType, + const RigCaseCellResultsData* results, + bool showDerivedResultsFirst, + bool addPerCellFaceOptionItems, + bool enableTernary ); +}; // namespace RimEclipseResultDefinitionTools diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp index 85b9edfec1..420bee50ce 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp @@ -20,11 +20,14 @@ #include "RimEclipseStatisticsCase.h" +#include "RiaResultNames.h" + #include "RicNewViewFeature.h" #include "RicfCommandObject.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigSimWellData.h" #include "RimCaseCollection.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimMultipleEclipseResults.cpp b/ApplicationLibCode/ProjectDataModel/RimMultipleEclipseResults.cpp index 635f789fc6..a616a1eef2 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultipleEclipseResults.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultipleEclipseResults.cpp @@ -18,6 +18,9 @@ #include "RimMultipleEclipseResults.h" +#include "RigCaseCellResultsData.h" +#include "RigEclipseResultAddress.h" + #include "RimEclipseCellColors.h" #include "RimEclipseView.h" diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp index 6d2606febe..0c244d2318 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp @@ -23,6 +23,7 @@ #include "RiaStimPlanModelDefines.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigEclipseWellLogExtractor.h" #include "RigElasticProperties.h" #include "RigResultAccessor.h" diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelLayerCalculator.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelLayerCalculator.cpp index c8253af644..1577150fe2 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelLayerCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelLayerCalculator.cpp @@ -22,6 +22,7 @@ #include "RiaStimPlanModelDefines.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigEclipseWellLogExtractor.h" #include "RigResultAccessor.h" #include "RigResultAccessorFactory.h" diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelWellLogCalculator.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelWellLogCalculator.cpp index 1d789f2bf4..056a3568b7 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelWellLogCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelWellLogCalculator.cpp @@ -23,6 +23,7 @@ #include "RiaStimPlanModelDefines.h" #include "RigActiveCellInfo.h" +#include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" #include "RigEclipseWellLogExtractor.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp index 2ee510ed46..0b0612cf6c 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp @@ -27,6 +27,7 @@ #include "RiaWellLogUnitTools.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigEclipseWellLogExtractor.h" #include "RigFemPartResultsCollection.h" #include "RigGeoMechCaseData.h" diff --git a/ApplicationLibCode/ReservoirDataModel/Completions/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/Completions/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp index ffacc92922..25f5470e55 100644 --- a/ApplicationLibCode/ReservoirDataModel/Completions/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/Completions/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp @@ -22,6 +22,7 @@ #include "RigCaseCellResultsData.h" #include "RigCellGeometryTools.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigFractureCell.h" #include "RigFractureTransmissibilityEquations.h" #include "RigHexIntersectionTools.h" diff --git a/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp b/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp index 0f35ae5f36..15634d80b8 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp @@ -26,6 +26,7 @@ #include "RigCombMultResultAccessor.h" #include "RigCombTransResultAccessor.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigFlowDiagResults.h" #include "RigGridBase.h" #include "RigMainGrid.h" diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigAllanUtil.cpp b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigAllanUtil.cpp index 326597ecb8..8941121711 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigAllanUtil.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigAllanUtil.cpp @@ -17,8 +17,10 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RigAllanUtil.h" + #include "RigAllanDiagramData.h" #include "RigCaseCellResultsData.h" +#include "RigEclipseResultAddress.h" #include "RigFormationNames.h" #include "RigMainGrid.h" #include "RigNNCData.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h index d804fcc206..c6ac4577c9 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h @@ -23,8 +23,6 @@ #include "RiaDefines.h" #include "RiaPorosityModel.h" -#include "RigEclipseResultAddress.h" - #include "cvfCollection.h" #include @@ -42,6 +40,7 @@ class RigEclipseTimeStepInfo; class RigEclipseCaseData; class RigFormationNames; class RigAllanDiagramData; +class RigEclipseResultAddress; class RimEclipseCase; diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseAllanFaultsStatCalc.h b/ApplicationLibCode/ReservoirDataModel/RigEclipseAllanFaultsStatCalc.h index 8796dcc781..0b079b469d 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseAllanFaultsStatCalc.h +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseAllanFaultsStatCalc.h @@ -26,6 +26,7 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" +#include "RigEclipseResultAddress.h" #include "RigNNCData.h" #include "cvfArray.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp index ac09aa9349..0836cc4ac5 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp @@ -24,6 +24,7 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" +#include "RigEclipseResultAddress.h" #include "RigEquil.h" #include "RigFormationNames.h" #include "RigMainGrid.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.h b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.h index 4e19447a3e..5e1dd8edf8 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.h +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.h @@ -23,6 +23,7 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" +#include "RigEclipseResultAddress.h" #include "RigStatisticsCalculator.h" class RigHistogramCalculator; diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h index 96c553820a..fe89dfc93e 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h @@ -26,6 +26,7 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" +#include "RigEclipseResultAddress.h" #include "cvfArray.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp index 310b273504..60ef905628 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp @@ -23,6 +23,7 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigMainGrid.h" #include "RigResultAccessor.h" #include "RigWellLogExtractionTools.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp index d4ef57c639..acf731b279 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp @@ -27,6 +27,7 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigFlowDiagInterfaceTools.h" #include "opm/flowdiagnostics/DerivedQuantities.hpp" diff --git a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagStatCalc.cpp b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagStatCalc.cpp index ba38f15b60..50e4ac6ee7 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagStatCalc.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagStatCalc.cpp @@ -19,7 +19,10 @@ #include "RigFlowDiagStatCalc.h" +#include "RiaResultNames.h" + #include "RigCaseCellResultsData.h" +#include "RigEclipseResultAddress.h" #include "RigFlowDiagResults.h" #include "RigStatisticsMath.h" #include "RigWeightedMeanCalc.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagVisibleCellsStatCalc.cpp b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagVisibleCellsStatCalc.cpp index 475e0e125d..db0199b21e 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagVisibleCellsStatCalc.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagVisibleCellsStatCalc.cpp @@ -19,8 +19,11 @@ #include "RigFlowDiagVisibleCellsStatCalc.h" +#include "RiaResultNames.h" + #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" +#include "RigEclipseResultAddress.h" #include "RigStatisticsMath.h" #include "RigWeightedMeanCalc.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp index c5dda2f5b9..c39cd84824 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp @@ -23,6 +23,7 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigMainGrid.h" #include "RigNNCData.h" #include "RigReservoirBuilderMock.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigResultModifierFactory.cpp b/ApplicationLibCode/ReservoirDataModel/RigResultModifierFactory.cpp index 2a0b0dda23..3b8e153e74 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigResultModifierFactory.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigResultModifierFactory.cpp @@ -21,6 +21,7 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigResultModifier.h" #include diff --git a/ApplicationLibCode/ReservoirDataModel/RigTofAccumulatedPhaseFractionsCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigTofAccumulatedPhaseFractionsCalculator.cpp index 895c855d3e..a9e6b7cf0b 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigTofAccumulatedPhaseFractionsCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigTofAccumulatedPhaseFractionsCalculator.cpp @@ -20,6 +20,7 @@ #include "RiaDefines.h" #include "RiaPorosityModel.h" +#include "RiaResultNames.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigTofWellDistributionCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigTofWellDistributionCalculator.cpp index 0ff6fd9897..fc614e1337 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigTofWellDistributionCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigTofWellDistributionCalculator.cpp @@ -21,6 +21,7 @@ #include "RiaDefines.h" #include "RiaLogging.h" #include "RiaPorosityModel.h" +#include "RiaResultNames.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" diff --git a/ApplicationLibCode/UserInterface/RiuPvtPlotUpdater.cpp b/ApplicationLibCode/UserInterface/RiuPvtPlotUpdater.cpp index 0e2d7de932..e3b4f8ed27 100644 --- a/ApplicationLibCode/UserInterface/RiuPvtPlotUpdater.cpp +++ b/ApplicationLibCode/UserInterface/RiuPvtPlotUpdater.cpp @@ -18,7 +18,9 @@ #include "RiuPvtPlotUpdater.h" +#include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigResultAccessor.h" #include "RigResultAccessorFactory.h" diff --git a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotUpdater.cpp b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotUpdater.cpp index 9eb304b610..db004ddd4f 100644 --- a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotUpdater.cpp +++ b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotUpdater.cpp @@ -23,6 +23,7 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigGridBase.h" #include "RigResultAccessor.h" #include "RigResultAccessorFactory.h" diff --git a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp index ed787c471d..ab040a1162 100644 --- a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp +++ b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp @@ -22,6 +22,7 @@ #include "RigAllanDiagramData.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultAddress.h" #include "RigFormationNames.h" #include "RigMainGrid.h" #include "RigNNCData.h" diff --git a/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp b/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp index 03ac4784c4..62c7a5a7c4 100644 --- a/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp +++ b/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp @@ -19,6 +19,8 @@ #include "RiuSelectionChangedHandler.h" +#include "RiaResultNames.h" + #include "RigCaseCellResultsData.h" #include "RigDepthResultAccessor.h" #include "RigEclipseCaseData.h" @@ -26,7 +28,6 @@ #include "RigFemPartResultsCollection.h" #include "RigGeoMechCaseData.h" #include "RigTimeHistoryResultAccessor.h" -#include "RiuFemTimeHistoryResultAccessor.h" #include "Rim2dIntersectionView.h" #include "RimEclipseCase.h" @@ -41,6 +42,7 @@ #include "Riu3dSelectionManager.h" #include "RiuDepthQwtPlot.h" #include "RiuFemResultTextBuilder.h" +#include "RiuFemTimeHistoryResultAccessor.h" #include "RiuMainWindow.h" #include "RiuMohrsCirclePlot.h" #include "RiuPvtPlotPanel.h"