mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3531 Temporary LGR : Copy value from main grid cell to temporary cells
This commit is contained in:
parent
8c344a0c6e
commit
577a706b57
@ -1125,9 +1125,11 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
|
|||||||
{
|
{
|
||||||
resultLoadingSucess = false;
|
resultLoadingSucess = false;
|
||||||
}
|
}
|
||||||
else
|
else if (tempGridCellCount > 0)
|
||||||
{
|
{
|
||||||
values.resize(values.size() + tempGridCellCount);
|
values.resize(values.size() + tempGridCellCount);
|
||||||
|
|
||||||
|
assignValuesToTemporaryLgrs(values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1140,9 +1142,10 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
|
|||||||
{
|
{
|
||||||
resultLoadingSucess = false;
|
resultLoadingSucess = false;
|
||||||
}
|
}
|
||||||
else
|
else if (tempGridCellCount > 0)
|
||||||
{
|
{
|
||||||
values.resize(values.size() + tempGridCellCount);
|
values.resize(values.size() + tempGridCellCount);
|
||||||
|
assignValuesToTemporaryLgrs(values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2398,3 +2401,40 @@ bool RigCaseCellResultsData::isDataPresent(size_t scalarResultIndex) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RigCaseCellResultsData::assignValuesToTemporaryLgrs(std::vector<double>& valuesForAllReservoirCells)
|
||||||
|
{
|
||||||
|
CVF_ASSERT(m_activeCellInfo);
|
||||||
|
|
||||||
|
for (size_t gridIdx = 0; gridIdx < m_ownerMainGrid->gridCount(); gridIdx++)
|
||||||
|
{
|
||||||
|
const auto& grid = m_ownerMainGrid->gridByIndex(gridIdx);
|
||||||
|
if (grid->isTempGrid())
|
||||||
|
{
|
||||||
|
for (size_t localCellIdx = 0; localCellIdx < grid->cellCount(); localCellIdx++)
|
||||||
|
{
|
||||||
|
const RigCell& cell = grid->cell(localCellIdx);
|
||||||
|
|
||||||
|
size_t mainGridCellIndex = cell.mainGridCellIndex();
|
||||||
|
size_t reservoirCellIndex = grid->reservoirCellIndex(localCellIdx);
|
||||||
|
|
||||||
|
size_t mainGridCellResultIndex = m_activeCellInfo->cellResultIndex(mainGridCellIndex);
|
||||||
|
size_t cellResultIndex = m_activeCellInfo->cellResultIndex(reservoirCellIndex);
|
||||||
|
|
||||||
|
if (mainGridCellResultIndex != cvf::UNDEFINED_SIZE_T && cellResultIndex != cvf::UNDEFINED_SIZE_T)
|
||||||
|
{
|
||||||
|
double mainGridValue = valuesForAllReservoirCells[mainGridCellResultIndex];
|
||||||
|
|
||||||
|
valuesForAllReservoirCells[cellResultIndex] = mainGridValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RiaLogging::warning("Detected invalid/undefined cells when assigning result values to temporary LGRs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -159,6 +159,8 @@ private: // from RimReservoirCellResultsStorage
|
|||||||
|
|
||||||
bool isDataPresent(size_t scalarResultIndex) const;
|
bool isDataPresent(size_t scalarResultIndex) const;
|
||||||
|
|
||||||
|
void assignValuesToTemporaryLgrs(std::vector<double>& values);
|
||||||
|
|
||||||
cvf::ref<RifReaderInterface> m_readerInterface;
|
cvf::ref<RifReaderInterface> m_readerInterface;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user