Skip to content

Commit fb8a34b

Browse files
committed
accept general integral types as MPI ranks
1 parent a05c626 commit fb8a34b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

grudge/discretization.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def _normalize_mesh_part_ids(
9898
volume_tags: Sequence[VolumeTag],
9999
mpi_communicator: Optional["mpi4py.MPI.Intracomm"] = None):
100100
"""Convert a mesh's configuration-dependent "part ID" into a fixed type."""
101+
from numbers import Integral
101102
if VTAG_ALL not in volume_tags:
102103
# Multi-volume
103104
if mpi_communicator is not None:
@@ -123,8 +124,8 @@ def as_part_id(mesh_part_id):
123124
def as_part_id(mesh_part_id):
124125
if isinstance(mesh_part_id, PartID):
125126
return mesh_part_id
126-
elif isinstance(mesh_part_id, int):
127-
return PartID(VTAG_ALL, mesh_part_id)
127+
elif isinstance(mesh_part_id, Integral):
128+
return PartID(VTAG_ALL, int(mesh_part_id))
128129
else:
129130
raise TypeError(f"Unable to convert {mesh_part_id} to PartID.")
130131
else:

0 commit comments

Comments
 (0)