Skip to content

Commit b4675e7

Browse files
committed
Replace manufactured coordinates coefficient
Use new interface that informs if a manufactured coordinates coefficient is the first coefficient
1 parent 92362f7 commit b4675e7

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

firedrake/interpolation.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ def _interpolator(V, tensor, expr, subset, arguments, access):
228228
if not isinstance(expr, firedrake.Expression):
229229
if expr.ufl_domain() and expr.ufl_domain() != V.mesh():
230230
raise NotImplementedError("Interpolation onto another mesh not supported.")
231-
ast, oriented, needs_cell_sizes, coefficients, _ = compile_expression_dual_evaluation(expr, to_element,
232-
domain=V.mesh(), coffee=False)
231+
ast, oriented, needs_cell_sizes, coefficients, first_coeff_fake_coords, _ = compile_expression_dual_evaluation(expr, to_element,
232+
domain=V.mesh(), coffee=False)
233233
kernel = op2.Kernel(ast, ast.name, requires_zeroed_output_arguments=True)
234234
elif hasattr(expr, "eval"):
235235
to_pts = []
@@ -238,8 +238,8 @@ def _interpolator(V, tensor, expr, subset, arguments, access):
238238
raise NotImplementedError("Can only interpolate Python kernels with Lagrange elements")
239239
pts, = dual.pt_dict.keys()
240240
to_pts.append(pts)
241-
242241
kernel, oriented, needs_cell_sizes, coefficients = compile_python_kernel(expr, to_pts, to_element, V, coords)
242+
first_coeff_fake_coords = False
243243
else:
244244
raise RuntimeError("Attempting to evaluate an Expression which has no value.")
245245

@@ -249,6 +249,10 @@ def _interpolator(V, tensor, expr, subset, arguments, access):
249249
cell_set = subset
250250
parloop_args = [kernel, cell_set]
251251

252+
if first_coeff_fake_coords:
253+
# Replace with real coords coefficient
254+
coefficients[0] = coords
255+
252256
if tensor in set((c.dat for c in coefficients)):
253257
output = tensor
254258
tensor = op2.Dat(tensor.dataset)

0 commit comments

Comments
 (0)