Skip to content

Commit

Permalink
Don't consider AMRGridPatch objects iterable
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewturk committed Jun 23, 2023
1 parent bd55726 commit 222764c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion yt/data_objects/index_subobjects/grid_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _setup_dx(self):
id = self.id - self._id_offset
ds = self.ds
index = self.index
parents = list(always_iterable(self.Parent))
parents = list(always_iterable(self.Parent, base_type=(AMRGridPatch,)))
if len(parents) > 0:
if not hasattr(parents[0], "dds"):
parents[0]._setup_dx()
Expand Down
5 changes: 4 additions & 1 deletion yt/geometry/grid_geometry_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ def _find_points(self, x, y, z):

@cached_property
def grid_tree(self):
# For order-of-import, we import this here
from yt.data_objects.index_subobjects.grid_patch import AMRGridPatch

left_edge = self.ds.arr(np.zeros((self.num_grids, 3)), "code_length")
right_edge = self.ds.arr(np.zeros((self.num_grids, 3)), "code_length")
level = np.zeros((self.num_grids), dtype="int64")
Expand All @@ -309,7 +312,7 @@ def grid_tree(self):
left_edge[i, :] = grid.LeftEdge
right_edge[i, :] = grid.RightEdge
level[i] = grid.Level
parents = list(always_iterable(grid.Parent))
parents = list(always_iterable(grid.Parent, base_type=(AMRGridPatch,)))
if len(parents) == 0 or parents[0] is None:
parent_ind.append([-1])
else:
Expand Down

0 comments on commit 222764c

Please sign in to comment.