Skip to content

Commit b3dcbb2

Browse files
committed
cleanup
1 parent 14b818d commit b3dcbb2

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

firedrake/adaptive_variational_solver.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -455,25 +455,25 @@ def set_adaptive_cell_markers(self, eta_cell):
455455

456456
def set_uniform_cell_markers(self):
457457
"""Uniform marking for comparison tests"""
458-
mesh = self.amh[-1]
458+
mesh = self.amh[-1].unique()
459459
markers_space = FunctionSpace(mesh, "DG", 0)
460460
markers = Function(markers_space)
461461
markers.assign(1)
462462
return markers
463463

464464
def refine_problem(self, markers):
465465
"""Rediscretise the problem on the finest mesh"""
466-
domain_markers = {m.function_space().mesh(): m for m in markers.subfunctions}
467-
hierarchy = {}
468-
for mesh in domain_markers:
469-
amh, _ = get_level(mesh)
470-
new_mesh = mesh.refine_marked_elements(domain_markers[mesh])
471-
amh.add_mesh(new_mesh)
472-
hierarchy[mesh] = amh
473-
474-
if self.amh not in hierarchy.values():
475-
mesh = self.amh[-1]
476-
self.amh.add_mesh(type(mesh)([hierarchy[m][-1] for m in mesh]))
466+
for marker in markers.subfunctions:
467+
mesh = marker.function_space().mesh()
468+
new_mesh = mesh.refine_marked_elements(marker)
469+
mh, _ = get_level(mesh)
470+
mh.add_mesh(new_mesh)
471+
472+
mesh = self.problem.u.function_space().mesh()
473+
if len(mesh) > 1:
474+
new_mesh = type(mesh)([get_level(m)[0][-1] for m in mesh])
475+
mh, _ = get_level(mesh)
476+
mh.add_mesh(new_mesh)
477477

478478
coef_map = {}
479479
self.problem = refine(self.problem, refine, coefficient_mapping=coef_map)

0 commit comments

Comments
 (0)