mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-30 09:00:20 -05:00
The leaf-node cap that selects between the optimized and the non-optimized cell search tree construction used cellCount(), which only counts main grid cells and excludes LGR cells. The non-optimized buildCellSearchTree() iterates totalCellCount() (main grid plus all LGR cells) and creates one leaf per cell, so a grid with few main cells but many LGR cells could be routed into that path and exhaust memory, crashing while building the AABB tree. Base the threshold on totalCellCount() so LGR-inflated grids are routed to the optimized aggregating path and the leaf count stays bounded.