Avoid overflowing the progress counter in the import of Eclipse grids

This commit is contained in:
Gaute Lindkvist 2020-02-04 11:20:32 +01:00
parent 752cf9925c
commit 02a2820d29

View File

@ -133,6 +133,7 @@ bool transferGridCellData( RigMainGrid* mainGrid,
int progTicks = 100;
int cellsPrProgressTick = std::max( 1, cellCount / progTicks );
size_t maxProgressCell = static_cast<size_t>( cellsPrProgressTick * progTicks );
caf::ProgressInfo progInfo( progTicks, "" );
size_t computedCellCount = 0;
@ -205,7 +206,8 @@ bool transferGridCellData( RigMainGrid* mainGrid,
#pragma omp critical
{
computedCellCount++;
if ( computedCellCount % cellsPrProgressTick == 0 ) progInfo.incrementProgress();
if ( computedCellCount <= maxProgressCell && computedCellCount % cellsPrProgressTick == 0 )
progInfo.incrementProgress();
}
}
return true;