From 79e9ff7c8bdc8bd705639e60bb90f8bb050003e3 Mon Sep 17 00:00:00 2001 From: Matthew Turk Date: Wed, 21 Jun 2023 10:21:29 -0500 Subject: [PATCH] Reduce the number of passes over the grid array. --- yt/geometry/grid_container.pyx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/yt/geometry/grid_container.pyx b/yt/geometry/grid_container.pyx index d65a687182e..8f96bf8192b 100644 --- a/yt/geometry/grid_container.pyx +++ b/yt/geometry/grid_container.pyx @@ -204,11 +204,7 @@ cdef class GridTree: data.array = mask.buf self.visit_grids(&data, grid_visitors.mask_cells, selector) self.mask = mask - size = 0 - self.setup_data(&data) - data.array = (&size) - self.visit_grids(&data, grid_visitors.count_cells, selector) - return size + return mask.count() def select_icoords(self, SelectorObject selector, np.uint64_t size = -1): # Fill icoords with a selector