@@ -85,14 +85,9 @@ def __init__(self, expr, v,
8585 the :meth:`interpolate` method or (b) set to zero.
8686 Ignored if interpolating within the same mesh or onto a :func:`.VertexOnlyMesh`.
8787 """
88-
8988 # Check function space
9089 if isinstance (v , functionspaceimpl .WithGeometry ):
9190 v = Argument (v .dual (), 0 )
92-
93- # Get the primal space (V** = V)
94- vv = v if not isinstance (v , ufl .Form ) else v .arguments ()[0 ]
95- self ._function_space = vv .function_space ().dual ()
9691 super ().__init__ (expr , v )
9792
9893 # -- Interpolate data (e.g. `subset` or `access`) -- #
@@ -101,8 +96,7 @@ def __init__(self, expr, v,
10196 "allow_missing_dofs" : allow_missing_dofs ,
10297 "default_missing_val" : default_missing_val }
10398
104- def function_space (self ):
105- return self ._function_space
99+ function_space = ufl .Interpolate .ufl_function_space
106100
107101 def _ufl_expr_reconstruct_ (self , expr , v = None , ** interp_data ):
108102 interp_data = interp_data or self .interp_data .copy ()
@@ -1123,12 +1117,14 @@ def _interpolator(V, tensor, expr, subset, arguments, access, bcs=None):
11231117 name = kernel .name
11241118 kernel = op2 .Kernel (ast , name , requires_zeroed_output_arguments = True ,
11251119 flop_count = kernel .flop_count , events = (kernel .event ,))
1120+
11261121 parloop_args = [kernel , cell_set ]
11271122
11281123 coefficients = tsfc_interface .extract_numbered_coefficients (expr , coefficient_numbers )
11291124 if needs_external_coords :
11301125 coefficients = [source_mesh .coordinates ] + coefficients
11311126
1127+ needs_target_ref_coords = False
11321128 if isinstance (target_mesh .topology , firedrake .mesh .VertexOnlyMeshTopology ):
11331129 if target_mesh is not source_mesh :
11341130 # NOTE: TSFC will sometimes drop run-time arguments in generated
@@ -1143,14 +1139,10 @@ def _interpolator(V, tensor, expr, subset, arguments, access, bcs=None):
11431139 # replacing `to_element` with a CoFunction/CoArgument as the
11441140 # target `dual` which would contain `dual` related
11451141 # coefficient(s))
1146- if rt_var_name in [arg .name for arg in kernel .code [name ].args ]:
1147- # Add the coordinates of the target mesh quadrature points in the
1148- # source mesh's reference cell as an extra argument for the inner
1149- # loop. (With a vertex only mesh this is a single point for each
1150- # vertex cell.)
1151- coefficients .append (target_mesh .reference_coordinates )
1152-
1153- if tensor in set ((c .dat for c in coefficients )):
1142+ if any (arg .name == rt_var_name for arg in kernel .code [name ].args ):
1143+ needs_target_ref_coords = True
1144+
1145+ if tensor in set (c .dat for c in coefficients ):
11541146 output = tensor
11551147 tensor = op2 .Dat (tensor .dataset )
11561148 if access is not op2 .WRITE :
@@ -1196,6 +1188,7 @@ def _interpolator(V, tensor, expr, subset, arguments, access, bcs=None):
11961188 if needs_cell_sizes :
11971189 cs = target_mesh .cell_sizes
11981190 parloop_args .append (cs .dat (op2 .READ , cs .cell_node_map ()))
1191+
11991192 for coefficient in coefficients :
12001193 if isinstance (target_mesh .topology , firedrake .mesh .VertexOnlyMeshTopology ):
12011194 coeff_mesh = extract_unique_domain (coefficient )
@@ -1227,6 +1220,15 @@ def _interpolator(V, tensor, expr, subset, arguments, access, bcs=None):
12271220 for const in extract_firedrake_constants (expr ):
12281221 parloop_args .append (const .dat (op2 .READ ))
12291222
1223+ if needs_target_ref_coords :
1224+ # Add the coordinates of the target mesh quadrature points in the
1225+ # source mesh's reference cell as an extra argument for the inner
1226+ # loop. (With a vertex only mesh this is a single point for each
1227+ # vertex cell.)
1228+ target_ref_coords = target_mesh .reference_coordinates
1229+ m_ = target_ref_coords .cell_node_map ()
1230+ parloop_args .append (target_ref_coords .dat (op2 .READ , m_ ))
1231+
12301232 parloop = op2 .ParLoop (* parloop_args )
12311233 parloop_compute_callable = parloop .compute
12321234 if isinstance (tensor , op2 .Mat ):
0 commit comments