@@ -5813,26 +5813,33 @@ cdef class _TreeMesh:
58135813 cell = self .tree.containing_cell(x, y, z)
58145814 row_inds = indices[indptr[i]:indptr[i+ 1 ]]
58155815 row_data = data[indptr[i]:indptr[i+ 1 ]]
5816+ was_outside = False
58165817 if zeros_out:
58175818 if x < cell.points[0 ].location[0 ]- eps:
58185819 row_data[:] = 0.0
58195820 row_inds[:] = 0
5821+ was_outside = True
58205822 elif x > cell.points[3 ].location[0 ]+ eps:
58215823 row_data[:] = 0.0
58225824 row_inds[:] = 0
5825+ was_outside = True
58235826 elif y < cell.points[0 ].location[1 ]- eps:
58245827 row_data[:] = 0.0
58255828 row_inds[:] = 0
5829+ was_outside = True
58265830 elif y > cell.points[3 ].location[1 ]+ eps:
58275831 row_data[:] = 0.0
58285832 row_inds[:] = 0
5833+ was_outside = True
58295834 elif dim == 3 and z < cell.points[0 ].location[2 ]- eps:
58305835 row_data[:] = 0.0
58315836 row_inds[:] = 0
5837+ was_outside = True
58325838 elif dim == 3 and z > cell.points[7 ].location[2 ]+ eps:
58335839 row_data[:] = 0.0
58345840 row_inds[:] = 0
5835- else :
5841+ was_outside = True
5842+ if not was_outside:
58365843 # look + dir and - dir away
58375844 if (
58385845 locations[i, dir ] < cell.location[dir ]
@@ -5964,26 +5971,33 @@ cdef class _TreeMesh:
59645971 cell = self .tree.containing_cell(x, y, z)
59655972 row_inds = indices[indptr[i]:indptr[i+ 1 ]]
59665973 row_data = data[indptr[i]:indptr[i+ 1 ]]
5974+ was_outside = False
59675975 if zeros_out:
59685976 if x < cell.points[0 ].location[0 ]- eps:
59695977 row_data[:] = 0.0
59705978 row_inds[:] = 0
5979+ was_outside = True
59715980 elif x > cell.points[3 ].location[0 ]+ eps:
59725981 row_data[:] = 0.0
59735982 row_inds[:] = 0
5983+ was_outside = True
59745984 elif y < cell.points[0 ].location[1 ]- eps:
59755985 row_data[:] = 0.0
59765986 row_inds[:] = 0
5987+ was_outside = True
59775988 elif y > cell.points[3 ].location[1 ]+ eps:
59785989 row_data[:] = 0.0
59795990 row_inds[:] = 0
5991+ was_outside = True
59805992 elif dim == 3 and z < cell.points[0 ].location[2 ]- eps:
59815993 row_data[:] = 0.0
59825994 row_inds[:] = 0
5995+ was_outside = True
59835996 elif dim == 3 and z > cell.points[7 ].location[2 ]+ eps:
59845997 row_data[:] = 0.0
59855998 row_inds[:] = 0
5986- else :
5999+ was_outside = True
6000+ if not was_outside:
59876001 # Find containing cells
59886002 # Decide order to search based on which face it is closest to
59896003 if dim == 3 :
@@ -6219,26 +6233,33 @@ cdef class _TreeMesh:
62196233 cell = self .tree.containing_cell(x, y, z)
62206234 row_inds = indices[indptr[i]:indptr[i + 1 ]]
62216235 row_data = data[indptr[i]:indptr[i + 1 ]]
6236+ was_outside = False
62226237 if zeros_out:
62236238 if x < cell.points[0 ].location[0 ]- eps:
62246239 row_data[:] = 0.0
62256240 row_inds[:] = 0
6241+ was_outside = True
62266242 elif x > cell.points[3 ].location[0 ]+ eps:
62276243 row_data[:] = 0.0
62286244 row_inds[:] = 0
6245+ was_outside = True
62296246 elif y < cell.points[0 ].location[1 ]- eps:
62306247 row_data[:] = 0.0
62316248 row_inds[:] = 0
6249+ was_outside = True
62326250 elif y > cell.points[3 ].location[1 ]+ eps:
62336251 row_data[:] = 0.0
62346252 row_inds[:] = 0
6253+ was_outside = True
62356254 elif dim == 3 and z < cell.points[0 ].location[2 ]- eps:
62366255 row_data[:] = 0.0
62376256 row_inds[:] = 0
6257+ was_outside = True
62386258 elif dim == 3 and z > cell.points[7 ].location[2 ]+ eps:
62396259 row_data[:] = 0.0
62406260 row_inds[:] = 0
6241- else :
6261+ was_outside = True
6262+ if not was_outside:
62426263 # decide order to search based on distance to each faces
62436264 #
62446265 if (
0 commit comments