Skip to content

Commit

Permalink
restore injection at coarsen
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrubeck committed Oct 23, 2023
1 parent b8fcd87 commit 178f290
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions firedrake/mg/ufl_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,15 @@ def coarsen_function(expr, self, coefficient_mapping=None):
coefficient_mapping = {}
new = coefficient_mapping.get(expr)
if new is None:
V = self(expr.function_space(), self)
new = firedrake.Function(V, name="coarse_%s" % expr.name())
Vf = expr.function_space()
Vc = self(Vf, self)
new = firedrake.Function(Vc, name="coarse_%s" % expr.name())
expr._child = weakref.proxy(new)
manager = firedrake.dmhooks.get_transfer_manager(Vf.dm)
if isinstance(expr, firedrake.Cofunction):
manager.restrict(expr, new)
elif isinstance(expr, firedrake.Function):
manager.inject(expr, new)
return new


Expand Down

0 comments on commit 178f290

Please sign in to comment.