Recover correspondence between 2d mesh and sufrace mesh

Hello,
as seen in the FreeFEM documentation, it is possible to construct surface meshes starting from two dimensional meshes using the command movemesh23. When doing this (for example in the case of a sphere) some points may merge.

I would like to be able to recover the correspondence between the points in the 2d mesh and the surface mesh in order to transport some finite element function from one mesh to another (e.g. the parametrization angles theta and phi). Is it possible to recover the correspondence between vertices in the 2d mesh and vertices on the surface mesh?

Thank you,
Beniamin

Can’t you use interpolate between two P_1 fespace, one defined on your meshS, the other on your mesh? For sure this works between meshL and mesh, see this example.

Thank you for your answer. I thought that interpolate is used for interpolation. Does it still work between a 2d mesh and a surface mesh? I will check it out.

A restriction (from a 2D to a surface mesh) is indeed a special kind of interpolation, but an interpolation nonetheless.

I tried the suggestion, but it doesn’t seem to work:

Here’s what I get (in my code ThS is the surface mes obtained from Th with movemesh23):

101 : fespace VhS(ThS,P1); // surface Finite elements
102 : VhS uS;
103 :
104 : fespace VhFlat(Th,P1,periodic=perio); // 2d finite elements
105 : VhFlat u;
106 :
107 : matrix Rest = interpolate(VhS,VhFlat) error operator ( <PP6v_fesS>, <PP5v_fes>
List of choices
( <N19MatrixInterpolationIP5v_fesS1_E2OpE> : <PP5v_fes>, <PP5v_fes> )
( <N19MatrixInterpolationIP6v_fesLP6v_fesSE2OpE> : <PP6v_fesL>, <PP6v_fesS> )
( <N19MatrixInterpolationIP6v_fesLP5v_fesE2OpE> : <PP6v_fesL>, <PP5v_fes> )
( <N19MatrixInterpolationIP6v_fesSP6v_fes3E2OpE> : <PP6v_fesS>, <PP6v_fes3> )
( <N19MatrixInterpolationIP6v_fesLS1_E2OpE> : <PP6v_fesL>, <3KN_IdE>, <3KN_IdE>, <3KN_IdE> )
( <N19MatrixInterpolationIP6v_fesLS1_E2OpE> : <PP6v_fesL>, <PP6v_fesL> )
( <N19MatrixInterpolationIP6v_fesSS1_E2OpE> : <PP6v_fesS>, <3KN_IdE>, <3KN_IdE>, <3KN_IdE> )
( <N19MatrixInterpolationIP6v_fesSS1_E2OpE> : <PP6v_fesS>, <PP6v_fesS> )
( <N19MatrixInterpolationIP6v_fes3S1_E2OpE> : <PP6v_fes3>, <3KN_IdE>, <3KN_IdE>, <3KN_IdE> )
( <N19MatrixInterpolationIP6v_fes3S1_E2OpE> : <PP6v_fes3>, <PP6v_fes3> )
( <N19MatrixInterpolationIP5v_fesS1_E2OpE> : <PP5v_fes>, <3KN_IdE>, <3KN_IdE> )

Indeed, looks like it can only do meshL <-> meshS, meshL <-> mesh, or meshS <-> mesh3.