From 4838f046c34f1d7d648c2af4ae053b732b6345cd Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Wed, 31 Jul 2024 12:40:41 -0500 Subject: [PATCH] Use __array_ufunc__ = None to prevent numpy broadcasting --- meshmode/dof_array.py | 3 +-- test/test_array.py | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/meshmode/dof_array.py b/meshmode/dof_array.py index e4fbb90..b097994 100644 --- a/meshmode/dof_array.py +++ b/meshmode/dof_array.py @@ -149,8 +149,7 @@ class DOFArray: self._data = data # Tell numpy that we would like to do our own array math, thank you very much. - # (numpy arrays have priority 0.) - __array_priority__ = 10 + __array_ufunc__ = None @property def array_context(self) -> ArrayContext: diff --git a/test/test_array.py b/test/test_array.py index ddf95c2..27dadc7 100644 --- a/test/test_array.py +++ b/test/test_array.py @@ -63,6 +63,8 @@ class MyContainer: momentum: np.ndarray enthalpy: DOFArray + __array_ufunc__ = None + @property def array_context(self): return self.mass.array_context -- GitLab