Skip to content

Commit

Permalink
Make sure we only loop over active grids local cells when calculating…
Browse files Browse the repository at this point in the history
… visibility
  • Loading branch information
jonjenssen authored and magnesj committed Nov 22, 2024
1 parent db20065 commit 036ed8b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -604,11 +604,11 @@ void RivReservoirViewPartMgr::computeNativeVisibility( cvf::UByteArray*

if ( auto activeGrid = dynamic_cast<const RigActiveCellGrid*>( grid ) )
{
auto reservoirIndices = activeGrid->activeReservoirCellIndices();
auto cellIndices = activeGrid->activeLocalCellIndices();
#pragma omp parallel for
for ( int i = 0; i < static_cast<int>( reservoirIndices.size() ); i++ )
for ( int i = 0; i < static_cast<int>( cellIndices.size() ); i++ )
{
size_t cellIndex = reservoirIndices[i];
size_t cellIndex = cellIndices[i];

if ( ( !activeCellsIsVisible ) || ( *cellIsInWellStatuses )[cellIndex] )
{
Expand Down
6 changes: 4 additions & 2 deletions ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,16 @@ size_t RigActiveCellGrid::totalActiveCellCount() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<size_t> RigActiveCellGrid::activeReservoirCellIndices() const
std::vector<size_t> RigActiveCellGrid::activeLocalCellIndices() const
{
std::vector<size_t> indices;
indices.reserve( m_nativeCells.size() );
const auto maxCellIdx = cellCount();

for ( const auto& [index, cell] : m_nativeCells )
{
indices.emplace_back( index );
// only add cells indexes that belongs to our grid, not subgrids
if ( index < maxCellIdx ) indices.emplace_back( index );
}

return indices;
Expand Down
2 changes: 1 addition & 1 deletion ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class RigActiveCellGrid : public RigMainGrid
size_t totalCellCount() const override;
size_t totalActiveCellCount() const;

std::vector<size_t> activeReservoirCellIndices() const;
std::vector<size_t> activeLocalCellIndices() const;

protected: // only for use by file readers!
friend class RifReaderOpmCommonActive;
Expand Down

0 comments on commit 036ed8b

Please sign in to comment.