@@ -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