From b3eef0d1aae7adb3bb9ade1159bba39ce0995cb9 Mon Sep 17 00:00:00 2001 From: Corentin Cadiou Date: Fri, 3 Nov 2023 14:37:47 +0000 Subject: [PATCH] Preallocate given maximal size --- yt/frontends/ramses/io_utils.pyx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/yt/frontends/ramses/io_utils.pyx b/yt/frontends/ramses/io_utils.pyx index 335176eff2e..579f36ec439 100644 --- a/yt/frontends/ramses/io_utils.pyx +++ b/yt/frontends/ramses/io_utils.pyx @@ -188,7 +188,7 @@ def fill_hydro(FortranFile f, jump_len += 1 jumps[j] = jump_len - cdef int nc_largest = 0 + buffer = np.empty((level_count.max(), twotondim, nfields_selected), dtype="float64", order='F') # Loop over levels for ilevel in range(nlevels): # Loop over cpu domains @@ -201,11 +201,6 @@ def fill_hydro(FortranFile f, if offset == -1: continue f.seek(offset) - # Initialize temporary data container for io - # note: we use Fortran ordering to reflect the in-file ordering - if nc > nc_largest: - nc_largest = nc - buffer = np.empty((nc, twotondim, nfields_selected), dtype="float64", order='F') jump_len = 0 for i in range(twotondim):