Taking the gradient of a function inside expression defined by cpp code

Hello everyone,

I am currently implementing a user-defined expression with de cpp code expression. I have already passed a Function to my cpp code expression (vectorial displacement field “u”), but now I need to calculate its gradient and later, its eigenvalues and eigenvectors. How can I do that inside cpp code expression? I am currently using Fenics 2019 with Python 3.7.

Pd: I also tried to directly pass “grad(u)” to the cpp code but I received the following error:

TypeError: Expected a FunctionSpace or a Function as argument 1

I am also interested in that question. Have you been able to solve it?