Well target updates (#14619)

Support well target mapping calculations for ensembles.
This commit is contained in:
JJ authored and GitHub committed 2026-08-28 13:36:02 +02:00
1 parent 04be720491
commit 75ebd7f20b
19 files changed
+248 -81

No files matched your search

@@ -614,6 +614,11 @@ void RimStatisticsContourMap::onComputeStatisticsClicked()
void RimStatisticsContourMap::computeStatistics()
{
computeStatisticsForMaps( { this } );
if ( auto ensemble = firstAncestorOrThisOfType<RimReservoirGridEnsemble>() )
{
ensemble->reloadMetaDataIfNeeded();
}
}
//--------------------------------------------------------------------------------------------------
@@ -682,7 +687,7 @@ void RimStatisticsContourMap::computeStatisticsForMaps( const std::vector<RimSta
// The bounding box is empty unless the primary case is open with active cell info
cvf::BoundingBox gridBoundingBox = primaryCase->activeCellsBoundingBox();
gridBoundingBox.expandPercent( map->m_boundingBoxExpPercent() );
gridBoundingBox.expandPercent( map->m_boundingBoxExpPercent(), map->m_boundingBoxExpPercent() );
double sampleSpacing = 1.0;
if ( auto mainGrid = primaryCase->mainGrid() ) sampleSpacing = map->sampleSpacingFactor() * mainGrid->characteristicIJCellSize();
@@ -722,12 +727,7 @@ void RimStatisticsContourMap::computeStatisticsForMaps( const std::vector<RimSta
RiaLogging::info( std::format( "Computing statistics for {} ensemble contour map(s)", contexts.size() ) );
// All maps belong to the same ensemble, so the realization cases are shared
auto cases = contexts.front().map->ensembleCases();
auto casesInViews = contexts.front().map->ensembleCasesInViews();
std::set<RimEclipseCase*> primaryCases;
for ( const auto& ctx : contexts )
primaryCases.insert( ctx.map->eclipseCase() );
auto cases = contexts.front().map->ensembleCases();
const size_t nCases = cases.size();
caf::ProgressInfo progInfo( nCases, QString( "Reading Eclipse Ensemble" ) );
@@ -739,6 +739,8 @@ void RimStatisticsContourMap::computeStatisticsForMaps( const std::vector<RimSta
{
auto task = progInfo.task( QString( "Processing Case %1 of %2" ).arg( i++ ).arg( nCases ) );
bool closeCase = !eCase->isReservoirCaseOpen();
RifReaderSettings oldSettings = eCase->readerSettings();
eCase->setReaderSettings( readerSettings );
@@ -796,7 +798,7 @@ void RimStatisticsContourMap::computeStatisticsForMaps( const std::vector<RimSta
// Release the grid data for cases that were opened only to compute statistics. A case is kept open if it has
// its own views, if it is the primary case of one of the contour maps, or if it is displayed in one of the
// ensemble views.
if ( eCase->views().empty() && !primaryCases.contains( eCase ) && !casesInViews.contains( eCase ) )
if ( closeCase )
{
eCase->closeReservoirCase();
}
@@ -981,6 +983,12 @@ void RimStatisticsContourMap::ensureResultsComputed()
}
computeStatisticsForMaps( maps );
// contour map calculations on shared grids clears the ensemble meta data, reload it
if ( auto ensemble = firstAncestorOrThisOfType<RimReservoirGridEnsemble>() )
{
ensemble->reloadMetaDataIfNeeded();
}
}
//--------------------------------------------------------------------------------------------------