From 944d733875a475dee96789f5fbefe0544a62ff40 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 20 Dec 2024 11:06:28 +0100 Subject: [PATCH 1/4] Janitor: select newly created well target candidates generator. --- .../RicNewWellTargetCandidatesGeneratorFeature.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/Commands/RicNewWellTargetCandidatesGeneratorFeature.cpp b/ApplicationLibCode/Commands/RicNewWellTargetCandidatesGeneratorFeature.cpp index 77d0875b5f..f1c678693a 100644 --- a/ApplicationLibCode/Commands/RicNewWellTargetCandidatesGeneratorFeature.cpp +++ b/ApplicationLibCode/Commands/RicNewWellTargetCandidatesGeneratorFeature.cpp @@ -21,6 +21,8 @@ #include "RimEclipseCaseEnsemble.h" #include "RimWellTargetCandidatesGenerator.h" +#include "RiuMainWindow.h" + #include "cafSelectionManagerTools.h" #include @@ -35,9 +37,13 @@ void RicNewWellTargetCandidatesGeneratorFeature::onActionTriggered( bool isCheck auto ensembles = caf::selectedObjectsByTypeStrict(); if ( ensembles.empty() ) return; - auto ensemble = ensembles.front(); - ensemble->addWellTargetsGenerator( new RimWellTargetCandidatesGenerator() ); + auto ensemble = ensembles.front(); + auto generator = new RimWellTargetCandidatesGenerator(); + ensemble->addWellTargetsGenerator( generator ); + ensemble->updateConnectedEditors(); + + RiuMainWindow::instance()->selectAsCurrentItem( generator ); } //-------------------------------------------------------------------------------------------------- From 2f76412017f7b3adaf5295f0a29a7f78ee9e3e9c Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 20 Dec 2024 11:11:36 +0100 Subject: [PATCH 2/4] #12005 Well Target Candidates: Move ensemble grid under generator in Project Tree --- .../RimWellTargetCandidatesGenerator.cpp | 15 ++++++--------- .../RimWellTargetCandidatesGenerator.h | 2 ++ .../Well/RigWellTargetCandidatesGenerator.cpp | 6 +++--- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp index 8c59280f27..62011ba881 100644 --- a/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp @@ -35,8 +35,6 @@ #include "RimEclipseCellColors.h" #include "RimEclipseResultDefinition.h" #include "RimEclipseView.h" -#include "RimOilField.h" -#include "RimProject.h" #include "RimRegularGridCase.h" #include "RimTools.h" @@ -123,6 +121,8 @@ RimWellTargetCandidatesGenerator::RimWellTargetCandidatesGenerator() CAF_PDM_InitField( &m_generateEnsembleStatistics, "GenerateEnsembleStatistics", true, "Generate Ensemble Statistics" ); caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &m_generateEnsembleStatistics ); + CAF_PDM_InitFieldNoDefault( &m_ensembleStatisticsCase, "EnsembleStatisticsCase", "Ensemble Statistics Case" ); + m_minimumVolume = cvf::UNDEFINED_DOUBLE; m_maximumVolume = cvf::UNDEFINED_DOUBLE; @@ -326,17 +326,14 @@ void RimWellTargetCandidatesGenerator::generateEnsembleStatistics() m_volumeResultType(), limits ); - RimProject* project = RimProject::current(); - if ( !project ) return; - - RimEclipseCaseCollection* analysisModels = project->activeOilField() ? project->activeOilField()->analysisModels() : nullptr; - if ( !analysisModels ) return; + regularGridCase->setCustomCaseName( "Ensemble Grid" ); - analysisModels->cases.push_back( regularGridCase ); + m_ensembleStatisticsCase = regularGridCase; auto eclipseView = regularGridCase->createAndAddReservoirView(); eclipseView->cellResult()->setResultType( RiaDefines::ResultCatType::GENERATED ); + eclipseView->cellResult()->setResultVariable( "TOTAL_PORV_SOIL_P10" ); if ( RiaGuiApplication::isRunning() || RiuMainWindow::instance() ) { @@ -345,7 +342,7 @@ void RimWellTargetCandidatesGenerator::generateEnsembleStatistics() eclipseView->loadDataAndUpdate(); - analysisModels->updateConnectedEditors(); + m_ensembleStatisticsCase->updateConnectedEditors(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h index 1d012956da..2b3d0901e6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h +++ b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h @@ -81,6 +81,8 @@ class RimWellTargetCandidatesGenerator : public caf::PdmObject caf::PdmField m_generateEnsembleStatistics; + caf::PdmChildField m_ensembleStatisticsCase; + double m_minimumVolume; double m_maximumVolume; diff --git a/ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.cpp index 23a822d413..b533079c3f 100644 --- a/ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.cpp @@ -882,7 +882,7 @@ void RigWellTargetCandidatesGenerator::accumulateResultsForSingleCase( RimEclips std::map*> namedInputVector; - for ( auto [resultName, vec] : resultNamesAndSamples ) + for ( const auto& [resultName, vec] : resultNamesAndSamples ) { RigEclipseResultAddress resultAddress( RiaDefines::ResultCatType::GENERATED, resultName ); resultsData->ensureKnownResultLoaded( resultAddress ); @@ -891,7 +891,7 @@ void RigWellTargetCandidatesGenerator::accumulateResultsForSingleCase( RimEclips } std::map> namedOutputVector; - for ( auto [resultName, vec] : resultNamesAndSamples ) + for ( const auto& [resultName, vec] : resultNamesAndSamples ) { namedOutputVector[resultName] = std::vector( targetNumActiveCells, std::numeric_limits::infinity() ); } @@ -918,7 +918,7 @@ void RigWellTargetCandidatesGenerator::accumulateResultsForSingleCase( RimEclips } } - for ( auto [resultName, vec] : resultNamesAndSamples ) + for ( const auto& [resultName, vec] : resultNamesAndSamples ) { resultNamesAndSamples[resultName].push_back( namedOutputVector[resultName] ); } From b92109f0ab6ed86966aadabf6195346827134564 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 20 Dec 2024 13:13:31 +0100 Subject: [PATCH 3/4] Add well target generator cases to RimProject::allCases. --- .../ProjectDataModel/RimEclipseCaseEnsemble.cpp | 8 ++++++++ .../ProjectDataModel/RimEclipseCaseEnsemble.h | 3 ++- ApplicationLibCode/ProjectDataModel/RimProject.cpp | 6 ++++++ .../ProjectDataModel/RimWellTargetCandidatesGenerator.cpp | 8 ++++++++ .../ProjectDataModel/RimWellTargetCandidatesGenerator.h | 2 ++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.cpp index bf9f87f908..859c2cd878 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.cpp @@ -116,6 +116,14 @@ std::vector RimEclipseCaseEnsemble::cases() const return m_caseCollection->reservoirs.childrenByType(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimEclipseCaseEnsemble::wellTargetsGenerators() const +{ + return m_wellTargetGenerators.childrenByType(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.h b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.h index ffdefeee53..1d70889c55 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseEnsemble.h @@ -56,7 +56,8 @@ class RimEclipseCaseEnsemble : public RimNamedObject RimEclipseViewCollection* viewCollection() const; - void addWellTargetsGenerator( RimWellTargetCandidatesGenerator* generator ); + void addWellTargetsGenerator( RimWellTargetCandidatesGenerator* generator ); + std::vector wellTargetsGenerators() const; void addStatisticsContourMap( RimStatisticsContourMap* statisticsContourMap ); diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 084e723e6b..7987f8aa16 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -102,6 +102,7 @@ #include "RimWellPath.h" #include "RimWellPathCollection.h" +#include "RimWellTargetCandidatesGenerator.h" #include "VerticalFlowPerformance/RimVfpDataCollection.h" #include "VerticalFlowPerformance/RimVfpPlotCollection.h" @@ -605,6 +606,11 @@ std::vector RimProject::allGridCases() const { cases.push_back( acase ); } + + for ( RimWellTargetCandidatesGenerator* generator : ensemble->wellTargetsGenerators() ) + { + if ( auto ensembleStatisticsCase = generator->ensembleStatisticsCase() ) cases.push_back( ensembleStatisticsCase ); + } } RimGeoMechModels* geomModels = oilField->geoMechModels(); diff --git a/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp index 62011ba881..10d8f6bbdc 100644 --- a/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.cpp @@ -423,3 +423,11 @@ void RimWellTargetCandidatesGenerator::updateResultDefinition() RimEclipseCase* eclipseCase = firstCase(); if ( eclipseCase ) m_resultDefinition->setEclipseCase( eclipseCase ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEclipseCase* RimWellTargetCandidatesGenerator::ensembleStatisticsCase() const +{ + return m_ensembleStatisticsCase; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h index 2b3d0901e6..c47fb01b5e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h +++ b/ApplicationLibCode/ProjectDataModel/RimWellTargetCandidatesGenerator.h @@ -42,6 +42,8 @@ class RimWellTargetCandidatesGenerator : public caf::PdmObject void updateResultDefinition(); + RimEclipseCase* ensembleStatisticsCase() const; + protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; From 13dac37a824239782972a63aeb38a8930c91c200 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 20 Dec 2024 16:00:46 +0100 Subject: [PATCH 4/4] Make sure cached data is computed Without this, the bounding box of the case is undefined, causing the polygons lines not to be visible. --- .../ProjectDataModel/RimRegularGridCase.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimRegularGridCase.cpp b/ApplicationLibCode/ProjectDataModel/RimRegularGridCase.cpp index 18508dbba8..b7d2cc964d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRegularGridCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimRegularGridCase.cpp @@ -82,6 +82,7 @@ cvf::ref RimRegularGridCase::createModel( QString modelName reader->open( "", reservoir.p() ); setReservoirData( reservoir.p() ); + computeCachedData(); return reader.p(); } @@ -93,12 +94,7 @@ bool RimRegularGridCase::openEclipseGridFile() { if ( eclipseCaseData() ) return true; - auto readerInterface = createModel( "" ); - - results( RiaDefines::PorosityModelType::MATRIX_MODEL )->setReaderInterface( readerInterface.p() ); - results( RiaDefines::PorosityModelType::FRACTURE_MODEL )->setReaderInterface( readerInterface.p() ); - - computeCachedData(); + createModel( "" ); return true; }