Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener committed Aug 18, 2023
1 parent d6e600c commit 0c04f0e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions meshmode/dof_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,14 @@ def __setstate__(self, state):
assert len(axes_tags[idx]) == ary.ndim
assert isinstance(axes_tags[idx], list)

d = actx.from_numpy(ary)

try:
d = actx.from_numpy(ary)._with_new_tags(tags[idx])
d = d._with_new_tags(tags[idx])
except AttributeError:
# 'actx.from_numpy' might return an array that does not have
# '_with_new_tags' (e.g., np.ndarray).
d = actx.from_numpy(ary)
pass

for ida, ax in enumerate(axes_tags[idx]):
d = actx.tag_axis(ida, ax, d)
Expand Down

0 comments on commit 0c04f0e

Please sign in to comment.