Skip to content

Commit

Permalink
ufl update: MixedMesh([list])
Browse files Browse the repository at this point in the history
  • Loading branch information
ksagiyam committed Nov 12, 2024
1 parent e721011 commit 31e4788
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion firedrake/dmhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get_function_space(dm):
if len(meshref_tuple) == 1:
mesh = meshref_tuple[0]()
else:
mesh = MixedMeshGeometry(*(meshref() for meshref in meshref_tuple))
mesh = MixedMeshGeometry([meshref() for meshref in meshref_tuple])
if mesh is None:
raise RuntimeError("Somehow your mesh was collected, this should never happen")
V = firedrake.FunctionSpace(mesh, element, name=name)
Expand Down
2 changes: 1 addition & 1 deletion firedrake/functionspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def rec(eles):
else:
raise ValueError("Can't make mixed space with %s" % type(space))

mixed_mesh_geometry = MixedMeshGeometry(*meshes)
mixed_mesh_geometry = MixedMeshGeometry(meshes)
new = impl.MixedFunctionSpace(spaces, mixed_mesh_geometry.topology, name=name)
return cls.create(new, mixed_mesh_geometry)

Expand Down
2 changes: 1 addition & 1 deletion firedrake/functionspaceimpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def make_function_space(cls, mesh, element, name=None):
# Create a new abstract (Mixed/Real)FunctionSpace, these are neither primal nor dual.
if type(element) is finat.ufl.MixedElement:
if isinstance(mesh, MeshGeometry):
mesh = MixedMeshGeometry(*[mesh for _ in element.sub_elements])
mesh = MixedMeshGeometry([mesh for _ in element.sub_elements])
topology = mesh.topology
else:
if not isinstance(mesh, MixedMeshGeometry):
Expand Down
14 changes: 7 additions & 7 deletions firedrake/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -4690,7 +4690,7 @@ def Submesh(mesh, subdim, subdomain_id, label_name=None, name=None):
class MixedMeshGeometry(ufl.MixedMesh):
"""A representation of mixed mesh geometry."""

def __init__(self, *meshes, set_hierarchy=True):
def __init__(self, meshes, set_hierarchy=True):
"""Initialise.
Parameters
Expand All @@ -4704,7 +4704,7 @@ def __init__(self, *meshes, set_hierarchy=True):
for m in meshes:
if not isinstance(m, MeshGeometry):
raise ValueError(f"Got {type(m)}")
super().__init__(*meshes)
super().__init__(meshes)
self.comm = meshes[0].comm
self._comm = internal_comm(self.comm, self)
# Only set hierarchy at top level.
Expand All @@ -4713,7 +4713,7 @@ def __init__(self, *meshes, set_hierarchy=True):

@utils.cached_property
def topology(self):
return MixedMeshTopology(*[m.topology for m in self._meshes])
return MixedMeshTopology([m.topology for m in self._meshes])

@property
def topological(self):
Expand Down Expand Up @@ -4786,7 +4786,7 @@ def set_hierarchy(self):
if ilevel == level:
result.append(self)
else:
result.append(MixedMeshGeometry(*[hierarchy[ilevel] for hierarchy in hierarchy_list], set_hierarchy=False))
result.append(MixedMeshGeometry([hierarchy[ilevel] for hierarchy in hierarchy_list], set_hierarchy=False))
result = tuple(result)
for i, m in enumerate(result):
set_level(m, result, i)
Expand All @@ -4795,7 +4795,7 @@ def set_hierarchy(self):
class MixedMeshTopology(object):
"""A representation of mixed mesh topology."""

def __init__(self, *meshes):
def __init__(self, meshes):
"""Initialise.
Parameters
Expand Down Expand Up @@ -4833,8 +4833,8 @@ def ufl_cell(self):

def ufl_mesh(self):
cell = self.ufl_cell()
return ufl.MixedMesh(*[ufl.Mesh(finat.ufl.VectorElement("Lagrange", cell, 1, dim=cell.topological_dimension()))
for _ in self._meshes])
return ufl.MixedMesh([ufl.Mesh(finat.ufl.VectorElement("Lagrange", cell, 1, dim=cell.topological_dimension()))
for _ in self._meshes])

def __eq__(self, other):
if type(other) != type(self):
Expand Down

0 comments on commit 31e4788

Please sign in to comment.