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] ); }