Build explicit interpolation/evaluation vector

Hi,

I have searched a lot in previous questions and the FEniCS documentaion, but haven’t found a solution for the following task. I have a solution function u defined on a FunctionSpace V (in my case Nedelec) which I can evaluate at a coordinate x (dim 3).

I know that I can use either “interpolate” or u(x) to evaluate the value of u at x, but I’m not interested in the outcome but in an explicit formulation of the interpolation vector q (or matrix if there are multiple coordinates).

If I’m not mistaken, u(x) can be expressed as a linear combination of the basis function values of the element which contains x and I’m interested to explicitly build a sparse vector q, so that

u(x) = q * u

For instance, in a first order Nedelec space, I thought that q should contain 6 non-zero entries related to the 6 degrees of freedom in the cell containg x.

This interpolation vector q might by used internally in the eval function of FEniCS, but I have no idea how to access or build it explicitly.

I appreciate any help or suggestions.
RR

solved using the following workflow, test for first and second order basis functions:

mesh = ...
V = df.Functionspace(mesh, 'N1curl', 2)
dolfin_element = V.dolfin_element()
dofmap = V.dofmap()
Q = [df.Function(V) for d in range(3)]  # dim 3

1. bbt = mesh.bounding_box_tree()
2. cell_id = bbt.compute_first_entity_collision(point)
3. q_vals = dolfin_element.evaluate_basis_all(..., cell_id)

for Nedelec space to obtain interpolation matrices for the x, y, and z component

4. qx, qy, qz = q_vals[::3], q_vals[1::3], q_vals[2::3]
5. ids = dofmap.cell_dofs(cell_id)
6. for i, idx in enumerate(ids):
       Q[0].vector()[idx] = qx[j]
       Q[1].vector()[idx] = qy[j]
       Q[2].vector()[idx] = qz[j]