@@ -389,7 +389,9 @@ def __init__(
389389 )
390390
391391 if isinstance (expr , ufl .Interpolate ):
392- expr , = expr .ufl_operands
392+ dual_arg , expr = expr .argument_slots ()
393+ if not isinstance (dual_arg , Coargument ):
394+ raise NotImplementedError (f"{ type (self ).__name__ } does not support matrix-free adjoint interpolation." )
393395 super ().__init__ (expr , V , subset , freeze_expr , access , bcs , allow_missing_dofs , matfree )
394396
395397 self .arguments = extract_arguments (expr )
@@ -749,7 +751,7 @@ def _interpolate(self, *function, output=None, transpose=None, adjoint=False, **
749751 # Interpolation action
750752 self .frozen_assembled_interpolator = assembled_interpolator .copy ()
751753
752- if len (self .arguments ) == 2 and len (function ):
754+ if len (self .arguments ) == 2 and len (function ) > 0 :
753755 function , = function
754756 if not hasattr (function , "dat" ):
755757 raise ValueError ("The expression had arguments: we therefore need to be given a Function (not an expression) to interpolate!" )
@@ -865,7 +867,7 @@ def make_interpolator(expr, V, subset, access, bcs=None, matfree=True):
865867 tensor = op2 .Mat (sparsity )
866868 f = tensor
867869 else :
868- raise ValueError ("Cannot interpolate an expression with %d arguments" % rank )
870+ raise ValueError (f "Cannot interpolate an expression with { rank } arguments" )
869871
870872 if vom_onto_other_vom :
871873 wrapper = VomOntoVomWrapper (V , source_mesh , target_mesh , operand , matfree )
0 commit comments