From 025831648a42d2c0859c585b3430b26596571eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= Date: Sat, 18 Mar 2023 14:55:12 +0100 Subject: [PATCH] RFC: eliminate some unused deprecated Cython macros --- yt/geometry/particle_oct_container.pyx | 31 +++++++++++++------------ yt/utilities/lib/_octree_raytracing.pyx | 2 -- yt/utilities/lib/amr_kdtools.pyx | 2 -- yt/utilities/lib/grid_traversal.pyx | 1 - 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/yt/geometry/particle_oct_container.pyx b/yt/geometry/particle_oct_container.pyx index 01341f3a2bd..0a7e47d1917 100644 --- a/yt/geometry/particle_oct_container.pyx +++ b/yt/geometry/particle_oct_container.pyx @@ -59,11 +59,6 @@ from ..utilities.lib.ewah_bool_wrap cimport BoolArrayCollection import os -# If set to 1, ghost cells are added at the refined level regardless of if the -# coarse cell containing it is refined in the selector. -# If set to 0, ghost cells are only added at the refined level if the coarse -# index for the ghost cell is refined in the selector. -DEF RefinedExternalGhosts = 1 _bitmask_version = np.uint64(5) @@ -1682,16 +1677,22 @@ cdef class ParticleBitmapSelector: mi1_n = self.neighbor_list1[m] mi2_n = self.neighbor_list2[m] self.coarse_ghosts_bool[mi1_n] = 1 - IF RefinedExternalGhosts == 1: - if mi1_n == mi1: - self.refined_ghosts_bool[mi2_n] = 1 - else: - self.refined_ghosts_list._set(mi1_n, mi2_n) - ELSE: - if mi1_n == mi1: - self.refined_ghosts_bool[mi2_n] = 1 - elif self.is_refined(mi1_n) == 1: - self.refined_ghosts_list._set(mi1_n, mi2_n) + + # Ghost cells are added at the refined level regardless of if the + # coarse cell containing it is refined in the selector. + if mi1_n == mi1: + self.refined_ghosts_bool[mi2_n] = 1 + else: + self.refined_ghosts_list._set(mi1_n, mi2_n) + + # alternative implementation by Megan Lang + # see ed95b1ac2f7105092b1116f9c76568ae27024751 + # Ghost cells are only added at the refined level if the coarse + # index for the ghost cell is refined in the selector. + #if mi1_n == mi1: + # self.refined_ghosts_bool[mi2_n] = 1 + #elif self.is_refined(mi1_n) == 1: + # self.refined_ghosts_list._set(mi1_n, mi2_n) @cython.boundscheck(False) @cython.wraparound(False) diff --git a/yt/utilities/lib/_octree_raytracing.pyx b/yt/utilities/lib/_octree_raytracing.pyx index aafa7386e8c..cd3fb5725ed 100644 --- a/yt/utilities/lib/_octree_raytracing.pyx +++ b/yt/utilities/lib/_octree_raytracing.pyx @@ -10,8 +10,6 @@ import numpy as np cimport cython -DEF Nch = 4 - cdef class _OctreeRayTracing: def __init__(self, np.ndarray LE, np.ndarray RE, int depth): diff --git a/yt/utilities/lib/amr_kdtools.pyx b/yt/utilities/lib/amr_kdtools.pyx index 909c82da46a..f3e06ffdfcb 100644 --- a/yt/utilities/lib/amr_kdtools.pyx +++ b/yt/utilities/lib/amr_kdtools.pyx @@ -15,8 +15,6 @@ cimport numpy as np from cython.view cimport array as cvarray from libc.stdlib cimport free, malloc -DEF Nch = 4 - @cython.boundscheck(False) @cython.wraparound(False) @cython.cdivision(True) diff --git a/yt/utilities/lib/grid_traversal.pyx b/yt/utilities/lib/grid_traversal.pyx index 341cc3db454..055ad3b3f49 100644 --- a/yt/utilities/lib/grid_traversal.pyx +++ b/yt/utilities/lib/grid_traversal.pyx @@ -22,7 +22,6 @@ from yt.utilities.lib.fp_utils cimport fmin from .fixed_interpolator cimport * -DEF Nch = 4 @cython.boundscheck(False) @cython.wraparound(False)