Skip to content

Commit

Permalink
Workaround for numpy 2.0 issue with pyamg (FEniCS#3274)
Browse files Browse the repository at this point in the history
* Workaround for numpy 2.0 issue

* Fix for np.can_cast
  • Loading branch information
chrisrichardson authored Jun 21, 2024
1 parent 58fd478 commit 5ebca6c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python/demo/demo_pyamg.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

try:
import pyamg
except ImportError:
except (ImportError, AttributeError):
print('This demo requires pyamg, install using "pip install pyamg"')
exit(0)

Expand Down
2 changes: 1 addition & 1 deletion python/dolfinx/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def meshtags(
"""

if isinstance(values, int):
assert np.can_cast(values, np.int32)
assert values >= np.iinfo(np.int32).min and values <= np.iinfo(np.int32).max
values = np.full(entities.shape, values, dtype=np.int32)
elif isinstance(values, float):
values = np.full(entities.shape, values, dtype=np.double)
Expand Down

0 comments on commit 5ebca6c

Please sign in to comment.