Skip to content

Commit 6e450ed

Browse files
alexfiklinducer
authored andcommitted
fix(firedrake): remove MeshTopology.init calls
firedrakeproject/firedrake#4201
1 parent 162da51 commit 6e450ed

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

meshmode/interop/firedrake/mesh.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@ def import_firedrake_mesh(fdrake_mesh, cells_to_use=None,
589589
raise TypeError("'fdrake_mesh_topology' must be an instance of "
590590
"firedrake.mesh.MeshGeometry, "
591591
"not '%s'." % type(fdrake_mesh))
592+
592593
if cells_to_use is not None:
593594
if not isinstance(cells_to_use, np.ndarray):
594595
raise TypeError("'cells_to_use' must be a np.ndarray or "
@@ -598,21 +599,13 @@ def import_firedrake_mesh(fdrake_mesh, cells_to_use=None,
598599
":arg:`cells_to_use` must have unique entries"
599600
assert np.all(np.logical_and(cells_to_use >= 0,
600601
cells_to_use < fdrake_mesh.num_cells()))
602+
601603
assert fdrake_mesh.ufl_cell().is_simplex(), "Mesh must use simplex cells"
602604
gdim = fdrake_mesh.geometric_dimension()
603605
tdim = fdrake_mesh.topological_dimension()
606+
604607
assert gdim in [1, 2, 3], "Mesh must be in space of ambient dim 1, 2, or 3"
605608
assert gdim - tdim in [0, 1], "Mesh co-dimension must be 0 or 1"
606-
# firedrake meshes are not guaranteed be fully instantiated until
607-
# the .init() method is called. In particular, the coordinates function
608-
# may not be accessible if we do not call init(). If the mesh has
609-
# already been initialized, nothing will change. For more details
610-
# on why we need a second initialization, see
611-
# this pull request:
612-
# https://github.com/firedrakeproject/firedrake/pull/627
613-
# which details how Firedrake implements a mesh's coordinates
614-
# as a function on that very same mesh
615-
fdrake_mesh.init()
616609

617610
# Get all the nodal information we can from the topology
618611
with ProcessLogger(logger, "Retrieving vertex indices and computing "
@@ -901,7 +894,6 @@ def export_mesh_to_firedrake(mesh, group_nr=None, comm=None):
901894
# vertices from being (locally) reordered on each cell...
902895
# the tl;dr is we don't actually save any hassle
903896
top = fd_mesh.Mesh(plex, dim=mesh.ambient_dim) # mesh topology
904-
top.init()
905897

906898
# Get new element ordering:
907899
with ProcessLogger(logger, "Determining permutations applied"

test/test_firedrake_interop.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ def make_firedrake_mesh(name: str):
116116

117117
# Firedrake can't read in higher order meshes from gmsh,
118118
# so we can only use the order1 blobs
119-
fd_mesh = Mesh(name)
120-
fd_mesh.init()
121-
122-
return fd_mesh
119+
return Mesh(name)
123120

124121

125122
# {{{ Basic conversion checks for the function space

0 commit comments

Comments
 (0)