Say that I have a finite element u on the square [0,L_1]\times[0,L_2] and I want a new element \widetilde{u} with the property that for each x\in[0,L_1] I have \widetilde{u}(x,y) = \frac{1}{L_2}\int_0^{L_2} u(x,y)dy for all y\in [0,L_2].

In other words, \widetilde{u} is constant on the fiber \{x\}\times [0,L_2] and is equal to the average of u over that fiber.

Is there a clean way to do it in FreeFEM?