mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-28 01:41:42 -06:00
Privatize grid cell array
This commit is contained in:
parent
69878f54d3
commit
88118ee4e1
@ -694,7 +694,7 @@ void RicWellPathExportMswCompletionsImpl::generateFishbonesMswExportInfo( const
|
||||
for ( auto intersectionIndex : indices )
|
||||
{
|
||||
auto intersection = filteredIntersections[intersectionIndex];
|
||||
if ( intersection.globCellIndex >= mainGrid->globalCellArray().size() ) continue;
|
||||
if ( intersection.globCellIndex >= mainGrid->totalCellCount() ) continue;
|
||||
|
||||
size_t localGridCellIndex = 0u;
|
||||
const RigGridBase* localGrid =
|
||||
|
@ -190,7 +190,7 @@ void RicCreateTemporaryLgrFeature::setupActionLook( QAction* actionToSetup )
|
||||
void RicCreateTemporaryLgrFeature::createLgr( const LgrInfo& lgrInfo, RigMainGrid* mainGrid )
|
||||
{
|
||||
int lgrId = lgrInfo.id;
|
||||
size_t totalCellCount = mainGrid->globalCellArray().size();
|
||||
size_t totalCellCount = mainGrid->totalCellCount();
|
||||
size_t lgrCellCount = lgrInfo.cellCount();
|
||||
|
||||
// Create local grid and set properties
|
||||
@ -203,14 +203,14 @@ void RicCreateTemporaryLgrFeature::createLgr( const LgrInfo& lgrInfo, RigMainGri
|
||||
localGrid->setGridPointDimensions( cvf::Vec3st( lgrInfo.sizes.i() + 1, lgrInfo.sizes.j() + 1, lgrInfo.sizes.k() + 1 ) );
|
||||
mainGrid->addLocalGrid( localGrid );
|
||||
|
||||
size_t cellStartIndex = mainGrid->globalCellArray().size();
|
||||
size_t cellStartIndex = mainGrid->totalCellCount();
|
||||
size_t nodeStartIndex = mainGrid->nodes().size();
|
||||
|
||||
// Resize global cell and node arrays
|
||||
{
|
||||
RigCell defaultCell;
|
||||
defaultCell.setHostGrid( localGrid );
|
||||
mainGrid->globalCellArray().resize( cellStartIndex + lgrCellCount, defaultCell );
|
||||
mainGrid->reservoirCells().resize( cellStartIndex + lgrCellCount, defaultCell );
|
||||
mainGrid->nodes().resize( nodeStartIndex + lgrCellCount * 8, cvf::Vec3d( 0, 0, 0 ) );
|
||||
}
|
||||
|
||||
@ -231,10 +231,10 @@ void RicCreateTemporaryLgrFeature::createLgr( const LgrInfo& lgrInfo, RigMainGri
|
||||
size_t mainI = lgrInfo.mainGridStartCell.i() + lgrI / lgrSizePerMainCell.i();
|
||||
|
||||
size_t mainCellIndex = mainGrid->cellIndexFromIJK( mainI, mainJ, mainK );
|
||||
auto& mainGridCell = mainGrid->globalCellArray()[mainCellIndex];
|
||||
auto& mainGridCell = mainGrid->cell( mainCellIndex );
|
||||
mainGridCell.setSubGrid( localGrid );
|
||||
|
||||
RigCell& cell = mainGrid->globalCellArray()[cellStartIndex + gridLocalCellIndex];
|
||||
RigCell& cell = mainGrid->cell( cellStartIndex + gridLocalCellIndex );
|
||||
cell.setGridLocalCellIndex( gridLocalCellIndex );
|
||||
cell.setParentCellIndex( mainCellIndex );
|
||||
|
||||
|
@ -668,7 +668,7 @@ bool RifEclipseOutputFileTools::assignActiveCellData( std::vector<std::vector<in
|
||||
}
|
||||
|
||||
// Check if number of cells is matching
|
||||
if ( eclipseCaseData->mainGrid()->globalCellArray().size() != reservoirCellCount )
|
||||
if ( eclipseCaseData->mainGrid()->reservoirCells().size() != reservoirCellCount )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -161,12 +161,12 @@ bool RifReaderEclipseOutput::transferGridCellData( RigMainGrid* mainGrid
|
||||
CVF_ASSERT( activeCellInfo && fractureActiveCellInfo );
|
||||
|
||||
int cellCount = ecl_grid_get_global_size( localEclGrid );
|
||||
size_t cellStartIndex = mainGrid->globalCellArray().size();
|
||||
size_t cellStartIndex = mainGrid->reservoirCells().size();
|
||||
size_t nodeStartIndex = mainGrid->nodes().size();
|
||||
|
||||
RigCell defaultCell;
|
||||
defaultCell.setHostGrid( localGrid );
|
||||
mainGrid->globalCellArray().resize( cellStartIndex + cellCount, defaultCell );
|
||||
mainGrid->reservoirCells().resize( cellStartIndex + cellCount, defaultCell );
|
||||
|
||||
mainGrid->nodes().resize( nodeStartIndex + cellCount * 8, cvf::Vec3d( 0, 0, 0 ) );
|
||||
|
||||
@ -175,7 +175,7 @@ bool RifReaderEclipseOutput::transferGridCellData( RigMainGrid* mainGrid
|
||||
#pragma omp parallel for
|
||||
for ( int gridLocalCellIndex = 0; gridLocalCellIndex < cellCount; ++gridLocalCellIndex )
|
||||
{
|
||||
RigCell& cell = mainGrid->globalCellArray()[cellStartIndex + gridLocalCellIndex];
|
||||
RigCell& cell = mainGrid->cell( cellStartIndex + gridLocalCellIndex );
|
||||
|
||||
cell.setGridLocalCellIndex( gridLocalCellIndex );
|
||||
|
||||
@ -303,7 +303,7 @@ bool RifReaderEclipseOutput::transferGeometry( const ecl_grid_type* mainEclGrid,
|
||||
|
||||
// Reserve room for the cells and nodes and fill them with data
|
||||
|
||||
mainGrid->globalCellArray().reserve( totalCellCount );
|
||||
mainGrid->reservoirCells().reserve( totalCellCount );
|
||||
mainGrid->nodes().reserve( 8 * totalCellCount );
|
||||
|
||||
caf::ProgressInfo progInfo( 3 + numLGRs, "" );
|
||||
|
@ -197,7 +197,7 @@ bool RifReaderOpmCommon::importGrid( RigMainGrid* mainGrid, RigEclipseCaseData*
|
||||
activeCellInfo->setReservoirCellCount( totalCellCount );
|
||||
fractureActiveCellInfo->setReservoirCellCount( totalCellCount );
|
||||
|
||||
mainGrid->globalCellArray().reserve( (size_t)totalCellCount );
|
||||
mainGrid->reservoirCells().reserve( (size_t)totalCellCount );
|
||||
mainGrid->nodes().reserve( (size_t)totalCellCount * 8 );
|
||||
|
||||
activeCellInfo->setGridCount( 1 + numLGRs );
|
||||
@ -411,7 +411,7 @@ void RifReaderOpmCommon::transferGeometry( Opm::EclIO::EGrid& opmMainGrid,
|
||||
RigEclipseCaseData* eclipseCaseData )
|
||||
{
|
||||
int cellCount = opmGrid.totalNumberOfCells();
|
||||
size_t cellStartIndex = mainGrid->globalCellArray().size();
|
||||
size_t cellStartIndex = mainGrid->reservoirCells().size();
|
||||
size_t nodeStartIndex = mainGrid->nodes().size();
|
||||
|
||||
const bool invalidateLongPyramidCells = invalidateLongThinCells();
|
||||
@ -419,7 +419,7 @@ void RifReaderOpmCommon::transferGeometry( Opm::EclIO::EGrid& opmMainGrid,
|
||||
RigCell defaultCell;
|
||||
defaultCell.setHostGrid( localGrid );
|
||||
|
||||
mainGrid->globalCellArray().resize( cellStartIndex + cellCount, defaultCell );
|
||||
mainGrid->reservoirCells().resize( cellStartIndex + cellCount, defaultCell );
|
||||
|
||||
mainGrid->nodes().resize( nodeStartIndex + cellCount * 8, cvf::Vec3d( 0, 0, 0 ) );
|
||||
|
||||
@ -456,7 +456,7 @@ void RifReaderOpmCommon::transferGeometry( Opm::EclIO::EGrid& opmMainGrid,
|
||||
}
|
||||
|
||||
auto riReservoirIndex = localGrid->cellIndexFromIJK( opmIJK[0], opmIJK[1], opmIJK[2] );
|
||||
RigCell& cell = mainGrid->globalCellArray()[cellStartIndex + riReservoirIndex];
|
||||
RigCell& cell = mainGrid->cell( cellStartIndex + riReservoirIndex );
|
||||
cell.setGridLocalCellIndex( riReservoirIndex );
|
||||
|
||||
// parent cell index
|
||||
|
@ -99,15 +99,25 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips
|
||||
localGrid->setGridPointDimensions( cvf::Vec3st( lgrDims[0] + 1, lgrDims[1] + 1, lgrDims[2] + 1 ) );
|
||||
localGrid->setGridId( lgrIdx + 1 );
|
||||
localGrid->setGridName( lgr_names[lgrIdx] );
|
||||
localGrid->setIndexToGlobalStartOfCells( totalCellCount );
|
||||
localGrid->setIndexToStartOfCells( totalCellCount );
|
||||
activeGrid->addLocalGrid( localGrid );
|
||||
|
||||
totalCellCount += lgrGrids[lgrIdx].totalNumberOfCells();
|
||||
totalNativeCellCount += lgrGrids[lgrIdx].totalActiveCells() + 1;
|
||||
}
|
||||
|
||||
activeGrid->setTotalCellCount( totalCellCount );
|
||||
|
||||
// active cell information
|
||||
{
|
||||
RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
RigActiveCellInfo* fractureActiveCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::FRACTURE_MODEL );
|
||||
|
||||
activeCellInfo->setReservoirCellCount( totalCellCount );
|
||||
fractureActiveCellInfo->setReservoirCellCount( totalCellCount );
|
||||
activeCellInfo->setGridCount( 1 + numLGRs );
|
||||
fractureActiveCellInfo->setGridCount( 1 + numLGRs );
|
||||
|
||||
auto task = progInfo.task( "Getting Active Cell Information", 1 );
|
||||
|
||||
for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ )
|
||||
@ -122,29 +132,28 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips
|
||||
updateActiveCellInfo( eclipseCaseData, opmGrid, lgrGrids, activeGrid );
|
||||
}
|
||||
|
||||
size_t anInactiveCellIndex = activeGrid->transferActiveInformation( 0,
|
||||
eclipseCaseData,
|
||||
opmGrid.totalActiveCells(),
|
||||
opmGrid.activeCells(),
|
||||
opmGrid.activeFracCells(),
|
||||
opmGrid.active_indexes(),
|
||||
opmGrid.active_frac_indexes(),
|
||||
0 );
|
||||
globalMatrixActiveSize = opmGrid.activeCells();
|
||||
globalFractureActiveSize = opmGrid.activeFracCells();
|
||||
|
||||
activeCellInfo->setGridActiveCellCounts( 0, globalMatrixActiveSize );
|
||||
fractureActiveCellInfo->setGridActiveCellCounts( 0, globalFractureActiveSize );
|
||||
|
||||
transferActiveCells( opmGrid, 0, eclipseCaseData, 0, 0 );
|
||||
size_t cellCount = opmGrid.totalNumberOfCells();
|
||||
|
||||
for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ )
|
||||
{
|
||||
activeGrid->transferActiveInformation( lgrIdx + 1,
|
||||
eclipseCaseData,
|
||||
lgrGrids[lgrIdx].totalActiveCells(),
|
||||
lgrGrids[lgrIdx].activeCells(),
|
||||
lgrGrids[lgrIdx].activeFracCells(),
|
||||
lgrGrids[lgrIdx].active_indexes(),
|
||||
lgrGrids[lgrIdx].active_frac_indexes(),
|
||||
anInactiveCellIndex );
|
||||
auto& lgrGrid = lgrGrids[lgrIdx];
|
||||
transferActiveCells( lgrGrid, cellCount, eclipseCaseData, globalMatrixActiveSize, globalFractureActiveSize );
|
||||
cellCount += lgrGrid.totalNumberOfCells();
|
||||
globalMatrixActiveSize += lgrGrid.activeCells();
|
||||
globalFractureActiveSize += lgrGrid.activeFracCells();
|
||||
activeCellInfo->setGridActiveCellCounts( lgrIdx + 1, lgrGrid.activeCells() );
|
||||
fractureActiveCellInfo->setGridActiveCellCounts( lgrIdx + 1, lgrGrid.activeFracCells() );
|
||||
}
|
||||
|
||||
eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL )->computeDerivedData();
|
||||
eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::FRACTURE_MODEL )->computeDerivedData();
|
||||
activeCellInfo->computeDerivedData();
|
||||
fractureActiveCellInfo->computeDerivedData();
|
||||
}
|
||||
|
||||
// grid geometry
|
||||
@ -158,7 +167,7 @@ bool RifReaderOpmCommonActive::importGrid( RigMainGrid* /* mainGrid*/, RigEclips
|
||||
|
||||
bool hasParentInfo = ( lgr_parent_names.size() >= (size_t)numLGRs );
|
||||
|
||||
auto task = progInfo.task( "Loading Active Cell LGR Grid Geometry ", 1 );
|
||||
auto task2 = progInfo.task( "Loading Active Cell LGR Grid Geometry ", 1 );
|
||||
|
||||
for ( int lgrIdx = 0; lgrIdx < numLGRs; lgrIdx++ )
|
||||
{
|
||||
@ -328,12 +337,11 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa
|
||||
for ( size_t i = 0; i < 8; i++ )
|
||||
defaultCell.cornerIndices()[i] = 0;
|
||||
|
||||
const auto newCellCount = cellStartIndex + cellCount + 1;
|
||||
activeGrid->reservoirCells().resize( newCellCount, defaultCell );
|
||||
activeGrid->reservoirCells()[newCellCount - 1].setInvalid( true );
|
||||
activeGrid->nodes().resize( (newCellCount)*8, cvf::Vec3d( 0, 0, 0 ) );
|
||||
const auto newNodeCount = nodeStartIndex + 8 * cellCount;
|
||||
activeGrid->nodes().resize( newNodeCount, cvf::Vec3d( 0, 0, 0 ) );
|
||||
|
||||
auto& riNodes = activeGrid->nodes();
|
||||
auto& riCells = activeGrid->nativeCells();
|
||||
|
||||
opmGrid.loadData();
|
||||
opmGrid.load_grid_data();
|
||||
@ -351,6 +359,20 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa
|
||||
// use same mapping as resdata
|
||||
const size_t cellMappingECLRi[8] = { 0, 1, 3, 2, 4, 5, 7, 6 };
|
||||
|
||||
std::map<int, int> activeCellMap;
|
||||
int nativeIdx = 0;
|
||||
|
||||
// non-parallell loop to set up and initialize things so that we can run in parallell later
|
||||
for ( int opmCellIndex = 0; opmCellIndex < static_cast<int>( opmGrid.totalNumberOfCells() ); opmCellIndex++ )
|
||||
{
|
||||
if ( ( activeMatIndexes[opmCellIndex] < 0 ) && ( activeFracIndexes[opmCellIndex] < 0 ) ) continue;
|
||||
|
||||
auto opmIJK = opmGrid.ijk_from_global_index( opmCellIndex );
|
||||
auto localIndex = localGrid->cellIndexFromIJK( opmIJK[0], opmIJK[1], opmIJK[2] );
|
||||
riCells[cellStartIndex + localIndex] = defaultCell;
|
||||
activeCellMap[opmCellIndex] = nativeIdx++;
|
||||
}
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int opmCellIndex = 0; opmCellIndex < static_cast<int>( opmGrid.totalNumberOfCells() ); opmCellIndex++ )
|
||||
{
|
||||
@ -368,9 +390,9 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa
|
||||
yCenterCoordOpm = yCenter;
|
||||
}
|
||||
|
||||
auto nativeIndex = activeGrid->cellIndexFromIJK( opmIJK[0], opmIJK[1], opmIJK[2] );
|
||||
RigCell& cell = activeGrid->nativeCell( cellStartIndex + nativeIndex );
|
||||
cell.setGridLocalCellIndex( nativeIndex );
|
||||
auto localIndex = localGrid->cellIndexFromIJK( opmIJK[0], opmIJK[1], opmIJK[2] );
|
||||
RigCell& cell = riCells[cellStartIndex + localIndex];
|
||||
cell.setGridLocalCellIndex( localIndex );
|
||||
|
||||
// parent cell index
|
||||
if ( ( hostCellGlobalIndices.size() > (size_t)opmCellIndex ) && hostCellGlobalIndices[opmCellIndex] >= 0 )
|
||||
@ -389,7 +411,8 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa
|
||||
opmGrid.getCellCorners( opmCellIndex, opmX, opmY, opmZ );
|
||||
|
||||
// Each cell has 8 nodes, use active cell index and multiply to find first node index for cell
|
||||
auto riNodeStartIndex = nodeStartIndex + nativeIndex * 8;
|
||||
auto localNodeIndex = activeCellMap[opmCellIndex] * 8;
|
||||
auto riNodeStartIndex = nodeStartIndex + localNodeIndex;
|
||||
|
||||
for ( size_t opmNodeIndex = 0; opmNodeIndex < 8; opmNodeIndex++ )
|
||||
{
|
||||
@ -425,6 +448,4 @@ void RifReaderOpmCommonActive::transferActiveGeometry( Opm::EclIO::EGrid& opmMa
|
||||
cell.setInvalid( cell.isLongPyramidCell() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( riNodes.size() > 1 ) riNodes[riNodes.size() - 1] = riNodes[0];
|
||||
}
|
||||
|
@ -188,19 +188,19 @@ bool RifRoffFileTools::openGridFile( const QString& fileName, RigEclipseCaseData
|
||||
fractureActiveCellInfo->setReservoirCellCount( totalCellCount );
|
||||
|
||||
// Reserve room for the cells and nodes and fill them with data
|
||||
mainGrid->globalCellArray().reserve( totalCellCount );
|
||||
mainGrid->reservoirCells().reserve( totalCellCount );
|
||||
mainGrid->nodes().reserve( 8 * totalCellCount );
|
||||
|
||||
int progTicks = 100;
|
||||
caf::ProgressInfo progInfo( progTicks, "" );
|
||||
|
||||
int cellCount = static_cast<int>( totalCellCount );
|
||||
size_t cellStartIndex = mainGrid->globalCellArray().size();
|
||||
size_t cellStartIndex = mainGrid->reservoirCells().size();
|
||||
size_t nodeStartIndex = mainGrid->nodes().size();
|
||||
|
||||
RigCell defaultCell;
|
||||
defaultCell.setHostGrid( mainGrid );
|
||||
mainGrid->globalCellArray().resize( cellStartIndex + cellCount, defaultCell );
|
||||
mainGrid->reservoirCells().resize( cellStartIndex + cellCount, defaultCell );
|
||||
|
||||
mainGrid->nodes().resize( nodeStartIndex + static_cast<size_t>( cellCount ) * 8, cvf::Vec3d( 0, 0, 0 ) );
|
||||
|
||||
@ -220,7 +220,7 @@ bool RifRoffFileTools::openGridFile( const QString& fileName, RigEclipseCaseData
|
||||
#pragma omp for
|
||||
for ( int gridLocalCellIndex = 0; gridLocalCellIndex < cellCount; ++gridLocalCellIndex )
|
||||
{
|
||||
RigCell& cell = mainGrid->globalCellArray()[cellStartIndex + gridLocalCellIndex];
|
||||
RigCell& cell = mainGrid->cell( cellStartIndex + gridLocalCellIndex );
|
||||
|
||||
cell.setGridLocalCellIndex( gridLocalCellIndex );
|
||||
|
||||
|
@ -66,7 +66,7 @@ bool RivEclipseIntersectionGrid::useCell( size_t cellIndex ) const
|
||||
|
||||
if ( m_intervalTool.isNumberIncluded( k ) )
|
||||
{
|
||||
const RigCell& cell = m_mainGrid->globalCellArray()[cellIndex];
|
||||
const RigCell& cell = m_mainGrid->cell( cellIndex );
|
||||
if ( m_showInactiveCells )
|
||||
return !cell.isInvalid() && ( cell.subGrid() == nullptr );
|
||||
else
|
||||
@ -88,7 +88,7 @@ void RivEclipseIntersectionGrid::cellCornerVertices( size_t cellIndex, cvf::Vec3
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivEclipseIntersectionGrid::cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const
|
||||
{
|
||||
const std::array<size_t, 8>& cornerIndicesSource = m_mainGrid->globalCellArray()[cellIndex].cornerIndices();
|
||||
const std::array<size_t, 8>& cornerIndicesSource = m_mainGrid->cell( cellIndex ).cornerIndices();
|
||||
|
||||
for ( size_t i = 0; i < 8; i++ )
|
||||
{
|
||||
|
@ -150,24 +150,25 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
|
||||
|
||||
RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
|
||||
const std::vector<RigCell>& cells = eclipseCase->mainGrid()->globalCellArray();
|
||||
const auto mainGrid = eclipseCase->mainGrid();
|
||||
|
||||
auto getFaceCenterAndNormal = [cells, arrowScaling, displayCordXf]( size_t globalCellIdx,
|
||||
cvf::StructGridInterface::FaceType faceType,
|
||||
cvf::Vec3d& faceCenter,
|
||||
cvf::Vec3d& faceNormal )
|
||||
auto getFaceCenterAndNormal = [arrowScaling, displayCordXf, mainGrid]( size_t globalCellIdx,
|
||||
cvf::StructGridInterface::FaceType faceType,
|
||||
cvf::Vec3d& faceCenter,
|
||||
cvf::Vec3d& faceNormal )
|
||||
{
|
||||
faceCenter = displayCordXf->transformToDisplayCoord( cells[globalCellIdx].faceCenter( faceType ) );
|
||||
cvf::Vec3d cellCenter = displayCordXf->transformToDisplayCoord( cells[globalCellIdx].center() );
|
||||
faceCenter = displayCordXf->transformToDisplayCoord( mainGrid->cell( globalCellIdx ).faceCenter( faceType ) );
|
||||
cvf::Vec3d cellCenter = displayCordXf->transformToDisplayCoord( mainGrid->cell( globalCellIdx ).center() );
|
||||
faceNormal = ( faceCenter - cellCenter ).getNormalized() * arrowScaling;
|
||||
};
|
||||
|
||||
if ( !resultAddresses.empty() && !directions.empty() )
|
||||
{
|
||||
#pragma omp parallel for
|
||||
for ( int gcIdx = 0; gcIdx < static_cast<int>( cells.size() ); ++gcIdx )
|
||||
for ( int gcIdx = 0; gcIdx < static_cast<int>( mainGrid->totalCellCount() ); ++gcIdx )
|
||||
{
|
||||
if ( !cells[gcIdx].isInvalid() && activeCellInfo->isActive( gcIdx ) )
|
||||
auto& cell = mainGrid->cell( gcIdx );
|
||||
if ( !cell.isInvalid() && activeCellInfo->isActive( gcIdx ) )
|
||||
{
|
||||
size_t resultIdx = activeCellInfo->cellResultIndex( gcIdx );
|
||||
if ( result->vectorView() == RimElementVectorResult::VectorView::PER_FACE )
|
||||
@ -198,7 +199,7 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
|
||||
tensorVisualizations.push_back( ElementVectorResultVisualization( faceCenter,
|
||||
faceNormal,
|
||||
resultValue,
|
||||
std::cbrt( cells[gcIdx].volume() / 3.0 ),
|
||||
std::cbrt( cell.volume() / 3.0 ),
|
||||
centerArrow ) );
|
||||
}
|
||||
}
|
||||
@ -233,10 +234,10 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
|
||||
|
||||
#pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_2 )
|
||||
tensorVisualizations.push_back(
|
||||
ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( cells[gcIdx].center() ),
|
||||
ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( cell.center() ),
|
||||
aggregatedVector,
|
||||
aggregatedResult.length(),
|
||||
std::cbrt( cells[gcIdx].volume() / 3.0 ),
|
||||
std::cbrt( cell.volume() / 3.0 ),
|
||||
centerArrow ) );
|
||||
}
|
||||
}
|
||||
@ -300,11 +301,12 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
|
||||
}
|
||||
|
||||
#pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_nnc )
|
||||
tensorVisualizations.push_back( ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( connCenter ),
|
||||
connNormal,
|
||||
resultValue,
|
||||
std::cbrt( cells[conn.c1GlobIdx()].volume() / 3.0 ),
|
||||
centerArrow ) );
|
||||
tensorVisualizations.push_back(
|
||||
ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( connCenter ),
|
||||
connNormal,
|
||||
resultValue,
|
||||
std::cbrt( mainGrid->cell( conn.c1GlobIdx() ).volume() / 3.0 ),
|
||||
centerArrow ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,11 +77,11 @@ void RivNNCGeometryGenerator::computeArrays()
|
||||
const cvf::Vec3f offset( m_offset );
|
||||
long long numConnections = static_cast<long long>( m_nncIndexes.empty() ? m_nncData->allConnections().size() : m_nncIndexes.size() );
|
||||
|
||||
bool isVisibilityCalcActive = m_cellVisibility.notNull() && m_grid.notNull();
|
||||
std::vector<RigCell>* allCells = nullptr;
|
||||
bool isVisibilityCalcActive = m_cellVisibility.notNull() && m_grid.notNull();
|
||||
RigMainGrid* mainGrid = nullptr;
|
||||
if ( isVisibilityCalcActive )
|
||||
{
|
||||
allCells = &( m_grid->mainGrid()->globalCellArray() );
|
||||
mainGrid = m_grid->mainGrid();
|
||||
}
|
||||
|
||||
#pragma omp parallel for ordered
|
||||
@ -104,15 +104,15 @@ void RivNNCGeometryGenerator::computeArrays()
|
||||
bool cell1Visible = false;
|
||||
bool cell2Visible = false;
|
||||
|
||||
if ( ( *allCells )[conn.c1GlobIdx()].hostGrid() == m_grid.p() )
|
||||
if ( mainGrid->cell( conn.c1GlobIdx() ).hostGrid() == m_grid.p() )
|
||||
{
|
||||
size_t cell1GridLocalIdx = ( *allCells )[conn.c1GlobIdx()].gridLocalCellIndex();
|
||||
size_t cell1GridLocalIdx = mainGrid->cell( conn.c1GlobIdx() ).gridLocalCellIndex();
|
||||
cell1Visible = ( *m_cellVisibility )[cell1GridLocalIdx];
|
||||
}
|
||||
|
||||
if ( ( *allCells )[conn.c2GlobIdx()].hostGrid() == m_grid.p() )
|
||||
if ( mainGrid->cell( conn.c2GlobIdx() ).hostGrid() == m_grid.p() )
|
||||
{
|
||||
size_t cell2GridLocalIdx = ( *allCells )[conn.c2GlobIdx()].gridLocalCellIndex();
|
||||
size_t cell2GridLocalIdx = mainGrid->cell( conn.c2GlobIdx() ).gridLocalCellIndex();
|
||||
cell2Visible = ( *m_cellVisibility )[cell2GridLocalIdx];
|
||||
}
|
||||
|
||||
|
@ -93,9 +93,11 @@ bool RimFractureContainment::isEclipseCellOpenForFlow( const RigMainGrid* m
|
||||
{
|
||||
CVF_ASSERT( mainGrid );
|
||||
|
||||
if ( globalCellIndex >= mainGrid->globalCellArray().size() ) return false;
|
||||
if ( globalCellIndex >= mainGrid->totalCellCount() ) return false;
|
||||
|
||||
auto& cell = mainGrid->cell( globalCellIndex );
|
||||
if ( cell.isInvalid() ) return false;
|
||||
|
||||
auto cell = mainGrid->globalCellArray()[globalCellIndex];
|
||||
auto mainGridCellIndex = cell.mainGridCellIndex();
|
||||
|
||||
size_t i, j, k;
|
||||
|
@ -332,8 +332,7 @@ QString Rim3dOverlayInfoConfig::caseInfoText( RimEclipseView* eclipseView )
|
||||
}
|
||||
else if ( eclipseView->mainGrid() )
|
||||
{
|
||||
QString totCellCount =
|
||||
localeWithSpaceAsGroupSeparator.toString( static_cast<int>( eclipseView->mainGrid()->globalCellArray().size() ) );
|
||||
QString totCellCount = localeWithSpaceAsGroupSeparator.toString( static_cast<int>( eclipseView->mainGrid()->totalCellCount() ) );
|
||||
|
||||
size_t mxActCellCount =
|
||||
eclipseView->eclipseCase()->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL )->reservoirActiveCellCount();
|
||||
|
@ -389,7 +389,7 @@ std::vector<size_t> RimEclipseContourMapProjection::findIntersectingCells( const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimEclipseContourMapProjection::kLayer( size_t globalCellIdx ) const
|
||||
{
|
||||
const RigCell& cell = m_mainGrid->globalCellArray()[globalCellIdx];
|
||||
const RigCell& cell = m_mainGrid->cell( globalCellIdx );
|
||||
size_t mainGridCellIdx = cell.mainGridCellIndex();
|
||||
size_t i, j, k;
|
||||
m_mainGrid->ijkFromCellIndex( mainGridCellIdx, &i, &j, &k );
|
||||
@ -411,7 +411,7 @@ double RimEclipseContourMapProjection::calculateOverlapVolume( size_t globalCell
|
||||
{
|
||||
std::array<cvf::Vec3d, 8> hexCorners;
|
||||
|
||||
const RigCell& cell = m_mainGrid->globalCellArray()[globalCellIdx];
|
||||
const RigCell& cell = m_mainGrid->cell( globalCellIdx );
|
||||
|
||||
size_t localCellIdx = cell.gridLocalCellIndex();
|
||||
RigGridBase* localGrid = cell.hostGrid();
|
||||
@ -437,7 +437,7 @@ double RimEclipseContourMapProjection::calculateRayLengthInCell( size_t
|
||||
{
|
||||
std::array<cvf::Vec3d, 8> hexCorners;
|
||||
|
||||
RigCell cell = m_mainGrid->globalCellArray()[globalCellIdx];
|
||||
RigCell cell = m_mainGrid->cell( globalCellIdx );
|
||||
|
||||
size_t localCellIdx = cell.gridLocalCellIndex();
|
||||
RigGridBase* localGrid = cell.hostGrid();
|
||||
|
@ -401,7 +401,7 @@ RimEclipseStatisticsCaseEvaluator::RimEclipseStatisticsCaseEvaluator( const std:
|
||||
{
|
||||
if ( !sourceCases.empty() )
|
||||
{
|
||||
m_reservoirCellCount = sourceCases[0]->eclipseCaseData()->mainGrid()->globalCellArray().size();
|
||||
m_reservoirCellCount = sourceCases[0]->eclipseCaseData()->mainGrid()->totalCellCount();
|
||||
}
|
||||
|
||||
CVF_ASSERT( m_destinationCase );
|
||||
|
@ -2345,7 +2345,7 @@ void RimEclipseView::setOverridePropertyFilterCollection( RimEclipsePropertyFilt
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseView::calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int timeStep )
|
||||
{
|
||||
size_t cellCount = mainGrid()->globalCellArray().size();
|
||||
size_t cellCount = mainGrid()->totalCellCount();
|
||||
|
||||
totalVisibility->resize( cellCount );
|
||||
totalVisibility->setAll( false );
|
||||
@ -2376,7 +2376,7 @@ void RimEclipseView::calculateCellVisibility( cvf::UByteArray* visibility, std::
|
||||
{
|
||||
if ( !mainGrid() ) return;
|
||||
|
||||
size_t cellCount = mainGrid()->globalCellArray().size();
|
||||
size_t cellCount = mainGrid()->totalCellCount();
|
||||
|
||||
visibility->resize( cellCount );
|
||||
visibility->setAll( false );
|
||||
|
@ -267,8 +267,8 @@ void RimIdenticalGridCaseGroup::computeUnionOfActiveCells()
|
||||
return;
|
||||
}
|
||||
|
||||
m_unionOfMatrixActiveCells->setReservoirCellCount( m_mainGrid->globalCellArray().size() );
|
||||
m_unionOfFractureActiveCells->setReservoirCellCount( m_mainGrid->globalCellArray().size() );
|
||||
m_unionOfMatrixActiveCells->setReservoirCellCount( m_mainGrid->totalCellCount() );
|
||||
m_unionOfFractureActiveCells->setReservoirCellCount( m_mainGrid->totalCellCount() );
|
||||
m_unionOfMatrixActiveCells->setGridCount( m_mainGrid->gridCount() );
|
||||
m_unionOfFractureActiveCells->setGridCount( m_mainGrid->gridCount() );
|
||||
|
||||
|
@ -276,7 +276,7 @@ void RigEclipseToStimPlanCellTransmissibilityCalculator::calculateStimPlanCellsM
|
||||
{
|
||||
// Use main grid cell to evaluate if a cell is active or not.
|
||||
// All cells in temporary grids are active
|
||||
const RigCell& cell = mainGrid->globalCellArray()[reservoirCellIndex];
|
||||
const RigCell& cell = mainGrid->cell( reservoirCellIndex );
|
||||
size_t mainGridReservoirIndex = cell.mainGridCellIndex();
|
||||
|
||||
if ( !activeCellInfo->isActive( mainGridReservoirIndex ) )
|
||||
@ -358,7 +358,8 @@ std::vector<size_t>
|
||||
std::vector<size_t> cellIndicesToLeafCells;
|
||||
for ( const size_t& index : cellIndices )
|
||||
{
|
||||
const RigCell& cell = mainGrid->globalCellArray()[index];
|
||||
const RigCell& cell = mainGrid->cell( index );
|
||||
if ( cell.isInvalid() ) continue;
|
||||
if ( !cell.subGrid() )
|
||||
{
|
||||
cellIndicesToLeafCells.push_back( index );
|
||||
|
@ -73,13 +73,13 @@ void RigCellVolumeResultCalculator::calculate( const RigEclipseResultAddress& re
|
||||
cellVolumeResults.resize( cellResultCount, std::numeric_limits<double>::infinity() );
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int nativeResvCellIndex = 0; nativeResvCellIndex < static_cast<int>( m_resultsData->m_ownerMainGrid->globalCellArray().size() );
|
||||
for ( int nativeResvCellIndex = 0; nativeResvCellIndex < static_cast<int>( m_resultsData->m_ownerMainGrid->totalCellCount() );
|
||||
nativeResvCellIndex++ )
|
||||
{
|
||||
size_t resultIndex = m_resultsData->activeCellInfo()->cellResultIndex( nativeResvCellIndex );
|
||||
if ( resultIndex != cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
const RigCell& cell = m_resultsData->m_ownerMainGrid->globalCellArray()[nativeResvCellIndex];
|
||||
const RigCell& cell = m_resultsData->m_ownerMainGrid->cell( nativeResvCellIndex );
|
||||
if ( !cell.subGrid() )
|
||||
{
|
||||
cellVolumeResults[resultIndex] = cell.volume();
|
||||
|
@ -78,9 +78,8 @@ void RigFaultDistanceResultCalculator::calculate( const RigEclipseResultAddress&
|
||||
|
||||
if ( !shouldCompute ) return;
|
||||
|
||||
const std::vector<RigCell>& globalCellArray = m_resultsData->m_ownerMainGrid->globalCellArray();
|
||||
|
||||
long long numCells = static_cast<long long>( globalCellArray.size() );
|
||||
const auto mainGrid = m_resultsData->m_ownerMainGrid;
|
||||
long long numCells = static_cast<long long>( mainGrid->totalCellCount() );
|
||||
|
||||
std::vector<cvf::StructGridInterface::FaceType> faceTypes = cvf::StructGridInterface::validFaceTypes();
|
||||
|
||||
@ -90,7 +89,8 @@ void RigFaultDistanceResultCalculator::calculate( const RigEclipseResultAddress&
|
||||
{
|
||||
if ( m_resultsData->activeCellInfo()->isActive( cellIdx ) )
|
||||
{
|
||||
const RigCell& cell = globalCellArray[cellIdx];
|
||||
const RigCell& cell = mainGrid->cell( cellIdx );
|
||||
if ( cell.isInvalid() ) continue;
|
||||
for ( auto faceType : faceTypes )
|
||||
{
|
||||
if ( m_resultsData->m_ownerMainGrid->findFaultFromCellIndexAndCellFace( cellIdx, faceType ) )
|
||||
@ -124,7 +124,8 @@ void RigFaultDistanceResultCalculator::calculate( const RigEclipseResultAddress&
|
||||
#pragma omp parallel for
|
||||
for ( long long cellIdx = 0; cellIdx < numCells; cellIdx++ )
|
||||
{
|
||||
const RigCell& cell = globalCellArray[cellIdx];
|
||||
const RigCell& cell = mainGrid->cell( cellIdx );
|
||||
if ( cell.isInvalid() ) continue;
|
||||
|
||||
size_t resultIndex = cellIdx;
|
||||
if ( resultIndex == cvf::UNDEFINED_SIZE_T || !m_resultsData->activeCellInfo()->isActive( cellIdx ) ) continue;
|
||||
|
@ -98,12 +98,13 @@ void RigIndexIjkResultCalculator::calculate( const RigEclipseResultAddress& resV
|
||||
|
||||
if ( !( computeIndexI || computeIndexJ || computeIndexK ) ) return;
|
||||
|
||||
const std::vector<RigCell>& globalCellArray = m_resultsData->m_ownerMainGrid->globalCellArray();
|
||||
long long numCells = static_cast<long long>( globalCellArray.size() );
|
||||
const auto mainGrid = m_resultsData->m_ownerMainGrid;
|
||||
long long numCells = static_cast<long long>( mainGrid->totalCellCount() );
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( long long cellIdx = 0; cellIdx < numCells; cellIdx++ )
|
||||
{
|
||||
const RigCell& cell = globalCellArray[cellIdx];
|
||||
const RigCell& cell = mainGrid->cell( cellIdx );
|
||||
|
||||
size_t resultIndex = cellIdx;
|
||||
if ( resultIndex == cvf::UNDEFINED_SIZE_T ) continue;
|
||||
|
@ -74,7 +74,7 @@ void RigOilVolumeResultCalculator::calculate( const RigEclipseResultAddress& res
|
||||
oilVolumeResults.resize( cellResultCount, 0u );
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int nativeResvCellIndex = 0; nativeResvCellIndex < static_cast<int>( m_resultsData->m_ownerMainGrid->globalCellArray().size() );
|
||||
for ( int nativeResvCellIndex = 0; nativeResvCellIndex < static_cast<int>( m_resultsData->m_ownerMainGrid->totalCellCount() );
|
||||
nativeResvCellIndex++ )
|
||||
{
|
||||
size_t resultIndex = m_resultsData->activeCellInfo()->cellResultIndex( nativeResvCellIndex );
|
||||
|
@ -124,7 +124,7 @@ void RigPorvSoilSgasResultCalculator::calculate( const RigEclipseResultAddress&
|
||||
bool res2ActiveOnly = in2Results.size() == activeCellCount;
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int nativeResvCellIndex = 0; nativeResvCellIndex < static_cast<int>( m_resultsData->m_ownerMainGrid->globalCellArray().size() );
|
||||
for ( int nativeResvCellIndex = 0; nativeResvCellIndex < static_cast<int>( m_resultsData->m_ownerMainGrid->totalCellCount() );
|
||||
nativeResvCellIndex++ )
|
||||
{
|
||||
size_t resultIndex = m_resultsData->activeCellInfo()->cellResultIndex( nativeResvCellIndex );
|
||||
|
@ -26,6 +26,10 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigActiveCellGrid::RigActiveCellGrid()
|
||||
{
|
||||
m_invalidCell.setInvalid( true );
|
||||
for ( size_t i = 0; i < 8; i++ )
|
||||
m_invalidCell.cornerIndices()[i] = 0;
|
||||
m_invalidCell.setHostGrid( this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -35,116 +39,129 @@ RigActiveCellGrid::~RigActiveCellGrid()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigActiveCellGrid::transferActiveInformation( RigEclipseCaseData* eclipseCaseData,
|
||||
size_t totalActiveCells,
|
||||
size_t matrixActiveCells,
|
||||
size_t fractureActiveCells,
|
||||
const std::vector<int>& activeMatrixIndexes,
|
||||
const std::vector<int>& activeFracIndexes )
|
||||
{
|
||||
const auto totalCells = activeMatrixIndexes.size();
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
/////
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
// size_t RigActiveCellGrid::transferActiveInformation( int gridIndex,
|
||||
// RigEclipseCaseData* eclipseCaseData,
|
||||
// size_t totalActiveCells,
|
||||
// size_t matrixActiveCells,
|
||||
// size_t fractureActiveCells,
|
||||
// const std::vector<int>& activeMatrixIndexes,
|
||||
// const std::vector<int>& activeFracIndexes,
|
||||
// size_t inactiveCellIndex )
|
||||
//{
|
||||
// if ( gridIndex == 0 )
|
||||
// {
|
||||
// m_globalToNativeMap.clear();
|
||||
// inactiveCellIndex = 0;
|
||||
// }
|
||||
//
|
||||
// const auto totalCells = activeMatrixIndexes.size();
|
||||
//
|
||||
// const auto cellStartIndex = m_globalToNativeMap.size();
|
||||
//
|
||||
// m_globalToNativeMap.resize( cellStartIndex + totalCells );
|
||||
// size_t activeCells = cellStartIndex;
|
||||
// size_t anInactiveCellIdx = inactiveCellIndex;
|
||||
//
|
||||
// for ( size_t i = 0; i < totalCells; i++ )
|
||||
// {
|
||||
// const auto globalCellIndex = cellStartIndex + i;
|
||||
// if ( ( activeMatrixIndexes[i] < 0 ) && ( activeFracIndexes[i] < 0 ) )
|
||||
// {
|
||||
// m_globalToNativeMap[globalCellIndex] = totalActiveCells;
|
||||
// anInactiveCellIdx = globalCellIndex;
|
||||
// continue;
|
||||
// }
|
||||
// m_nativeToGlobalMap.push_back( globalCellIndex );
|
||||
// m_globalToNativeMap[i] = activeCells++;
|
||||
// }
|
||||
// m_nativeToGlobalMap.push_back( anInactiveCellIdx );
|
||||
//
|
||||
// RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
// RigActiveCellInfo* fractureActiveCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::FRACTURE_MODEL );
|
||||
//
|
||||
// activeCellInfo->setReservoirCellCount( activeCellInfo->reservoirCellCount() + totalActiveCells + 1 );
|
||||
// fractureActiveCellInfo->setReservoirCellCount( fractureActiveCellInfo->reservoirCellCount() + totalActiveCells + 1 );
|
||||
//
|
||||
// activeCellInfo->setGridCount( gridIndex + 1 );
|
||||
// fractureActiveCellInfo->setGridCount( gridIndex + 1 );
|
||||
//
|
||||
// activeCellInfo->setGridActiveCellCounts( gridIndex, matrixActiveCells );
|
||||
// fractureActiveCellInfo->setGridActiveCellCounts( gridIndex, fractureActiveCells );
|
||||
//
|
||||
// // TODO - update indexes here
|
||||
//
|
||||
// #pragma omp parallel for
|
||||
// for ( int opmCellIndex = 0; opmCellIndex < (int)totalCells; opmCellIndex++ )
|
||||
// {
|
||||
// auto activeCellIndex = m_globalToNativeMap[cellStartIndex + opmCellIndex];
|
||||
//
|
||||
// // active cell index
|
||||
// int matrixActiveIndex = activeMatrixIndexes[opmCellIndex];
|
||||
// if ( matrixActiveIndex != -1 )
|
||||
// {
|
||||
// activeCellInfo->setCellResultIndex( activeCellIndex, matrixActiveIndex );
|
||||
// }
|
||||
//
|
||||
// int fractureActiveIndex = activeFracIndexes[opmCellIndex];
|
||||
// if ( fractureActiveIndex != -1 )
|
||||
// {
|
||||
// fractureActiveCellInfo->setCellResultIndex( activeCellIndex, fractureActiveIndex );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return anInactiveCellIdx;
|
||||
// }
|
||||
|
||||
m_globalToActiveMap.resize( totalCells );
|
||||
size_t activeCells = 0;
|
||||
size_t anInactiveCellIdx = 0;
|
||||
|
||||
for ( size_t i = 0; i < totalCells; i++ )
|
||||
{
|
||||
if ( ( activeMatrixIndexes[i] < 0 ) && ( activeFracIndexes[i] < 0 ) )
|
||||
{
|
||||
m_globalToActiveMap[i] = totalActiveCells;
|
||||
anInactiveCellIdx = i;
|
||||
continue;
|
||||
}
|
||||
m_activeToGlobalMap.push_back( i );
|
||||
m_globalToActiveMap[i] = activeCells++;
|
||||
}
|
||||
m_activeToGlobalMap.push_back( anInactiveCellIdx );
|
||||
|
||||
RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
RigActiveCellInfo* fractureActiveCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::FRACTURE_MODEL );
|
||||
|
||||
activeCellInfo->setReservoirCellCount( totalActiveCells + 1 );
|
||||
fractureActiveCellInfo->setReservoirCellCount( totalActiveCells + 1 );
|
||||
|
||||
activeCellInfo->setGridCount( 1 );
|
||||
fractureActiveCellInfo->setGridCount( 1 );
|
||||
|
||||
activeCellInfo->setGridActiveCellCounts( 0, matrixActiveCells );
|
||||
fractureActiveCellInfo->setGridActiveCellCounts( 0, fractureActiveCells );
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int opmCellIndex = 0; opmCellIndex < (int)totalCells; opmCellIndex++ )
|
||||
{
|
||||
auto activeCellIndex = m_globalToActiveMap[opmCellIndex];
|
||||
|
||||
// active cell index
|
||||
int matrixActiveIndex = activeMatrixIndexes[opmCellIndex];
|
||||
if ( matrixActiveIndex != -1 )
|
||||
{
|
||||
activeCellInfo->setCellResultIndex( activeCellIndex, matrixActiveIndex );
|
||||
}
|
||||
|
||||
int fractureActiveIndex = activeFracIndexes[opmCellIndex];
|
||||
if ( fractureActiveIndex != -1 )
|
||||
{
|
||||
fractureActiveCellInfo->setCellResultIndex( activeCellIndex, fractureActiveIndex );
|
||||
}
|
||||
}
|
||||
|
||||
activeCellInfo->computeDerivedData();
|
||||
fractureActiveCellInfo->computeDerivedData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigActiveCellGrid::cellIndexFromIJK( size_t i, size_t j, size_t k ) const
|
||||
{
|
||||
auto index = RigGridBase::cellIndexFromIJK( i, j, k );
|
||||
return m_globalToActiveMap[index];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigActiveCellGrid::cellIndexFromIJKUnguarded( size_t i, size_t j, size_t k ) const
|
||||
{
|
||||
auto index = RigGridBase::cellIndexFromIJKUnguarded( i, j, k );
|
||||
return m_globalToActiveMap[index];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigActiveCellGrid::ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const
|
||||
{
|
||||
if ( cellIndex >= m_activeToGlobalMap.size() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
auto index = m_activeToGlobalMap[cellIndex];
|
||||
return RigGridBase::ijkFromCellIndex( index, i, j, k );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigActiveCellGrid::ijkFromCellIndexUnguarded( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const
|
||||
{
|
||||
auto index = m_activeToGlobalMap[cellIndex];
|
||||
RigGridBase::ijkFromCellIndexUnguarded( index, i, j, k );
|
||||
}
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
/////
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
// size_t RigActiveCellGrid::cellIndexFromIJK( size_t i, size_t j, size_t k ) const
|
||||
//{
|
||||
// auto index = RigGridBase::cellIndexFromIJK( i, j, k );
|
||||
// return m_globalToActiveMap[index];
|
||||
// }
|
||||
//
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
/////
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
// size_t RigActiveCellGrid::cellIndexFromIJKUnguarded( size_t i, size_t j, size_t k ) const
|
||||
//{
|
||||
// auto index = RigGridBase::cellIndexFromIJKUnguarded( i, j, k );
|
||||
// return m_globalToActiveMap[index];
|
||||
// }
|
||||
//
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
/////
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
// bool RigActiveCellGrid::ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const
|
||||
//{
|
||||
// if ( cellIndex >= m_activeToGlobalMap.size() )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// auto index = m_activeToGlobalMap[cellIndex];
|
||||
// return RigGridBase::ijkFromCellIndex( index, i, j, k );
|
||||
// }
|
||||
//
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
/////
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
// void RigActiveCellGrid::ijkFromCellIndexUnguarded( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const
|
||||
//{
|
||||
// auto index = m_activeToGlobalMap[cellIndex];
|
||||
// RigGridBase::ijkFromCellIndexUnguarded( index, i, j, k );
|
||||
// }
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigCell& RigActiveCellGrid::cell( size_t gridLocalCellIndex )
|
||||
{
|
||||
return m_cells[gridLocalCellIndex];
|
||||
if ( m_nativeCells.contains( gridLocalCellIndex ) ) return m_nativeCells[gridLocalCellIndex];
|
||||
return m_invalidCell;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -152,13 +169,38 @@ RigCell& RigActiveCellGrid::cell( size_t gridLocalCellIndex )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigCell& RigActiveCellGrid::cell( size_t gridLocalCellIndex ) const
|
||||
{
|
||||
return m_cells[gridLocalCellIndex];
|
||||
if ( m_nativeCells.contains( gridLocalCellIndex ) ) return m_nativeCells.at( gridLocalCellIndex );
|
||||
return m_invalidCell;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigActiveCellGrid::cellCount() const
|
||||
std::map<size_t, RigCell>& RigActiveCellGrid::nativeCells()
|
||||
{
|
||||
return m_cells.size();
|
||||
return m_nativeCells;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::map<size_t, RigCell>& RigActiveCellGrid::nativeCells() const
|
||||
{
|
||||
return m_nativeCells;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigActiveCellGrid::totalCellCount() const
|
||||
{
|
||||
return m_totalCellCount;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigActiveCellGrid::setTotalCellCount( size_t totalCellCount )
|
||||
{
|
||||
m_totalCellCount = totalCellCount;
|
||||
}
|
||||
|
@ -28,25 +28,35 @@ public:
|
||||
RigActiveCellGrid();
|
||||
~RigActiveCellGrid() override;
|
||||
|
||||
void transferActiveInformation( RigEclipseCaseData* eclipseCaseData,
|
||||
size_t totalActiveCells,
|
||||
size_t matrixActiveCells,
|
||||
size_t fractureActiveCells,
|
||||
const std::vector<int>& activeMatrixIndexes,
|
||||
const std::vector<int>& activeFracIndexes );
|
||||
// size_t transferActiveInformation( int gridIndex,
|
||||
// RigEclipseCaseData* eclipseCaseData,
|
||||
// size_t totalActiveCells,
|
||||
// size_t matrixActiveCells,
|
||||
// size_t fractureActiveCells,
|
||||
// const std::vector<int>& activeMatrixIndexes,
|
||||
// const std::vector<int>& activeFracIndexes,
|
||||
// size_t inactiveCellIndex );
|
||||
|
||||
size_t cellIndexFromIJK( size_t i, size_t j, size_t k ) const override;
|
||||
size_t cellIndexFromIJKUnguarded( size_t i, size_t j, size_t k ) const override;
|
||||
bool ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const override;
|
||||
void ijkFromCellIndexUnguarded( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const override;
|
||||
// size_t cellIndexFromIJK( size_t i, size_t j, size_t k ) const override;
|
||||
// size_t cellIndexFromIJKUnguarded( size_t i, size_t j, size_t k ) const override;
|
||||
// bool ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const override;
|
||||
// void ijkFromCellIndexUnguarded( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const override;
|
||||
|
||||
RigCell& cell( size_t gridLocalCellIndex ) override;
|
||||
const RigCell& cell( size_t gridLocalCellIndex ) const override;
|
||||
size_t cellCount() const override;
|
||||
// size_t cellCount() const override;
|
||||
|
||||
size_t totalCellCount() const override;
|
||||
|
||||
public: // only for use by file readers!
|
||||
std::map<size_t, RigCell>& nativeCells();
|
||||
const std::map<size_t, RigCell>& nativeCells() const;
|
||||
void setTotalCellCount( size_t totalCellCount );
|
||||
|
||||
private:
|
||||
std::vector<size_t> m_globalToActiveMap;
|
||||
std::vector<size_t> m_activeToGlobalMap;
|
||||
RigCell m_invalidCell;
|
||||
std::map<size_t, size_t> m_cells;
|
||||
// std::vector<size_t> m_globalToNativeMap;
|
||||
// std::vector<size_t> m_nativeToGlobalMap;
|
||||
size_t m_totalCellCount;
|
||||
RigCell m_invalidCell;
|
||||
std::map<size_t, RigCell> m_nativeCells;
|
||||
};
|
||||
|
@ -514,7 +514,7 @@ bool RigCaseCellResultsData::isUsingGlobalActiveIndex( const RigEclipseResultAdd
|
||||
if ( m_cellScalarResults[scalarResultIndex].empty() ) return true;
|
||||
|
||||
size_t firstTimeStepResultValueCount = m_cellScalarResults[scalarResultIndex][0].size();
|
||||
return firstTimeStepResultValueCount != m_ownerMainGrid->globalCellArray().size();
|
||||
return firstTimeStepResultValueCount != m_ownerMainGrid->totalCellCount();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1895,9 +1895,9 @@ void RigCaseCellResultsData::computeDepthRelatedResults()
|
||||
}
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( long cellIdx = 0; cellIdx < static_cast<long>( m_ownerMainGrid->globalCellArray().size() ); cellIdx++ )
|
||||
for ( long cellIdx = 0; cellIdx < static_cast<long>( m_ownerMainGrid->totalCellCount() ); cellIdx++ )
|
||||
{
|
||||
const RigCell& cell = m_ownerMainGrid->globalCellArray()[cellIdx];
|
||||
const RigCell& cell = m_ownerMainGrid->cell( cellIdx );
|
||||
|
||||
size_t resultIndex = activeCellInfo()->cellResultIndex( cellIdx );
|
||||
if ( resultIndex == cvf::UNDEFINED_SIZE_T ) continue;
|
||||
@ -2160,14 +2160,14 @@ void RigCaseCellResultsData::computeRiTransComponent( const QString& riTransComp
|
||||
const std::vector<cvf::Vec3d>& nodes = m_ownerMainGrid->nodes();
|
||||
bool isFaceNormalsOutwards = m_ownerMainGrid->isFaceNormalsOutwards();
|
||||
|
||||
for ( size_t nativeResvCellIndex = 0; nativeResvCellIndex < m_ownerMainGrid->globalCellArray().size(); nativeResvCellIndex++ )
|
||||
for ( size_t nativeResvCellIndex = 0; nativeResvCellIndex < m_ownerMainGrid->totalCellCount(); nativeResvCellIndex++ )
|
||||
{
|
||||
// Do nothing if we are only dealing with active cells, and this cell is not active:
|
||||
size_t tranResIdx = ( *riTranIdxFunc )( activeCellInfo, nativeResvCellIndex );
|
||||
|
||||
if ( tranResIdx == cvf::UNDEFINED_SIZE_T ) continue;
|
||||
|
||||
const RigCell& nativeCell = m_ownerMainGrid->globalCellArray()[nativeResvCellIndex];
|
||||
const RigCell& nativeCell = m_ownerMainGrid->cell( nativeResvCellIndex );
|
||||
RigGridBase* grid = nativeCell.hostGrid();
|
||||
|
||||
size_t gridLocalNativeCellIndex = nativeCell.gridLocalCellIndex();
|
||||
@ -2179,7 +2179,7 @@ void RigCaseCellResultsData::computeRiTransComponent( const QString& riTransComp
|
||||
if ( grid->cellIJKNeighbor( i, j, k, faceId, &gridLocalNeighborCellIdx ) )
|
||||
{
|
||||
size_t neighborResvCellIdx = grid->reservoirCellIndex( gridLocalNeighborCellIdx );
|
||||
const RigCell& neighborCell = m_ownerMainGrid->globalCellArray()[neighborResvCellIdx];
|
||||
const RigCell& neighborCell = m_ownerMainGrid->cell( neighborResvCellIdx );
|
||||
|
||||
// Do nothing if neighbor cell has no results
|
||||
size_t neighborCellPermResIdx = ( *permIdxFunc )( activeCellInfo, neighborResvCellIdx );
|
||||
@ -2351,8 +2351,8 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
|
||||
size_t neighborCellPermResIdx = ( *permIdxFunc )( activeCellInfo, neighborResvCellIdx );
|
||||
if ( neighborCellPermResIdx == cvf::UNDEFINED_SIZE_T ) continue;
|
||||
|
||||
const RigCell& nativeCell = m_ownerMainGrid->globalCellArray()[nativeResvCellIndex];
|
||||
const RigCell& neighborCell = m_ownerMainGrid->globalCellArray()[neighborResvCellIdx];
|
||||
const RigCell& nativeCell = m_ownerMainGrid->cell( nativeResvCellIndex );
|
||||
const RigCell& neighborCell = m_ownerMainGrid->cell( neighborResvCellIdx );
|
||||
|
||||
// Connection geometry
|
||||
|
||||
@ -2595,14 +2595,14 @@ void RigCaseCellResultsData::computeRiTRANSbyAreaComponent( const QString& riTra
|
||||
const RigActiveCellInfo* activeCellInfo = this->activeCellInfo();
|
||||
const std::vector<cvf::Vec3d>& nodes = m_ownerMainGrid->nodes();
|
||||
|
||||
for ( size_t nativeResvCellIndex = 0; nativeResvCellIndex < m_ownerMainGrid->globalCellArray().size(); nativeResvCellIndex++ )
|
||||
for ( size_t nativeResvCellIndex = 0; nativeResvCellIndex < m_ownerMainGrid->totalCellCount(); nativeResvCellIndex++ )
|
||||
{
|
||||
// Do nothing if we are only dealing with active cells, and this cell is not active:
|
||||
size_t nativeCellResValIdx = ( *resValIdxFunc )( activeCellInfo, nativeResvCellIndex );
|
||||
|
||||
if ( nativeCellResValIdx == cvf::UNDEFINED_SIZE_T ) continue;
|
||||
|
||||
const RigCell& nativeCell = m_ownerMainGrid->globalCellArray()[nativeResvCellIndex];
|
||||
const RigCell& nativeCell = m_ownerMainGrid->cell( nativeResvCellIndex );
|
||||
RigGridBase* grid = nativeCell.hostGrid();
|
||||
|
||||
size_t gridLocalNativeCellIndex = nativeCell.gridLocalCellIndex();
|
||||
@ -2614,7 +2614,7 @@ void RigCaseCellResultsData::computeRiTRANSbyAreaComponent( const QString& riTra
|
||||
if ( grid->cellIJKNeighbor( i, j, k, faceId, &gridLocalNeighborCellIdx ) )
|
||||
{
|
||||
size_t neighborResvCellIdx = grid->reservoirCellIndex( gridLocalNeighborCellIdx );
|
||||
const RigCell& neighborCell = m_ownerMainGrid->globalCellArray()[neighborResvCellIdx];
|
||||
const RigCell& neighborCell = m_ownerMainGrid->cell( neighborResvCellIdx );
|
||||
|
||||
// Connection geometry
|
||||
|
||||
@ -2690,7 +2690,7 @@ void RigCaseCellResultsData::computeCompletionTypeForTimeStep( size_t timeStep )
|
||||
|
||||
std::vector<double>& completionTypeResult = m_cellScalarResults[completionTypeResultIndex][timeStep];
|
||||
|
||||
size_t resultValues = m_ownerMainGrid->globalCellArray().size();
|
||||
size_t resultValues = m_ownerMainGrid->totalCellCount();
|
||||
|
||||
if ( completionTypeResult.size() == resultValues )
|
||||
{
|
||||
@ -2831,7 +2831,7 @@ void RigCaseCellResultsData::setActiveFormationNames( RigFormationNames* activeF
|
||||
return;
|
||||
}
|
||||
|
||||
size_t totalGlobCellCount = m_ownerMainGrid->globalCellArray().size();
|
||||
size_t totalGlobCellCount = m_ownerMainGrid->totalCellCount();
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::FORMATION_NAMES, RiaResultNames::activeFormationNamesResultName(), false, totalGlobCellCount );
|
||||
|
||||
std::vector<double>* fnData = modifiableCellScalarResult( RigEclipseResultAddress( RiaDefines::ResultCatType::FORMATION_NAMES,
|
||||
@ -2867,7 +2867,7 @@ void RigCaseCellResultsData::setActiveFormationNames( RigFormationNames* activeF
|
||||
|
||||
for ( size_t cIdx = localCellCount; cIdx < totalGlobCellCount; ++cIdx )
|
||||
{
|
||||
size_t mgrdCellIdx = m_ownerMainGrid->globalCellArray()[cIdx].mainGridCellIndex();
|
||||
size_t mgrdCellIdx = m_ownerMainGrid->cell( cIdx ).mainGridCellIndex();
|
||||
|
||||
size_t i( cvf::UNDEFINED_SIZE_T ), j( cvf::UNDEFINED_SIZE_T ), k( cvf::UNDEFINED_SIZE_T );
|
||||
|
||||
|
@ -33,7 +33,7 @@ RigCaseToCaseCellMapper::RigCaseToCaseCellMapper( RigMainGrid* masterEclGrid, Ri
|
||||
, m_masterFemPart( nullptr )
|
||||
, m_dependentFemPart( nullptr )
|
||||
{
|
||||
m_masterCellOrIntervalIndex.resize( dependentEclGrid->globalCellArray().size(), cvf::UNDEFINED_INT );
|
||||
m_masterCellOrIntervalIndex.resize( dependentEclGrid->totalCellCount(), cvf::UNDEFINED_INT );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -45,7 +45,7 @@ RigCaseToCaseCellMapper::RigCaseToCaseCellMapper( RigFemPart* masterFemPart, Rig
|
||||
, m_masterFemPart( masterFemPart )
|
||||
, m_dependentFemPart( nullptr )
|
||||
{
|
||||
m_masterCellOrIntervalIndex.resize( dependentEclGrid->globalCellArray().size(), cvf::UNDEFINED_INT );
|
||||
m_masterCellOrIntervalIndex.resize( dependentEclGrid->totalCellCount(), cvf::UNDEFINED_INT );
|
||||
calculateEclToGeomCellMapping( dependentEclGrid, masterFemPart, false );
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
if ( offsetK > 0 && m_baseK == m_mainGrid->cellCountK() - 1 ) return nullptr;
|
||||
|
||||
size_t gridLocalCellIndex = m_mainGrid->cellIndexFromIJK( m_baseI + offsetI, m_baseJ + offsetJ, m_baseK + offsetK );
|
||||
const RigCell& cell = m_mainGrid->globalCellArray()[gridLocalCellIndex];
|
||||
const RigCell& cell = m_mainGrid->cell( gridLocalCellIndex );
|
||||
return &( cell.cornerIndices() );
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,7 @@ RigCaseToCaseRangeFilterMapper::CellMatchType RigCaseToCaseRangeFilterMapper::fi
|
||||
|
||||
size_t cellIdx = masterEclGrid->cellIndexFromIJK( ei, ej, ek );
|
||||
|
||||
bool isCollapsedCell = masterEclGrid->globalCellArray()[cellIdx].isCollapsedCell();
|
||||
bool isCollapsedCell = masterEclGrid->cell( cellIdx ).isCollapsedCell();
|
||||
|
||||
cvf::Vec3d geoMechConvertedEclCell[8];
|
||||
RigCaseToCaseCellMapperTools::estimatedFemCellFromEclCell( masterEclGrid, cellIdx, geoMechConvertedEclCell );
|
||||
@ -512,7 +512,7 @@ RigCaseToCaseRangeFilterMapper::CellMatchType RigCaseToCaseRangeFilterMapper::fi
|
||||
if ( globCellIdxToBestMatch != cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
masterEclGrid->ijkFromCellIndex( globCellIdxToBestMatch, ei, ej, ek );
|
||||
isCollapsedCell = masterEclGrid->globalCellArray()[globCellIdxToBestMatch].isCollapsedCell();
|
||||
isCollapsedCell = masterEclGrid->cell( globCellIdxToBestMatch ).isCollapsedCell();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -229,7 +229,7 @@ void RigCellFaceGeometryTools::extractConnectionsForFace( const RigFault::FaultF
|
||||
|
||||
cvf::BoundingBox bb;
|
||||
std::array<size_t, 4> sourceFaceIndices;
|
||||
mainGrid->globalCellArray()[sourceReservoirCellIndex].faceIndices( sourceCellFace, &sourceFaceIndices );
|
||||
mainGrid->cell( sourceReservoirCellIndex ).faceIndices( sourceCellFace, &sourceFaceIndices );
|
||||
|
||||
bb.add( mainGridNodes[sourceFaceIndices[0]] );
|
||||
bb.add( mainGridNodes[sourceFaceIndices[1]] );
|
||||
@ -333,7 +333,7 @@ void RigCellFaceGeometryTools::extractConnectionsForFace( const RigFault::FaultF
|
||||
std::vector<cvf::Vec3d> intersections;
|
||||
|
||||
std::array<size_t, 4> candidateFaceIndices;
|
||||
mainGrid->globalCellArray()[candidateCellIndex].faceIndices( candidateFace, &candidateFaceIndices );
|
||||
mainGrid->cell( candidateCellIndex ).faceIndices( candidateFace, &candidateFaceIndices );
|
||||
|
||||
bool foundOverlap = cvf::GeometryTools::calculateOverlapPolygonOfTwoQuads( &polygon,
|
||||
&intersections,
|
||||
|
@ -77,7 +77,7 @@ void RigEclipseWellLogExtractor::calculateIntersection()
|
||||
cvf::Vec3d hexCorners[8];
|
||||
for ( const auto& globalCellIndex : closeCellIndices )
|
||||
{
|
||||
const RigCell& cell = m_caseData->mainGrid()->globalCellArray()[globalCellIndex];
|
||||
const RigCell& cell = m_caseData->mainGrid()->cell( globalCellIndex );
|
||||
|
||||
if ( cell.isInvalid() || cell.subGrid() != nullptr ) continue;
|
||||
|
||||
@ -123,7 +123,7 @@ void RigEclipseWellLogExtractor::calculateIntersection()
|
||||
cvf::Vec3d hexCorners[8];
|
||||
for ( const auto& globalCellIndex : closeCellIndices )
|
||||
{
|
||||
const RigCell& cell = m_caseData->mainGrid()->globalCellArray()[globalCellIndex];
|
||||
const RigCell& cell = m_caseData->mainGrid()->cell( globalCellIndex );
|
||||
|
||||
if ( cell.isInvalid() ) continue;
|
||||
|
||||
|
@ -84,9 +84,9 @@ RigCell& RigGridBase::cell( size_t gridLocalCellIndex )
|
||||
{
|
||||
CVF_ASSERT( m_mainGrid );
|
||||
|
||||
CVF_ASSERT( m_indexToStartOfCells + gridLocalCellIndex < m_mainGrid->globalCellArray().size() );
|
||||
CVF_ASSERT( m_indexToStartOfCells + gridLocalCellIndex < m_mainGrid->reservoirCells().size() );
|
||||
|
||||
return m_mainGrid->globalCellArray()[m_indexToStartOfCells + gridLocalCellIndex];
|
||||
return m_mainGrid->reservoirCells()[m_indexToStartOfCells + gridLocalCellIndex];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -96,7 +96,7 @@ const RigCell& RigGridBase::cell( size_t gridLocalCellIndex ) const
|
||||
{
|
||||
CVF_ASSERT( m_mainGrid );
|
||||
|
||||
return m_mainGrid->globalCellArray()[m_indexToStartOfCells + gridLocalCellIndex];
|
||||
return m_mainGrid->reservoirCells()[m_indexToStartOfCells + gridLocalCellIndex];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -74,7 +74,15 @@ const std::vector<cvf::Vec3d>& RigMainGrid::nodes() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RigCell>& RigMainGrid::globalCellArray()
|
||||
size_t RigMainGrid::totalCellCount() const
|
||||
{
|
||||
return m_cells.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RigCell>& RigMainGrid::reservoirCells()
|
||||
{
|
||||
return m_cells;
|
||||
}
|
||||
@ -82,7 +90,7 @@ std::vector<RigCell>& RigMainGrid::globalCellArray()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<RigCell>& RigMainGrid::globalCellArray() const
|
||||
const std::vector<RigCell>& RigMainGrid::reservoirCells() const
|
||||
{
|
||||
return m_cells;
|
||||
}
|
||||
@ -92,9 +100,9 @@ const std::vector<RigCell>& RigMainGrid::globalCellArray() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigGridBase* RigMainGrid::gridAndGridLocalIdxFromGlobalCellIdx( size_t globalCellIdx, size_t* gridLocalCellIdx )
|
||||
{
|
||||
CVF_ASSERT( globalCellIdx < m_cells.size() );
|
||||
CVF_ASSERT( globalCellIdx < totalCellCount() );
|
||||
|
||||
const RigCell& cell = m_cells[globalCellIdx];
|
||||
const RigCell& cell = this->cell( globalCellIdx );
|
||||
RigGridBase* hostGrid = cell.hostGrid();
|
||||
CVF_ASSERT( hostGrid );
|
||||
|
||||
@ -111,9 +119,9 @@ RigGridBase* RigMainGrid::gridAndGridLocalIdxFromGlobalCellIdx( size_t globalCel
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigGridBase* RigMainGrid::gridAndGridLocalIdxFromGlobalCellIdx( size_t globalCellIdx, size_t* gridLocalCellIdx ) const
|
||||
{
|
||||
CVF_ASSERT( globalCellIdx < m_cells.size() );
|
||||
CVF_ASSERT( globalCellIdx < totalCellCount() );
|
||||
|
||||
const RigCell& cell = m_cells[globalCellIdx];
|
||||
const RigCell& cell = this->cell( globalCellIdx );
|
||||
const RigGridBase* hostGrid = cell.hostGrid();
|
||||
CVF_ASSERT( hostGrid );
|
||||
|
||||
@ -492,7 +500,7 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo )
|
||||
return;
|
||||
}
|
||||
|
||||
m_faultsPrCellAcc = new RigFaultsPrCellAccumulator( m_cells.size() );
|
||||
m_faultsPrCellAcc = new RigFaultsPrCellAccumulator( totalCellCount() );
|
||||
|
||||
// Spread fault idx'es on the cells from the faults
|
||||
for ( size_t fIdx = 0; fIdx < m_faults.size(); ++fIdx )
|
||||
@ -517,7 +525,7 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo )
|
||||
|
||||
std::vector<RigFault::FaultFace>& unNamedFaultFaces = unNamedFault->faultFaces();
|
||||
std::vector<RigFault::FaultFace>& unNamedFaultFacesInactive = unNamedFaultWithInactive->faultFaces();
|
||||
for ( int gcIdx = 0; gcIdx < static_cast<int>( m_cells.size() ); ++gcIdx )
|
||||
for ( int gcIdx = 0; gcIdx < static_cast<int>( totalCellCount() ); ++gcIdx )
|
||||
{
|
||||
addUnNamedFaultFaces( gcIdx,
|
||||
activeCellInfo,
|
||||
@ -542,7 +550,7 @@ void RigMainGrid::addUnNamedFaultFaces( int gcIdx,
|
||||
std::vector<RigFault::FaultFace>& unNamedFaultFacesInactive,
|
||||
RigFaultsPrCellAccumulator* faultsPrCellAcc ) const
|
||||
{
|
||||
if ( m_cells[gcIdx].isInvalid() )
|
||||
if ( cell( gcIdx ).isInvalid() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -586,7 +594,7 @@ void RigMainGrid::addUnNamedFaultFaces( int gcIdx,
|
||||
}
|
||||
|
||||
neighborReservoirCellIdx = hostGrid->reservoirCellIndex( neighborGridCellIdx );
|
||||
if ( m_cells[neighborReservoirCellIdx].isInvalid() )
|
||||
if ( cell( neighborReservoirCellIdx ).isInvalid() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -596,9 +604,9 @@ void RigMainGrid::addUnNamedFaultFaces( int gcIdx,
|
||||
double tolerance = 1e-6;
|
||||
|
||||
std::array<size_t, 4> faceIdxs;
|
||||
m_cells[gcIdx].faceIndices( face, &faceIdxs );
|
||||
cell( gcIdx ).faceIndices( face, &faceIdxs );
|
||||
std::array<size_t, 4> nbFaceIdxs;
|
||||
m_cells[neighborReservoirCellIdx].faceIndices( StructGridInterface::oppositeFace( face ), &nbFaceIdxs );
|
||||
cell( neighborReservoirCellIdx ).faceIndices( StructGridInterface::oppositeFace( face ), &nbFaceIdxs );
|
||||
|
||||
bool sharedFaceVertices = true;
|
||||
if ( sharedFaceVertices && vxs[faceIdxs[0]].pointDistance( vxs[nbFaceIdxs[0]] ) > tolerance ) sharedFaceVertices = false;
|
||||
@ -664,7 +672,7 @@ void RigMainGrid::distributeNNCsToFaults()
|
||||
if ( fIdx1 < 0 && fIdx2 < 0 )
|
||||
{
|
||||
cvf::String lgrString( "Same Grid" );
|
||||
if ( m_cells[conn.c1GlobIdx()].hostGrid() != m_cells[conn.c2GlobIdx()].hostGrid() )
|
||||
if ( cell( conn.c1GlobIdx() ).hostGrid() != cell( conn.c2GlobIdx() ).hostGrid() )
|
||||
{
|
||||
lgrString = "Different Grid";
|
||||
}
|
||||
@ -698,7 +706,7 @@ bool RigMainGrid::isFaceNormalsOutwards() const
|
||||
if ( !m_isFaceNormalsOutwardsComputed )
|
||||
{
|
||||
std::vector<size_t> reservoirCellIndices;
|
||||
reservoirCellIndices.resize( cellCount() );
|
||||
reservoirCellIndices.resize( totalCellCount() );
|
||||
std::iota( reservoirCellIndices.begin(), reservoirCellIndices.end(), 0 );
|
||||
|
||||
computeFaceNormalsDirection( reservoirCellIndices );
|
||||
@ -741,7 +749,7 @@ void RigMainGrid::computeFaceNormalsDirection( const std::vector<size_t>& reserv
|
||||
|
||||
for ( const auto& index : reservoirCellIndices )
|
||||
{
|
||||
const auto& cell = m_cells[index];
|
||||
const auto& cell = this->cell( index );
|
||||
if ( !cell.isInvalid() )
|
||||
{
|
||||
// Some cells can be very twisted and distorted. Use a volume criteria to find a reasonably regular cell.
|
||||
@ -843,7 +851,7 @@ void RigMainGrid::buildCellSearchTree()
|
||||
{
|
||||
// build tree
|
||||
|
||||
size_t cellCount = m_cells.size();
|
||||
size_t cellCount = totalCellCount();
|
||||
|
||||
std::vector<size_t> cellIndicesForBoundingBoxes;
|
||||
std::vector<cvf::BoundingBox> cellBoundingBoxes;
|
||||
@ -862,9 +870,10 @@ void RigMainGrid::buildCellSearchTree()
|
||||
#pragma omp for
|
||||
for ( int cIdx = 0; cIdx < (int)cellCount; ++cIdx )
|
||||
{
|
||||
if ( m_cells[cIdx].isInvalid() ) continue;
|
||||
auto& cell = this->cell( cIdx );
|
||||
if ( cell.isInvalid() ) continue;
|
||||
|
||||
const std::array<size_t, 8>& cellIndices = m_cells[cIdx].cornerIndices();
|
||||
const std::array<size_t, 8>& cellIndices = cell.cornerIndices();
|
||||
|
||||
cvf::BoundingBox cellBB;
|
||||
for ( size_t i : cellIndices )
|
||||
|
@ -43,12 +43,11 @@ public:
|
||||
RigMainGrid();
|
||||
~RigMainGrid() override;
|
||||
|
||||
virtual size_t totalCellCount() const;
|
||||
|
||||
std::vector<cvf::Vec3d>& nodes();
|
||||
const std::vector<cvf::Vec3d>& nodes() const;
|
||||
|
||||
std::vector<RigCell>& globalCellArray();
|
||||
const std::vector<RigCell>& globalCellArray() const;
|
||||
|
||||
virtual RigGridBase* gridAndGridLocalIdxFromGlobalCellIdx( size_t globalCellIdx, size_t* gridLocalCellIdx );
|
||||
virtual const RigGridBase* gridAndGridLocalIdxFromGlobalCellIdx( size_t globalCellIdx, size_t* gridLocalCellIdx ) const;
|
||||
|
||||
@ -114,6 +113,10 @@ public:
|
||||
bool isDualPorosity() const;
|
||||
void setDualPorosity( bool enable );
|
||||
|
||||
public: // only for use by file readers!
|
||||
std::vector<RigCell>& reservoirCells();
|
||||
const std::vector<RigCell>& reservoirCells() const;
|
||||
|
||||
protected:
|
||||
void initAllSubCellsMainGridCellIndex();
|
||||
void buildCellSearchTree();
|
||||
|
@ -68,8 +68,8 @@ void RigNNCData::buildPolygonsForEclipseConnections()
|
||||
#pragma omp parallel for
|
||||
for ( int cnIdx = 0; cnIdx < static_cast<int>( eclipseConnectionCount() ); ++cnIdx )
|
||||
{
|
||||
const RigCell& c1 = m_mainGrid->globalCellArray()[m_connections[cnIdx].c1GlobIdx()];
|
||||
const RigCell& c2 = m_mainGrid->globalCellArray()[m_connections[cnIdx].c2GlobIdx()];
|
||||
const RigCell& c1 = m_mainGrid->cell( m_connections[cnIdx].c1GlobIdx() );
|
||||
const RigCell& c2 = m_mainGrid->cell( m_connections[cnIdx].c2GlobIdx() );
|
||||
|
||||
std::vector<size_t> connectionPolygon;
|
||||
std::vector<cvf::Vec3d> connectionIntersections;
|
||||
|
@ -330,11 +330,11 @@ void RigNumberOfFloodedPoreVolumesCalculator::distributeNeighbourCellFlow( RigMa
|
||||
{
|
||||
RigActiveCellInfo* actCellInfo = caseToApply->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
|
||||
for ( size_t globalCellIndex = 0; globalCellIndex < mainGrid->globalCellArray().size(); globalCellIndex++ )
|
||||
for ( size_t globalCellIndex = 0; globalCellIndex < mainGrid->totalCellCount(); globalCellIndex++ )
|
||||
{
|
||||
if ( !actCellInfo->isActive( globalCellIndex ) ) continue;
|
||||
|
||||
const RigCell& cell = mainGrid->globalCellArray()[globalCellIndex];
|
||||
const RigCell& cell = mainGrid->cell( globalCellIndex );
|
||||
RigGridBase* hostGrid = cell.hostGrid();
|
||||
size_t gridLocalCellIndex = cell.gridLocalCellIndex();
|
||||
|
||||
|
@ -75,7 +75,7 @@ void RigReservoirBuilder::createGridsAndCells( RigEclipseCaseData* eclipseCase )
|
||||
size_t mainGridCellCount = mainGridNodeCount / 8;
|
||||
|
||||
// Must create cells in main grid here, as this information is used when creating LGRs
|
||||
appendCells( 0, mainGridCellCount, eclipseCase->mainGrid(), eclipseCase->mainGrid()->globalCellArray() );
|
||||
appendCells( 0, mainGridCellCount, eclipseCase->mainGrid(), eclipseCase->mainGrid()->reservoirCells() );
|
||||
|
||||
size_t totalCellCount = mainGridCellCount;
|
||||
|
||||
@ -125,7 +125,7 @@ void RigReservoirBuilder::createGridsAndCells( RigEclipseCaseData* eclipseCase )
|
||||
size_t cellIdx;
|
||||
for ( cellIdx = 0; cellIdx < mainGridIndicesWithSubGrid.size(); cellIdx++ )
|
||||
{
|
||||
RigCell& cell = eclipseCase->mainGrid()->globalCellArray()[mainGridIndicesWithSubGrid[cellIdx]];
|
||||
RigCell& cell = eclipseCase->mainGrid()->cell( mainGridIndicesWithSubGrid[cellIdx] );
|
||||
|
||||
std::array<size_t, 8>& indices = cell.cornerIndices();
|
||||
int nodeIdx;
|
||||
@ -141,7 +141,7 @@ void RigReservoirBuilder::createGridsAndCells( RigEclipseCaseData* eclipseCase )
|
||||
appendNodes( bb.min(), bb.max(), lgrCellDimensions, mainGridNodes );
|
||||
|
||||
size_t subGridCellCount = ( mainGridNodes.size() / 8 ) - totalCellCount;
|
||||
appendCells( totalCellCount * 8, subGridCellCount, localGrid, eclipseCase->mainGrid()->globalCellArray() );
|
||||
appendCells( totalCellCount * 8, subGridCellCount, localGrid, eclipseCase->mainGrid()->reservoirCells() );
|
||||
totalCellCount += subGridCellCount;
|
||||
}
|
||||
|
||||
@ -149,14 +149,14 @@ void RigReservoirBuilder::createGridsAndCells( RigEclipseCaseData* eclipseCase )
|
||||
|
||||
// Set all cells active
|
||||
RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
activeCellInfo->setReservoirCellCount( eclipseCase->mainGrid()->globalCellArray().size() );
|
||||
for ( size_t i = 0; i < eclipseCase->mainGrid()->globalCellArray().size(); i++ )
|
||||
activeCellInfo->setReservoirCellCount( eclipseCase->mainGrid()->totalCellCount() );
|
||||
for ( size_t i = 0; i < eclipseCase->mainGrid()->totalCellCount(); i++ )
|
||||
{
|
||||
activeCellInfo->setCellResultIndex( i, i );
|
||||
}
|
||||
|
||||
activeCellInfo->setGridCount( 1 );
|
||||
activeCellInfo->setGridActiveCellCounts( 0, eclipseCase->mainGrid()->globalCellArray().size() );
|
||||
activeCellInfo->setGridActiveCellCounts( 0, eclipseCase->mainGrid()->totalCellCount() );
|
||||
activeCellInfo->computeDerivedData();
|
||||
|
||||
bool useOptimizedVersion = false; // workaround, optimized version causes assert in debug builds
|
||||
|
@ -116,7 +116,7 @@ bool RigReservoirBuilderMock::inputProperty( RigEclipseCaseData* eclipseCase, co
|
||||
/* generate secret number: */
|
||||
int iSecret = rand() % 20 + 1;
|
||||
|
||||
for ( k = 0; k < eclipseCase->mainGrid()->globalCellArray().size(); k++ )
|
||||
for ( k = 0; k < eclipseCase->mainGrid()->totalCellCount(); k++ )
|
||||
{
|
||||
values->push_back( k * iSecret );
|
||||
}
|
||||
@ -129,12 +129,12 @@ bool RigReservoirBuilderMock::inputProperty( RigEclipseCaseData* eclipseCase, co
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigReservoirBuilderMock::staticResult( RigEclipseCaseData* eclipseCase, const QString& result, std::vector<double>* values )
|
||||
{
|
||||
values->resize( eclipseCase->mainGrid()->globalCellArray().size() );
|
||||
values->resize( eclipseCase->mainGrid()->totalCellCount() );
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( long long k = 0; k < static_cast<long long>( eclipseCase->mainGrid()->globalCellArray().size() ); k++ )
|
||||
for ( long long k = 0; k < static_cast<long long>( eclipseCase->mainGrid()->totalCellCount() ); k++ )
|
||||
{
|
||||
values->at( k ) = ( k * 2 ) % eclipseCase->mainGrid()->globalCellArray().size();
|
||||
values->at( k ) = ( k * 2 ) % eclipseCase->mainGrid()->totalCellCount();
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -157,12 +157,12 @@ bool RigReservoirBuilderMock::dynamicResult( RigEclipseCaseData* eclipseCase, co
|
||||
double scaleValue = 1.0 + resultIndex * 0.1;
|
||||
double offsetValue = 100 * resultIndex;
|
||||
|
||||
values->resize( eclipseCase->mainGrid()->globalCellArray().size() );
|
||||
values->resize( eclipseCase->mainGrid()->totalCellCount() );
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( long long k = 0; k < static_cast<long long>( eclipseCase->mainGrid()->globalCellArray().size() ); k++ )
|
||||
for ( long long k = 0; k < static_cast<long long>( eclipseCase->mainGrid()->totalCellCount() ); k++ )
|
||||
{
|
||||
double val = offsetValue + scaleValue * ( ( stepIndex * 1000 + k ) % eclipseCase->mainGrid()->globalCellArray().size() );
|
||||
double val = offsetValue + scaleValue * ( ( stepIndex * 1000 + k ) % eclipseCase->mainGrid()->totalCellCount() );
|
||||
values->at( k ) = val;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ cvf::Vec3d RigStimPlanModelTools::calculateTSTDirection( RigEclipseCaseData* ecl
|
||||
int numContributingCells = 0;
|
||||
for ( size_t globalCellIndex : closeCells )
|
||||
{
|
||||
const RigCell& cell = mainGrid->globalCellArray()[globalCellIndex];
|
||||
const RigCell& cell = mainGrid->cell( globalCellIndex );
|
||||
|
||||
if ( !cell.isInvalid() )
|
||||
{
|
||||
@ -128,7 +128,7 @@ std::tuple<const RigFault*, double, cvf::Vec3d, double> RigStimPlanModelTools::f
|
||||
shortestDistance = distance;
|
||||
barrierPosition = intersection.startPoint;
|
||||
|
||||
const RigCell& cell = mainGrid->globalCellArray()[intersection.globCellIndex];
|
||||
const RigCell& cell = mainGrid->cell( intersection.globCellIndex );
|
||||
cvf::Vec3d faceNormal = cell.faceNormalWithAreaLength( intersection.intersectedCellFaceIn );
|
||||
barrierDip = RigStimPlanModelTools::calculateFormationDip( faceNormal );
|
||||
}
|
||||
|
@ -316,19 +316,18 @@ std::vector<size_t> RigWellTargetCandidatesGenerator::findCandidates( const RimE
|
||||
cvf::StructGridInterface::FaceType::NEG_K,
|
||||
};
|
||||
|
||||
size_t resultIndex = resultsData->activeCellInfo()->cellResultIndex( cellIdx );
|
||||
size_t resultIndex = resultsData->activeCellInfo()->cellResultIndex( cellIdx );
|
||||
const RigCell& nativeCell = eclipseCase.mainGrid()->cell( cellIdx );
|
||||
RigGridBase* grid = nativeCell.hostGrid();
|
||||
size_t gridLocalNativeCellIndex = nativeCell.gridLocalCellIndex();
|
||||
|
||||
size_t i, j, k;
|
||||
|
||||
grid->ijkFromCellIndex( gridLocalNativeCellIndex, &i, &j, &k );
|
||||
|
||||
for ( cvf::StructGridInterface::FaceType face : faces )
|
||||
{
|
||||
const RigCell& nativeCell = eclipseCase.mainGrid()->globalCellArray()[cellIdx];
|
||||
RigGridBase* grid = nativeCell.hostGrid();
|
||||
|
||||
size_t gridLocalNativeCellIndex = nativeCell.gridLocalCellIndex();
|
||||
|
||||
size_t i, j, k, gridLocalNeighborCellIdx;
|
||||
|
||||
grid->ijkFromCellIndex( gridLocalNativeCellIndex, &i, &j, &k );
|
||||
|
||||
size_t gridLocalNeighborCellIdx;
|
||||
if ( grid->cellIJKNeighbor( i, j, k, face, &gridLocalNeighborCellIdx ) )
|
||||
{
|
||||
size_t neighborResvCellIdx = grid->reservoirCellIndex( gridLocalNeighborCellIdx );
|
||||
|
@ -189,7 +189,9 @@ public:
|
||||
hostCellK.reserve( numMatrixModelActiveCells );
|
||||
globalCoarseningBoxIdx.reserve( numMatrixModelActiveCells );
|
||||
|
||||
const std::vector<RigCell>& reservoirCells = reservoirCase->eclipseCaseData()->mainGrid()->globalCellArray();
|
||||
// const std::vector<RigCell>& reservoirCells = reservoirCase->eclipseCaseData()->mainGrid()->globalCellArray();
|
||||
|
||||
auto mainGrid = reservoirCase->eclipseCaseData()->mainGrid();
|
||||
|
||||
std::vector<size_t> globalCoarseningBoxIndexStart;
|
||||
{
|
||||
@ -206,13 +208,14 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
for ( size_t cIdx = 0; cIdx < reservoirCells.size(); ++cIdx )
|
||||
for ( size_t cIdx = 0; cIdx < mainGrid->totalCellCount(); ++cIdx )
|
||||
{
|
||||
if ( actCellInfo->isActive( cIdx ) )
|
||||
{
|
||||
RigGridBase* grid = reservoirCells[cIdx].hostGrid();
|
||||
auto& cell = mainGrid->cell( cIdx );
|
||||
RigGridBase* grid = cell.hostGrid();
|
||||
CVF_ASSERT( grid != nullptr );
|
||||
size_t cellIndex = reservoirCells[cIdx].gridLocalCellIndex();
|
||||
size_t cellIndex = cell.gridLocalCellIndex();
|
||||
|
||||
size_t i, j, k;
|
||||
grid->ijkFromCellIndex( cellIndex, &i, &j, &k );
|
||||
@ -229,7 +232,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t parentCellIdx = reservoirCells[cIdx].parentCellIndex();
|
||||
size_t parentCellIdx = cell.parentCellIndex();
|
||||
parentGrid = ( static_cast<RigLocalGrid*>( grid ) )->parentGrid();
|
||||
CVF_ASSERT( parentGrid != nullptr );
|
||||
parentGrid->ijkFromCellIndex( parentCellIdx, &pi, &pj, &pk );
|
||||
@ -245,7 +248,7 @@ public:
|
||||
hostCellJ.push_back( static_cast<qint32>( pj + 1 ) ); // NB: 1-based index in Octave
|
||||
hostCellK.push_back( static_cast<qint32>( pk + 1 ) ); // NB: 1-based index in Octave
|
||||
|
||||
size_t coarseningIdx = reservoirCells[cIdx].coarseningBoxIndex();
|
||||
size_t coarseningIdx = cell.coarseningBoxIndex();
|
||||
if ( coarseningIdx != cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
size_t globalCoarseningIdx = globalCoarseningBoxIndexStart[grid->gridIndex()] + coarseningIdx;
|
||||
|
@ -203,11 +203,11 @@ public:
|
||||
{
|
||||
quint64 valueIndex = 0;
|
||||
|
||||
for ( size_t reservoirCellIndex = 0; reservoirCellIndex < mainGrid->globalCellArray().size(); reservoirCellIndex++ )
|
||||
for ( size_t reservoirCellIndex = 0; reservoirCellIndex < mainGrid->totalCellCount(); reservoirCellIndex++ )
|
||||
{
|
||||
if ( !actCellInfo->isActive( reservoirCellIndex ) ) continue;
|
||||
|
||||
cvf::Vec3d center = mainGrid->globalCellArray()[reservoirCellIndex].center();
|
||||
cvf::Vec3d center = mainGrid->cell( reservoirCellIndex ).center();
|
||||
|
||||
convertVec3dToPositiveDepth( ¢er );
|
||||
|
||||
@ -377,7 +377,7 @@ public:
|
||||
|
||||
quint64 valueIndex = 0;
|
||||
|
||||
for ( size_t reservoirCellIndex = 0; reservoirCellIndex < mainGrid->globalCellArray().size(); reservoirCellIndex++ )
|
||||
for ( size_t reservoirCellIndex = 0; reservoirCellIndex < mainGrid->totalCellCount(); reservoirCellIndex++ )
|
||||
{
|
||||
if ( !actCellInfo->isActive( reservoirCellIndex ) ) continue;
|
||||
|
||||
|
@ -73,8 +73,8 @@ public:
|
||||
{
|
||||
RigConnection connection = mainGrid->nncData()->allConnections()[i];
|
||||
|
||||
const RigCell& cell1 = mainGrid->globalCellArray()[connection.c1GlobIdx()];
|
||||
const RigCell& cell2 = mainGrid->globalCellArray()[connection.c2GlobIdx()];
|
||||
const RigCell& cell1 = mainGrid->cell( connection.c1GlobIdx() );
|
||||
const RigCell& cell2 = mainGrid->cell( connection.c2GlobIdx() );
|
||||
|
||||
sendCellInfo( socketStream, cell1 );
|
||||
sendCellInfo( socketStream, cell2 );
|
||||
|
@ -933,7 +933,7 @@ public:
|
||||
// The size of this array must match the test in RigCaseCellResultsData::isUsingGlobalActiveIndex(),
|
||||
// as it is used to determine if we have data for active cells or all cells
|
||||
// See RigCaseCellResultsData::isUsingGlobalActiveIndex()
|
||||
size_t totalNumberOfCellsIncludingLgrCells = grid->mainGrid()->globalCellArray().size();
|
||||
size_t totalNumberOfCellsIncludingLgrCells = grid->mainGrid()->totalCellCount();
|
||||
|
||||
m_scalarResultsToAdd->at( tsId ).resize( totalNumberOfCellsIncludingLgrCells, HUGE_VAL );
|
||||
}
|
||||
|
@ -45,10 +45,9 @@ TEST( RigEclipseWellLogExtractor, ShortWellPathInsideOneCell )
|
||||
reservoir->mainGrid()->computeCachedData();
|
||||
}
|
||||
|
||||
auto cells = reservoir->mainGrid()->globalCellArray();
|
||||
EXPECT_FALSE( cells.empty() );
|
||||
EXPECT_FALSE( reservoir->mainGrid()->totalCellCount() == 0 );
|
||||
|
||||
auto firstCell = reservoir->mainGrid()->globalCellArray()[0];
|
||||
auto firstCell = reservoir->mainGrid()->cell( 0 );
|
||||
auto center = firstCell.center();
|
||||
|
||||
cvf::ref<RigWellPath> wellPathGeometry = new RigWellPath;
|
||||
|
@ -96,7 +96,7 @@ RiuResultTextBuilder::RiuResultTextBuilder( RimGridView* settings
|
||||
RigEclipseCaseData* caseData = eclipseCase->eclipseCaseData();
|
||||
RigMainGrid* mainGrid = caseData->mainGrid();
|
||||
|
||||
const RigCell& cell = caseData->mainGrid()->globalCellArray()[reservoirCellIndex];
|
||||
const RigCell& cell = caseData->mainGrid()->cell( reservoirCellIndex );
|
||||
|
||||
for ( size_t i = 0; i < mainGrid->gridCount(); i++ )
|
||||
{
|
||||
@ -922,8 +922,8 @@ QString RiuResultTextBuilder::nncDetails()
|
||||
|
||||
// First cell of NNC
|
||||
{
|
||||
CVF_ASSERT( conn.c1GlobIdx() < grid->globalCellArray().size() );
|
||||
const RigCell& cell = grid->globalCellArray()[conn.c1GlobIdx()];
|
||||
CVF_ASSERT( conn.c1GlobIdx() < grid->totalCellCount() );
|
||||
const RigCell& cell = grid->cell( conn.c1GlobIdx() );
|
||||
|
||||
RigGridBase* hostGrid = cell.hostGrid();
|
||||
size_t gridLocalCellIndex = cell.gridLocalCellIndex();
|
||||
@ -944,8 +944,8 @@ QString RiuResultTextBuilder::nncDetails()
|
||||
|
||||
// Second cell of NNC
|
||||
{
|
||||
CVF_ASSERT( conn.c2GlobIdx() < grid->globalCellArray().size() );
|
||||
const RigCell& cell = grid->globalCellArray()[conn.c2GlobIdx()];
|
||||
CVF_ASSERT( conn.c2GlobIdx() < grid->totalCellCount() );
|
||||
const RigCell& cell = grid->cell( conn.c2GlobIdx() );
|
||||
|
||||
RigGridBase* hostGrid = cell.hostGrid();
|
||||
size_t gridLocalCellIndex = cell.gridLocalCellIndex();
|
||||
|
@ -1066,7 +1066,7 @@ void RiuViewerCommands::findCellAndGridIndex( Rim3dView* m
|
||||
|
||||
if ( eclipseCase )
|
||||
{
|
||||
const RigCell& cell = eclipseCase->mainGrid()->globalCellArray()[globalCellIndex];
|
||||
const RigCell& cell = eclipseCase->mainGrid()->cell( globalCellIndex );
|
||||
*cellIndex = cell.gridLocalCellIndex();
|
||||
*gridIndex = cell.hostGrid()->gridIndex();
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ grpc::Status RiaActiveCellInfoStateHandler::init( const rips::CellInfoRequest* r
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
grpc::Status RiaActiveCellInfoStateHandler::assignNextActiveCellInfoData( rips::CellInfo* cellInfo )
|
||||
{
|
||||
const std::vector<RigCell>& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->globalCellArray();
|
||||
const std::vector<RigCell>& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->reservoirCells();
|
||||
|
||||
while ( m_currentCellIdx < reservoirCells.size() )
|
||||
{
|
||||
@ -182,7 +182,7 @@ RigActiveCellInfo* RiaActiveCellInfoStateHandler::activeCellInfo() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<RigCell>& RiaActiveCellInfoStateHandler::reservoirCells() const
|
||||
{
|
||||
const std::vector<RigCell>& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->globalCellArray();
|
||||
const std::vector<RigCell>& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->reservoirCells();
|
||||
return reservoirCells;
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ grpc::Status RiaActiveCellInfoStateHandler::assignReply( rips::CellInfoArray* re
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
grpc::Status RiaActiveCellInfoStateHandler::assignNextActiveCellCenter( rips::Vec3d* cellCenter )
|
||||
{
|
||||
const std::vector<RigCell>& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->globalCellArray();
|
||||
const std::vector<RigCell>& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->reservoirCells();
|
||||
|
||||
while ( m_currentCellIdx < reservoirCells.size() )
|
||||
{
|
||||
@ -288,7 +288,7 @@ grpc::Status RiaActiveCellInfoStateHandler::assignCellCentersReply( rips::CellCe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Status RiaActiveCellInfoStateHandler::assignNextActiveCellCorners( rips::CellCorners* cellCorners )
|
||||
{
|
||||
const std::vector<RigCell>& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->globalCellArray();
|
||||
const std::vector<RigCell>& reservoirCells = m_eclipseCase->eclipseCaseData()->mainGrid()->reservoirCells();
|
||||
|
||||
while ( m_currentCellIdx < reservoirCells.size() )
|
||||
{
|
||||
|
@ -100,8 +100,8 @@ grpc::Status RiaNNCConnectionsStateHandler::assignReply( rips::NNCConnections* r
|
||||
for ( ; indexInPackage < packageSize && m_currentIdx < connectionCount; ++indexInPackage )
|
||||
{
|
||||
const RigConnection& connection = connections[m_currentIdx];
|
||||
const RigCell& cell1 = mainGrid->globalCellArray()[connection.c1GlobIdx()];
|
||||
const RigCell& cell2 = mainGrid->globalCellArray()[connection.c2GlobIdx()];
|
||||
const RigCell& cell1 = mainGrid->cell( connection.c1GlobIdx() );
|
||||
const RigCell& cell2 = mainGrid->cell( connection.c2GlobIdx() );
|
||||
|
||||
NNCConnection* nncConnection = reply->add_connections();
|
||||
nncConnection->set_allocated_cell1( createConnectionVec3i( cell1 ) );
|
||||
|
@ -373,7 +373,7 @@ protected:
|
||||
auto resultValues = caseData->results( porosityModel )->modifiableCellScalarResult( resVarAddr, timeStepIndex );
|
||||
if ( resultValues && resultValues->empty() && m_cellCount > 0 )
|
||||
{
|
||||
auto totalCellCount = caseData->mainGrid()->globalCellArray().size();
|
||||
auto totalCellCount = caseData->mainGrid()->totalCellCount();
|
||||
resultValues->resize( totalCellCount );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user