mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix crash due to global/local grid index mixup when creating fractures on SimWellPaths.
* Introduces a convenience method on the main grid * Also converts some callers to use the convenience method.
This commit is contained in:
@@ -47,6 +47,33 @@ RigMainGrid::~RigMainGrid(void)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigGridBase* RigMainGrid::gridAndGridLocalIdxFromGlobalCellIdx(size_t globalCellIdx, size_t* gridLocalCellIdx)
|
||||
{
|
||||
CVF_ASSERT(globalCellIdx < m_cells.size());
|
||||
RigCell& cell = m_cells[globalCellIdx];
|
||||
RigGridBase* hostGrid = cell.hostGrid();
|
||||
CVF_ASSERT(hostGrid);
|
||||
*gridLocalCellIdx = cell.gridLocalCellIndex();
|
||||
return hostGrid;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigGridBase* RigMainGrid::gridAndGridLocalIdxFromGlobalCellIdx(size_t globalCellIdx, size_t* gridLocalCellIdx) const
|
||||
{
|
||||
CVF_ASSERT(globalCellIdx < m_cells.size());
|
||||
const RigCell& cell = m_cells[globalCellIdx];
|
||||
const RigGridBase* hostGrid = cell.hostGrid();
|
||||
CVF_ASSERT(hostGrid);
|
||||
*gridLocalCellIdx = cell.gridLocalCellIndex();
|
||||
return hostGrid;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -313,8 +340,10 @@ void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
|
||||
// Find neighbor cell
|
||||
if (firstNO_FAULTFaceForCell) // To avoid doing this for every face, and only when detecting a NO_FAULT
|
||||
{
|
||||
hostGrid = m_cells[gcIdx].hostGrid();
|
||||
hostGrid->ijkFromCellIndex(m_cells[gcIdx].gridLocalCellIndex(), &i,&j, &k);
|
||||
size_t gridLocalCellIndex;
|
||||
hostGrid = this->gridAndGridLocalIdxFromGlobalCellIdx(gcIdx, &gridLocalCellIndex);
|
||||
|
||||
hostGrid->ijkFromCellIndex(gridLocalCellIndex, &i,&j, &k);
|
||||
isCellActive = activeCellInfo->isActive(gcIdx);
|
||||
|
||||
firstNO_FAULTFaceForCell = false;
|
||||
|
||||
Reference in New Issue
Block a user