Privatize grid cell array

This commit is contained in:
jonjenssen
2024-10-23 20:43:08 +02:00
committed by jonjenssen
parent 69878f54d3
commit 88118ee4e1
49 changed files with 418 additions and 326 deletions

View File

@@ -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 );

View File

@@ -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();

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 );

View File

@@ -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 );

View File

@@ -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;
}

View File

@@ -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;
};

View File

@@ -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 );

View File

@@ -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 );
}

View File

@@ -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() );
}

View File

@@ -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
{

View File

@@ -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,

View File

@@ -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;

View File

@@ -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];
}
//--------------------------------------------------------------------------------------------------

View File

@@ -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 )

View File

@@ -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();

View File

@@ -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;

View File

@@ -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();

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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 );
}

View File

@@ -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 );