Remove progress things that causes hang in data loading when omp is used. No need for progress feedback in here anyways.

This commit is contained in:
Jon Jenssen
2023-02-07 13:03:12 +01:00
committed by Magne Sjaastad
parent 8c91d81854
commit bf8502d09c

View File

@@ -136,23 +136,9 @@ bool transferGridCellData( RigMainGrid* mainGrid,
mainGrid->nodes().resize( nodeStartIndex + cellCount * 8, cvf::Vec3d( 0, 0, 0 ) );
int progTicks = 100;
caf::ProgressInfo progInfo( progTicks, "" );
// Loop over cells and fill them with data
#pragma omp parallel
{
int cellCountPerThread = cellCount;
#ifdef USE_OPENMP
cellCountPerThread = std::max( 1, cellCount / omp_get_num_threads() );
#endif
int computedThreadCellCount = 0;
int cellsPrProgressTick = std::max( 1, cellCountPerThread / progTicks );
int maxProgressCell = cellsPrProgressTick * progTicks;
#pragma omp for
#pragma omp parallel for
for ( int gridLocalCellIndex = 0; gridLocalCellIndex < cellCount; ++gridLocalCellIndex )
{
RigCell& cell = mainGrid->globalCellArray()[cellStartIndex + gridLocalCellIndex];
@@ -193,12 +179,7 @@ bool transferGridCellData( RigMainGrid* mainGrid,
{
double* point =
mainGrid->nodes()[nodeStartIndex + (size_t)gridLocalCellIndex * 8 + cellMappingECLRi[cIdx]].ptr();
ecl_grid_get_cell_corner_xyz1( localEclGrid,
gridLocalCellIndex,
cIdx,
&( point[0] ),
&( point[1] ),
&( point[2] ) );
ecl_grid_get_cell_corner_xyz1( localEclGrid, gridLocalCellIndex, cIdx, &( point[0] ), &( point[1] ), &( point[2] ) );
point[2] = -point[2]; // Flipping Z making depth become negative z values
cell.cornerIndices()[cIdx] = nodeStartIndex + (size_t)gridLocalCellIndex * 8 + cIdx;
}
@@ -217,20 +198,8 @@ bool transferGridCellData( RigMainGrid* mainGrid,
// if (!invalid && (cell.isInCoarseCell() || (!cell.isActiveInMatrixModel() &&
// !cell.isActiveInFractureModel()) ) )
cell.setInvalid( cell.isLongPyramidCell() );
#ifdef USE_OPENMP
if ( omp_get_thread_num() == 0 )
{
computedThreadCellCount++;
if ( computedThreadCellCount <= maxProgressCell && computedThreadCellCount % cellsPrProgressTick == 0 )
progInfo.incrementProgress();
}
#else
computedThreadCellCount++;
if ( computedThreadCellCount <= maxProgressCell && computedThreadCellCount % cellsPrProgressTick == 0 )
progInfo.incrementProgress();
#endif
}
}
return true;
}