diff --git a/ApplicationCode/ProjectDataModel/RimReservoirView.cpp b/ApplicationCode/ProjectDataModel/RimReservoirView.cpp index 9db070259b..826a181af9 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoirView.cpp +++ b/ApplicationCode/ProjectDataModel/RimReservoirView.cpp @@ -1431,12 +1431,16 @@ void RimReservoirView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibl const std::vector< RigWellResultFrame >& wellResFrames = wres->m_wellCellsTimeSteps; for (size_t wfIdx = 0; wfIdx < wellResFrames.size(); ++wfIdx) { - // Add the wellhead cell - + // Add the wellhead cell if it is active if (wellResFrames[wfIdx].m_wellHead.m_gridIndex == grid->gridIndex()) { size_t gridCellIndex = wellResFrames[wfIdx].m_wellHead.m_gridCellIndex; - (*visibleCells)[gridCellIndex] = true; + size_t globalGridCellIndex = grid->globalGridCellIndex(gridCellIndex); + + if (activeCellInfo->isActive(globalGridCellIndex)) + { + (*visibleCells)[gridCellIndex] = true; + } } // Add all the cells from the branches diff --git a/ApplicationCode/ReservoirDataModel/RigCaseData.cpp b/ApplicationCode/ReservoirDataModel/RigCaseData.cpp index 5884f68ebf..c9483020e0 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseData.cpp @@ -164,10 +164,15 @@ void RigCaseData::computeWellCellsPrGrid() size_t gridIndex = wellCells.m_wellHead.m_gridIndex; size_t gridCellIndex = wellCells.m_wellHead.m_gridCellIndex; - if (gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T) + if (gridIndex < m_wellCellsInGrid.size() && gridCellIndex < m_wellCellsInGrid[gridIndex]->size()) { - m_wellCellsInGrid[gridIndex]->set(gridCellIndex, true); - m_gridCellToWellIndex[gridIndex]->set(gridCellIndex, static_cast(wIdx)); + size_t globalGridCellIndex = grids[gridIndex]->globalGridCellIndex(gridCellIndex); + if (m_activeCellInfo->isActive(globalGridCellIndex) + || m_fractureActiveCellInfo->isActive(globalGridCellIndex)) + { + m_wellCellsInGrid[gridIndex]->set(gridCellIndex, true); + m_gridCellToWellIndex[gridIndex]->set(gridCellIndex, static_cast(wIdx)); + } } size_t sIdx;