diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 9e08f08c02..ed4dff5404 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -566,6 +566,8 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct // At this point, all the file paths variables are replaced and all file paths updated to the new location. This will enable use of // file paths in initAfterRead(). + // If Rim-objects are created in initAfterRead(), they will be resolved in the second pass + // Example: Realization objects in ensemble file set m_project->resolveReferencesRecursively(); m_project->initAfterReadRecursively(); @@ -884,6 +886,10 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct } } + // Second pass: a full recursive resolution to robustly handle both previously failing references and any newly created ones from + // initAfterRead. + m_project->resolveReferencesRecursively(); + // Some procedures in onProjectOpened() may rely on the display model having been created // So we need to force the completion of the display model here. RiaViewRedrawScheduler::instance()->updateAndRedrawScheduledViews(); diff --git a/ApplicationLibCode/Application/RiaResultNames.cpp b/ApplicationLibCode/Application/RiaResultNames.cpp index e0498cf9bc..be645fcdf4 100644 --- a/ApplicationLibCode/Application/RiaResultNames.cpp +++ b/ApplicationLibCode/Application/RiaResultNames.cpp @@ -493,6 +493,14 @@ QString RiaResultNames::sgcr() return "SGCR"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaResultNames::convergence() +{ + return "CNV_"; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaResultNames.h b/ApplicationLibCode/Application/RiaResultNames.h index 85abdfda1e..4280666ba5 100644 --- a/ApplicationLibCode/Application/RiaResultNames.h +++ b/ApplicationLibCode/Application/RiaResultNames.h @@ -91,6 +91,7 @@ QString swat(); QString sowcr(); QString sogcr(); QString sgcr(); +QString convergence(); // Well path derived results QString wbsAzimuthResult(); diff --git a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp index 158dda7321..c4f88f2837 100644 --- a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp @@ -27,6 +27,7 @@ #include "RiaGuiApplication.h" #include "RiaLogging.h" #include "RiaPreferencesGrid.h" +#include "RiaResultNames.h" #include "RiaViewRedrawScheduler.h" #include "RifEclipseSummaryTools.h" diff --git a/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesImpl.cpp b/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesImpl.cpp index f614b6474c..dea0d98b12 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesImpl.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicCreateDepthAdjustedLasFilesImpl.cpp @@ -20,6 +20,7 @@ #include "RicCreateDepthAdjustedLasFilesImpl.h" #include "RiaLogging.h" +#include "RiaResultNames.h" #include "RicCreateDepthAdjustedLasFilesUi.h" diff --git a/ApplicationLibCode/FileInterface/RifEclEclipseSummary.cpp b/ApplicationLibCode/FileInterface/RifEclEclipseSummary.cpp index f898aee18f..73e0032d2e 100644 --- a/ApplicationLibCode/FileInterface/RifEclEclipseSummary.cpp +++ b/ApplicationLibCode/FileInterface/RifEclEclipseSummary.cpp @@ -280,6 +280,13 @@ std::pair> RifEclEclipseSummary::values( const RifEcli int variableIndex = indexFromAddress( resultAddress ); if ( variableIndex < 0 ) return { false, {} }; + // Validate index is within bounds to prevent segfault + int nodeCount = ecl_smspec_num_nodes( m_ecl_SmSpec ); + if ( variableIndex >= nodeCount ) + { + return { false, {} }; // Invalid index - beyond available nodes + } + const ecl::smspec_node& ertSumVarNode = ecl_smspec_iget_node_w_node_index( m_ecl_SmSpec, variableIndex ); int paramsIndex = ertSumVarNode.get_params_index(); diff --git a/ApplicationLibCode/FileInterface/RifRoffFileTools.cpp b/ApplicationLibCode/FileInterface/RifRoffFileTools.cpp index 249225ba3c..69f03eeb4d 100644 --- a/ApplicationLibCode/FileInterface/RifRoffFileTools.cpp +++ b/ApplicationLibCode/FileInterface/RifRoffFileTools.cpp @@ -20,6 +20,7 @@ #include "RiaApplication.h" #include "RiaLogging.h" +#include "RiaResultNames.h" #include "RicFaciesPropertiesImportTools.h" diff --git a/ApplicationLibCode/ModelVisualization/Faults/RivReservoirFaultsPartMgr.cpp b/ApplicationLibCode/ModelVisualization/Faults/RivReservoirFaultsPartMgr.cpp index cd8570da7c..a529abf3f1 100644 --- a/ApplicationLibCode/ModelVisualization/Faults/RivReservoirFaultsPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/Faults/RivReservoirFaultsPartMgr.cpp @@ -19,6 +19,8 @@ #include "RivReservoirFaultsPartMgr.h" +#include "RiaResultNames.h" + #include "RigEclipseResultAddress.h" #include "RigMainGrid.h" #include "RigNNCData.h" diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp index 81ec2d8e61..870726cc84 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp @@ -23,6 +23,7 @@ #include "RiaDefines.h" #include "RiaFieldHandleTools.h" #include "RiaGuiApplication.h" +#include "RiaResultNames.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp index 54831923ed..c6df840402 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp @@ -20,6 +20,7 @@ #include "RiaColorTables.h" #include "RiaLogging.h" +#include "RiaResultNames.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp index d22ed8db8a..0041ddad7b 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp @@ -18,6 +18,8 @@ #include "RimSaturationPressurePlotCollection.h" +#include "RiaResultNames.h" + #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp b/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp index 8251eb5c22..f42f15fe85 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp @@ -20,6 +20,9 @@ #include "RimCellEdgeColors.h" +#include "RiaLogging.h" +#include "RiaResultNames.h" + #include "RicCreateEnsembleWellLogUi.h" #include "RigCaseCellResultsData.h" @@ -36,7 +39,6 @@ #include "cvfMath.h" -#include "RiaLogging.h" #include namespace caf diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp index 5a84385cff..041d3d188a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp @@ -27,6 +27,7 @@ #include "RiaLogging.h" #include "RiaPreferencesGrid.h" #include "RiaQDateTimeTools.h" +#include "RiaResultNames.h" #include "CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 928a20ddb8..8e4d4e81bf 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -23,6 +23,7 @@ #include "Histogram/RimGridStatisticsHistogramDataSource.h" #include "RiaLogging.h" #include "RiaQDateTimeTools.h" +#include "RiaResultNames.h" #include "RicfCommandObject.h" @@ -1425,6 +1426,8 @@ bool RimEclipseResultDefinition::isCompletionTypeSelected() const //-------------------------------------------------------------------------------------------------- bool RimEclipseResultDefinition::hasCategoryResult() const { + if ( m_resultVariable().startsWith( RiaResultNames::convergence() ) ) return false; + if ( RiaResultNames::isCategoryResult( m_resultVariable() ) ) return true; if ( auto* gridCellResults = currentGridCellResults() ) diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinitionTools.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinitionTools.cpp index 472f2fa058..7e6ded2d99 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinitionTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinitionTools.cpp @@ -21,6 +21,7 @@ #include "RiaColorTables.h" #include "RiaColorTools.h" #include "RiaLogging.h" +#include "RiaResultNames.h" #include "RigAllanDiagramData.h" #include "RigCaseCellResultsData.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp index f88d34cf7f..1f58c742e8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp @@ -25,6 +25,7 @@ #include "RiaFieldHandleTools.h" #include "RiaLogging.h" #include "RiaPreferences.h" +#include "RiaResultNames.h" #include "HoloLensCommands/RicExportToSharingServerScheduler.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp index dfeeeb75f0..6eeaab5388 100644 --- a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp @@ -18,6 +18,8 @@ #include "RimElementVectorResult.h" +#include "RiaResultNames.h" + #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimHistogramCalculator.cpp b/ApplicationLibCode/ProjectDataModel/RimHistogramCalculator.cpp index 288450657f..64e65fcb95 100644 --- a/ApplicationLibCode/ProjectDataModel/RimHistogramCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimHistogramCalculator.cpp @@ -18,6 +18,8 @@ #include "RimHistogramCalculator.h" +#include "RiaResultNames.h" + #include "ContourMap/RigContourMapProjection.h" #include "RigEclipseMultiPropertyStatCalc.h" #include "RigEclipseNativeVisibleCellsStatCalc.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp b/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp index 963d32025f..cc280d3ad5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp @@ -22,6 +22,7 @@ #include "RiaGuiApplication.h" #include "RiaLogging.h" +#include "RiaResultNames.h" #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp index 5be9c2cffd..fe8dc08f63 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp @@ -25,6 +25,7 @@ #include "RiaNumberFormat.h" #include "RiaNumericalTools.h" #include "RiaPreferences.h" +#include "RiaResultNames.h" #include "RimCellEdgeColors.h" #include "RimColorLegend.h" @@ -1221,7 +1222,7 @@ void RimRegularLegendConfig::setDefaultConfigForResultName( int caseId, const QS colorRangeType = RimRegularLegendConfig::ColorRangesType::NORMAL; } - if ( resultName.startsWith( "CNV_" ) ) + if ( resultName.startsWith( RiaResultNames::convergence() ) ) { mappingType = MappingType::LINEAR_DISCRETE; rangeType = RimLegendConfig::RangeModeType::AUTOMATIC_ALLTIMESTEPS; diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp index d7ddcd5f5b..8429184822 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelElasticPropertyCalculator.cpp @@ -20,6 +20,7 @@ #include "RiaDefines.h" #include "RiaInterpolationTools.h" #include "RiaLogging.h" +#include "RiaResultNames.h" #include "RiaStimPlanModelDefines.h" #include "RigEclipseCaseData.h" diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelLayerCalculator.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelLayerCalculator.cpp index 71990ea77f..e9dcd64295 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelLayerCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelLayerCalculator.cpp @@ -19,6 +19,7 @@ #include "RiaDefines.h" #include "RiaLogging.h" +#include "RiaResultNames.h" #include "RiaStimPlanModelDefines.h" #include "RigEclipseCaseData.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.cpp index 2cc901fc73..ef6aac6ce6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDeltaSummaryCase.cpp @@ -145,8 +145,8 @@ std::pair> RimDeltaSummaryCase::values( const RifEclip if ( *caseTimeSteps.rbegin() < timeThreshold ) { - QString txt = "Summary vector " + QString::fromStdString( resultAddress.toEclipseTextAddress() ) + - " has different time steps in the source ensembles, no values are calculated for this vector."; + QString txt = "Delta for summary vector " + QString::fromStdString( resultAddress.toEclipseTextAddress() ) + + ": One or both source realizations are incomplete, no values are calculated."; RiaLogging::warning( txt ); @@ -420,6 +420,13 @@ void RimDeltaSummaryCase::createSummaryReaderInterface() //-------------------------------------------------------------------------------------------------- RifSummaryReaderInterface* RimDeltaSummaryCase::summaryReader() { + if ( m_allResultAddresses.empty() ) + { + // Other Rim classes implementing the summaryReader() function always calls createSummaryReaderInterface() if not present. Here the + // logic must be slightly different, we check if no addresses are present. + createSummaryReaderInterface(); + } + return this; } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 4787111a16..c1ffc77d79 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -25,6 +25,7 @@ #include "RiaLogging.h" #include "RiaPlotDefines.h" #include "RiaPreferences.h" +#include "RiaResultNames.h" #include "RiaSimWellBranchTools.h" #include "RiaWellLogCurveMerger.h" diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp index 387cd54baf..c3818938e3 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp @@ -23,6 +23,7 @@ #include "RiaApplication.h" #include "RiaGuiApplication.h" #include "RiaLogging.h" +#include "RiaResultNames.h" #include "RicImportSummaryCasesFeature.h" diff --git a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake index db20bee506..5493ab803f 100644 --- a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake @@ -105,6 +105,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RigEclipseMultiPropertyStatCalc.cpp ${CMAKE_CURRENT_LIST_DIR}/RigEclipseNativeStatCalc.cpp ${CMAKE_CURRENT_LIST_DIR}/RigEclipseNativeVisibleCellsStatCalc.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultAddress.cpp ${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultInfo.cpp ${CMAKE_CURRENT_LIST_DIR}/RigElasticProperties.cpp ${CMAKE_CURRENT_LIST_DIR}/RigEnsembleFractureStatisticsCalculator.cpp diff --git a/ApplicationLibCode/ReservoirDataModel/ContourMap/RigEclipseContourMapProjection.cpp b/ApplicationLibCode/ReservoirDataModel/ContourMap/RigEclipseContourMapProjection.cpp index d0af14c3da..dd15033b25 100644 --- a/ApplicationLibCode/ReservoirDataModel/ContourMap/RigEclipseContourMapProjection.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ContourMap/RigEclipseContourMapProjection.cpp @@ -18,6 +18,8 @@ #include "RigEclipseContourMapProjection.h" +#include "RiaResultNames.h" + #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" #include "RigCell.h" diff --git a/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp b/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp index 7dd3276597..4188d167b8 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp @@ -19,6 +19,8 @@ #include "RigResultAccessorFactory.h" +#include "RiaResultNames.h" + #include "RigActiveCellInfo.h" #include "RigActiveCellsResultAccessor.h" #include "RigAllGridCellsResultAccessor.h" diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigAllanUtil.cpp b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigAllanUtil.cpp index 8941121711..5139113363 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigAllanUtil.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigAllanUtil.cpp @@ -18,6 +18,8 @@ #include "RigAllanUtil.h" +#include "RiaResultNames.h" + #include "RigAllanDiagramData.h" #include "RigCaseCellResultsData.h" #include "RigEclipseResultAddress.h" diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigCellsWithNncsCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigCellsWithNncsCalculator.cpp index b91f45f56a..10d445ef66 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigCellsWithNncsCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigCellsWithNncsCalculator.cpp @@ -18,6 +18,8 @@ #include "RigCellsWithNncsCalculator.h" +#include "RiaResultNames.h" + #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" #include "RigEclipseResultAddress.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.cpp index 1434dcd2d4..8a69716502 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.cpp @@ -19,6 +19,8 @@ #include "RigEclipseNativeStatCalc.h" +#include "RiaResultNames.h" + #include "RigCaseCellResultsData.h" #include "RigStatisticsMath.h" #include "RigWeightedMeanCalc.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp index 7248c49d17..86b050d6d5 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp @@ -19,6 +19,8 @@ #include "RigEclipseNativeVisibleCellsStatCalc.h" +#include "RiaResultNames.h" + #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" #include "RigStatisticsMath.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseResultAddress.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseResultAddress.cpp new file mode 100644 index 0000000000..7766634301 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseResultAddress.cpp @@ -0,0 +1,226 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2025 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 "RigEclipseResultAddress.h" + +#include "RiaResultNames.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigEclipseResultAddress::RigEclipseResultAddress( RiaDefines::ResultCatType type, RiaDefines::ResultDataType dataType, const QString& resultName ) + : m_resultCatType( type ) + , m_resultDataType( dataType ) + , m_resultName( resultName ) + , m_timeLapseBaseFrameIdx( NO_TIME_LAPSE ) + , m_differenceCaseId( NO_CASE_DIFF ) + , m_divideByCellFaceArea( false ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigEclipseResultAddress::RigEclipseResultAddress( RiaDefines::ResultCatType type, + const QString& resultName, + int timeLapseBaseTimeStep /*= NO_TIME_LAPSE*/, + int differenceCaseId /*= NO_CASE_DIFF*/, + bool divideByCellFaceArea /*= false */ ) + : m_resultCatType( type ) + , m_resultDataType( RiaDefines::ResultDataType::UNKNOWN ) + , m_resultName( resultName ) + , m_timeLapseBaseFrameIdx( timeLapseBaseTimeStep ) + , m_differenceCaseId( differenceCaseId ) + , m_divideByCellFaceArea( divideByCellFaceArea ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigEclipseResultAddress::RigEclipseResultAddress( const QString& resultName ) + : m_resultCatType( RiaDefines::ResultCatType::UNDEFINED ) + , m_resultDataType( RiaDefines::ResultDataType::UNKNOWN ) + , m_resultName( resultName ) + , m_timeLapseBaseFrameIdx( NO_TIME_LAPSE ) + , m_differenceCaseId( NO_CASE_DIFF ) + , m_divideByCellFaceArea( false ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigEclipseResultAddress::RigEclipseResultAddress() + : m_resultCatType( RiaDefines::ResultCatType::UNDEFINED ) + , m_resultDataType( RiaDefines::ResultDataType::UNKNOWN ) + , m_timeLapseBaseFrameIdx( NO_TIME_LAPSE ) + , m_differenceCaseId( NO_CASE_DIFF ) + , m_divideByCellFaceArea( false ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigEclipseResultAddress::isValid() const +{ + return !( m_resultName.isEmpty() || m_resultName == RiaResultNames::undefinedResultName() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigEclipseResultAddress::isDeltaTimeStepActive() const +{ + return m_timeLapseBaseFrameIdx > NO_TIME_LAPSE; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigEclipseResultAddress::setDeltaTimeStepIndex( int timeStepIndex ) +{ + m_timeLapseBaseFrameIdx = timeStepIndex; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RigEclipseResultAddress::deltaTimeStepIndex() const +{ + return m_timeLapseBaseFrameIdx; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigEclipseResultAddress::representsAllTimeLapses() const +{ + return m_timeLapseBaseFrameIdx == ALL_TIME_LAPSES; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigEclipseResultAddress::isDeltaCaseActive() const +{ + return m_differenceCaseId > NO_CASE_DIFF; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigEclipseResultAddress::setDeltaCaseId( int caseId ) +{ + m_differenceCaseId = caseId; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RigEclipseResultAddress::deltaCaseId() const +{ + return m_differenceCaseId; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigEclipseResultAddress::enableDivideByCellFaceArea( bool enable ) +{ + m_divideByCellFaceArea = enable; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigEclipseResultAddress::isDivideByCellFaceAreaActive() const +{ + return m_divideByCellFaceArea; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigEclipseResultAddress::operator<( const RigEclipseResultAddress& other ) const +{ + if ( m_divideByCellFaceArea != other.m_divideByCellFaceArea ) + { + return ( m_divideByCellFaceArea < other.m_divideByCellFaceArea ); + } + + if ( m_differenceCaseId != other.m_differenceCaseId ) + { + return ( m_differenceCaseId < other.m_differenceCaseId ); + } + + if ( m_timeLapseBaseFrameIdx != other.m_timeLapseBaseFrameIdx ) + { + return ( m_timeLapseBaseFrameIdx < other.m_timeLapseBaseFrameIdx ); + } + + if ( m_resultCatType != other.m_resultCatType ) + { + return ( m_resultCatType < other.m_resultCatType ); + } + + return ( m_resultName < other.m_resultName ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const QString& RigEclipseResultAddress::resultName() const +{ + return m_resultName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigEclipseResultAddress::setResultName( QString name ) +{ + m_resultName = name; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaDefines::ResultCatType RigEclipseResultAddress::resultCatType() const +{ + return m_resultCatType; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigEclipseResultAddress::setResultCatType( RiaDefines::ResultCatType catType ) +{ + m_resultCatType = catType; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigEclipseResultAddress::operator==( const RigEclipseResultAddress& other ) const +{ + return m_resultCatType == other.m_resultCatType && m_resultName == other.m_resultName && + m_timeLapseBaseFrameIdx == other.m_timeLapseBaseFrameIdx && m_differenceCaseId == other.m_differenceCaseId && + m_divideByCellFaceArea == other.m_divideByCellFaceArea; +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseResultAddress.h b/ApplicationLibCode/ReservoirDataModel/RigEclipseResultAddress.h index 4317509550..c0d88af535 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseResultAddress.h +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseResultAddress.h @@ -18,117 +18,51 @@ #pragma once #include "RiaDefines.h" -#include "RiaResultNames.h" #include class RigEclipseResultAddress { public: - RigEclipseResultAddress() - : m_resultCatType( RiaDefines::ResultCatType::UNDEFINED ) - , m_resultDataType( RiaDefines::ResultDataType::UNKNOWN ) - , m_timeLapseBaseFrameIdx( NO_TIME_LAPSE ) - , m_differenceCaseId( NO_CASE_DIFF ) - , m_divideByCellFaceArea( false ) - { - } - - explicit RigEclipseResultAddress( const QString& resultName ) - : m_resultCatType( RiaDefines::ResultCatType::UNDEFINED ) - , m_resultDataType( RiaDefines::ResultDataType::UNKNOWN ) - , m_resultName( resultName ) - , m_timeLapseBaseFrameIdx( NO_TIME_LAPSE ) - , m_differenceCaseId( NO_CASE_DIFF ) - , m_divideByCellFaceArea( false ) - { - } - + RigEclipseResultAddress(); + explicit RigEclipseResultAddress( const QString& resultName ); explicit RigEclipseResultAddress( RiaDefines::ResultCatType type, const QString& resultName, int timeLapseBaseTimeStep = NO_TIME_LAPSE, int differenceCaseId = NO_CASE_DIFF, - bool divideByCellFaceArea = false ) - : m_resultCatType( type ) - , m_resultDataType( RiaDefines::ResultDataType::UNKNOWN ) - , m_resultName( resultName ) - , m_timeLapseBaseFrameIdx( timeLapseBaseTimeStep ) - , m_differenceCaseId( differenceCaseId ) - , m_divideByCellFaceArea( divideByCellFaceArea ) - { - } + bool divideByCellFaceArea = false ); + explicit RigEclipseResultAddress( RiaDefines::ResultCatType type, RiaDefines::ResultDataType dataType, const QString& resultName ); - explicit RigEclipseResultAddress( RiaDefines::ResultCatType type, RiaDefines::ResultDataType dataType, const QString& resultName ) - : m_resultCatType( type ) - , m_resultDataType( dataType ) - , m_resultName( resultName ) - , m_timeLapseBaseFrameIdx( NO_TIME_LAPSE ) - , m_differenceCaseId( NO_CASE_DIFF ) - , m_divideByCellFaceArea( false ) - { - } - - bool isValid() const { return !( m_resultName.isEmpty() || m_resultName == RiaResultNames::undefinedResultName() ); } + bool isValid() const; void setDataType( RiaDefines::ResultDataType dataType ) { m_resultDataType = dataType; } RiaDefines::ResultDataType dataType() const { return m_resultDataType; } // Delta Time Step - bool isDeltaTimeStepActive() const { return m_timeLapseBaseFrameIdx > NO_TIME_LAPSE; } - void setDeltaTimeStepIndex( int timeStepIndex ) { m_timeLapseBaseFrameIdx = timeStepIndex; } - int deltaTimeStepIndex() const { return m_timeLapseBaseFrameIdx; } - bool representsAllTimeLapses() const { return m_timeLapseBaseFrameIdx == ALL_TIME_LAPSES; } + bool isDeltaTimeStepActive() const; + void setDeltaTimeStepIndex( int timeStepIndex ); + int deltaTimeStepIndex() const; + bool representsAllTimeLapses() const; static constexpr int allTimeLapsesValue() { return ALL_TIME_LAPSES; } static constexpr int noTimeLapseValue() { return NO_TIME_LAPSE; } - // Delta Grid Case - bool isDeltaCaseActive() const { return m_differenceCaseId > NO_CASE_DIFF; } - void setDeltaCaseId( int caseId ) { m_differenceCaseId = caseId; } - int deltaCaseId() const { return m_differenceCaseId; } + bool isDeltaCaseActive() const; + void setDeltaCaseId( int caseId ); + int deltaCaseId() const; static constexpr int noCaseDiffValue() { return NO_CASE_DIFF; } // Divide by Cell Face Area - void enableDivideByCellFaceArea( bool enable ) { m_divideByCellFaceArea = enable; } + void enableDivideByCellFaceArea( bool enable ); + bool isDivideByCellFaceAreaActive() const; - bool isDivideByCellFaceAreaActive() const { return m_divideByCellFaceArea; } + bool operator<( const RigEclipseResultAddress& other ) const; + bool operator==( const RigEclipseResultAddress& other ) const; - bool operator<( const RigEclipseResultAddress& other ) const - { - if ( m_divideByCellFaceArea != other.m_divideByCellFaceArea ) - { - return ( m_divideByCellFaceArea < other.m_divideByCellFaceArea ); - } + const QString& resultName() const; + void setResultName( QString name ); - if ( m_differenceCaseId != other.m_differenceCaseId ) - { - return ( m_differenceCaseId < other.m_differenceCaseId ); - } - - if ( m_timeLapseBaseFrameIdx != other.m_timeLapseBaseFrameIdx ) - { - return ( m_timeLapseBaseFrameIdx < other.m_timeLapseBaseFrameIdx ); - } - - if ( m_resultCatType != other.m_resultCatType ) - { - return ( m_resultCatType < other.m_resultCatType ); - } - - return ( m_resultName < other.m_resultName ); - } - - bool operator==( const RigEclipseResultAddress& other ) const - { - return m_resultCatType == other.m_resultCatType && m_resultName == other.m_resultName && - m_timeLapseBaseFrameIdx == other.m_timeLapseBaseFrameIdx && m_differenceCaseId == other.m_differenceCaseId && - m_divideByCellFaceArea == other.m_divideByCellFaceArea; - } - - const QString& resultName() const { return m_resultName; } - void setResultName( QString name ) { m_resultName = name; } - - RiaDefines::ResultCatType resultCatType() const { return m_resultCatType; } - void setResultCatType( RiaDefines::ResultCatType catType ) { m_resultCatType = catType; } + RiaDefines::ResultCatType resultCatType() const; + void setResultCatType( RiaDefines::ResultCatType catType ); private: RiaDefines::ResultCatType m_resultCatType; diff --git a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp index 9fe2d4d937..0be990ec1e 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp @@ -21,6 +21,7 @@ #include #include "RiaLogging.h" +#include "RiaResultNames.h" #include "RifEclipseOutputFileTools.h" #include "RifReaderEclipseOutput.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp index 4d30046f04..a15bdece52 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp @@ -19,6 +19,7 @@ #include "RigNumberOfFloodedPoreVolumesCalculator.h" #include "RiaPorosityModel.h" +#include "RiaResultNames.h" #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" @@ -32,7 +33,9 @@ #include "RimReservoirCellResultsStorage.h" #include "cafProgressInfo.h" + #include + #include //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotUpdater.cpp b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotUpdater.cpp index 7cff8d79dd..96a0d8919e 100644 --- a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotUpdater.cpp +++ b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotUpdater.cpp @@ -20,6 +20,8 @@ #include "Riu3dSelectionManager.h" #include "RiuRelativePermeabilityPlotPanel.h" +#include "RiaResultNames.h" + #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" diff --git a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp index 006a9a0535..d79bab9df3 100644 --- a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp +++ b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp @@ -19,6 +19,8 @@ #include "RiuResultTextBuilder.h" +#include "RiaResultNames.h" + #include "RigAllanDiagramData.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h"