mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 23:20:29 -05:00
#14345 Propagate LGR parent visibility for index-based data filters
The grid calculation data filter evaluated index filters (polygon, user defined) directly on every grid. An INDEX_K polygon evaluated on a fine LGR can select no cells, so refined cells whose parent host cell is inside the polygon were dropped from the aggregation. This gave a lower sum than the histogram of visible cells in the 3d view, which renders LGR cells following their parent grid cell. Hoist the parent grid visibility propagation out of the range filter branch so it also runs for index filters. Property filters are evaluated per cell against their own result values and are left untouched.
This commit is contained in:
1 parent
b62738ff8a
commit
bc9f64af92
1 file changed
+25
-21
@@ -56,8 +56,7 @@ cvf::ref<cvf::UByteArray>
|
||||
if ( filter->isRangeFilter() )
|
||||
{
|
||||
// Range filters evaluate only on their target grid. On other grids an INCLUDE filter
|
||||
// contributes no cells, while an EXCLUDE filter removes none. Cells in LGRs follow the
|
||||
// visibility of their parent grid cell, as in the filtered geometry of a 3d view.
|
||||
// contributes no cells, while an EXCLUDE filter removes none.
|
||||
const bool isTargetGrid = ( filter->gridIndex() == static_cast<int>( gridIndex ) );
|
||||
if ( isTargetGrid )
|
||||
{
|
||||
@@ -67,25 +66,6 @@ cvf::ref<cvf::UByteArray>
|
||||
{
|
||||
gridMask.setAll( !isInclude );
|
||||
}
|
||||
|
||||
if ( !grid->isMainGrid() )
|
||||
{
|
||||
auto localGrid = static_cast<const RigLocalGrid*>( grid );
|
||||
const cvf::UByteArray& parentMask = *gridMasks[localGrid->parentGrid()->gridIndex()];
|
||||
|
||||
for ( size_t localIdx = 0; localIdx < grid->cellCount(); localIdx++ )
|
||||
{
|
||||
const size_t parentCellIndex = grid->cell( localIdx ).parentCellIndex();
|
||||
if ( isInclude )
|
||||
{
|
||||
gridMask[localIdx] = gridMask[localIdx] || parentMask[parentCellIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
gridMask[localIdx] = gridMask[localIdx] && parentMask[parentCellIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -93,6 +73,30 @@ cvf::ref<cvf::UByteArray>
|
||||
filter->applyToCellVisibility( &gridMask, grid, timeStepIndex, eclipseCase );
|
||||
}
|
||||
|
||||
// Cells in LGRs follow the visibility of their parent grid cell, as in the filtered geometry
|
||||
// of a 3d view. Geometry based filters (range and index, e.g. an INDEX_K polygon) can fail to
|
||||
// select the refined cells directly on a fine LGR, so propagate the parent grid visibility.
|
||||
// Property filters evaluate each cell against its own result value and must be left untouched.
|
||||
const bool isGeometryFilter = filter->isRangeFilter() || filter->isIndexFilter();
|
||||
if ( isGeometryFilter && !grid->isMainGrid() )
|
||||
{
|
||||
auto localGrid = static_cast<const RigLocalGrid*>( grid );
|
||||
const cvf::UByteArray& parentMask = *gridMasks[localGrid->parentGrid()->gridIndex()];
|
||||
|
||||
for ( size_t localIdx = 0; localIdx < grid->cellCount(); localIdx++ )
|
||||
{
|
||||
const size_t parentCellIndex = grid->cell( localIdx ).parentCellIndex();
|
||||
if ( isInclude )
|
||||
{
|
||||
gridMask[localIdx] = gridMask[localIdx] || parentMask[parentCellIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
gridMask[localIdx] = gridMask[localIdx] && parentMask[parentCellIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ( size_t localIdx = 0; localIdx < grid->cellCount(); localIdx++ )
|
||||
{
|
||||
reservoirVisibility->set( grid->reservoirCellIndex( localIdx ), gridMask[localIdx] );
|
||||
|
||||
Reference in new issue
Block a user