How to compute f(T(x),x) for some function T

Thank you for your suggestion!

However, I would expect this solution to be quite slow. In the meantime I found a different method which is both simple and efficient, namely to work directly with the underlying (numpy) arrays.

Suppose that f is implemented as a function working with numpy arrays and T \in V. Then

alpha = dolfin.Function(V)
alpha.vector()[:] = f(T.vector()[:], V.tabulate_dof_coordinates())

does the job.

3 Likes