Skip to content

Commit 1c00f01

Browse files
committed
temp
1 parent d244e03 commit 1c00f01

File tree

1 file changed

+35
-36
lines changed

1 file changed

+35
-36
lines changed

grudge/discretization.py

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474

7575

7676
PartID = Tuple[VolumeTag, int]
77-
ConvertibleToPartID = Union[Tuple[()], VolumeTag, int, PartID]
7877

7978

8079
# {{{ part ID normalization
@@ -190,7 +189,7 @@ def __init__(self, array_context: ArrayContext,
190189
Mapping[DiscretizationTag, ElementGroupFactory]] = None,
191190
mpi_communicator: Optional["mpi4py.MPI.Intracomm"] = None,
192191
inter_part_connections: Optional[
193-
Mapping[Tuple[ConvertibleToPartID, ConvertibleToPartID],
192+
Mapping[Tuple[PartID, PartID],
194193
DiscretizationConnection]] = None,
195194
) -> None:
196195
"""
@@ -287,32 +286,7 @@ def promote_to_part_id(key):
287286
"DiscretizationCollection constructor is called in "
288287
"'modern' mode")
289288

290-
if VTAG_ALL not in volume_discrs.keys():
291-
# Multi-volume
292-
if mpi_communicator is not None:
293-
def promote_to_part_id(key):
294-
return key
295-
else:
296-
def promote_to_part_id(key):
297-
return (key, None)
298-
else:
299-
# Single-volume
300-
if mpi_communicator is not None:
301-
def promote_to_part_id(key):
302-
return (VTAG_ALL, key)
303-
else:
304-
def promote_to_part_id(key):
305-
return (VTAG_ALL, None)
306-
307-
volume_discrs = {
308-
vtag: Discretization(
309-
array_context, _normalize_mesh_part_ids(volume_discr.mesh),
310-
self.group_factory_for_discretization_tag(DISCR_TAG_BASE))
311-
for vtag, volume_discr in volume_discrs.items()}
312-
313-
self._inter_part_connections = {
314-
promote_to_part_id(key): value
315-
for key, value in inter_part_connections.items()}
289+
self._inter_part_connections = inter_part_connections
316290

317291
self._volume_discrs = volume_discrs
318292

@@ -979,16 +953,41 @@ def make_discretization_collection(
979953

980954
del order
981955

982-
volume_discrs = {
983-
vtag: (
984-
Discretization(
985-
array_context, mesh_or_discr,
986-
discr_tag_to_group_factory[DISCR_TAG_BASE])
987-
if isinstance(mesh_or_discr, Mesh) else mesh_or_discr)
988-
for vtag, mesh_or_discr in volumes.items()}
989-
990956
mpi_communicator = getattr(array_context, "mpi_communicator", None)
991957

958+
if mpi_communicator is not None:
959+
rank = mpi_communicator.Get_rank()
960+
else:
961+
rank = None
962+
963+
if VTAG_ALL not in volumes.keys():
964+
# Multi-volume
965+
if mpi_communicator is not None:
966+
def promote_to_part_id(key):
967+
return key
968+
else:
969+
def promote_to_part_id(key):
970+
return (key, None)
971+
else:
972+
# Single-volume
973+
if mpi_communicator is not None:
974+
def promote_to_part_id(key):
975+
return (VTAG_ALL, key)
976+
else:
977+
def promote_to_part_id(key):
978+
return (VTAG_ALL, None)
979+
980+
if any(
981+
isinstance(mesh_or_discr, Discretization)
982+
for mesh_or_discr in volumes.values()):
983+
raise NotImplementedError("Doesn't work at the moment")
984+
985+
volume_discrs = {
986+
vtag: Discretization(
987+
array_context, _normalize_mesh_part_ids(mesh, promote_to_part_id),
988+
discr_tag_to_group_factory[DISCR_TAG_BASE])
989+
for vtag, mesh in volumes.items()}
990+
992991
return DiscretizationCollection(
993992
array_context=array_context,
994993
volume_discrs=volume_discrs,

0 commit comments

Comments
 (0)