Understanding the output of FreeFEM

I am having some trouble understanding the output of FreeFEM and how to use it for further analysis. After solving for a solution u it is possible to save it to a file using

ofstream TheFile(“some_file_name”); TheFile << u[];

or alternatively using

ffSaveData(u,“some_file_name”);

if one includes ffmatlib.idp. This gives a bunch of numbers, but it is unclear to me exactly what they mean. If one uses P1 then the amount of numbers contained in u equals the number of vertices, so I expect u to contain the values of the function at those vertices. This seems indeed to be the case at least for some PDE that I considered.

However, if one uses P2 then the u contains more numbers than the amount of vertices. So I wonder what these numbers mean.

Finally, I wonder if also in the P2 case one can get some output from FreeFem which can be used for further analysis. Ideally, this would be an array of the form [x, y, u(x,y)] where u is the solution.

Any help would be greatly appreciated!

EDIT: Initially I doubted that the values of u correspond to function values at the vertices in the case P1. Upon closer inspection I now believe that this is the case, so I modified my message in this regard.

The idea is simple,

u[] is the array of degree of freedom (dof)
when you write:

TheFile << u[];

you save this array

for the ffmatlib.idp see/use https://github.com/samplemaker/freefem_matlab_octave_plot

To set an array with dof as x or y coordinates just do in Vh fespace

 Vh xx=x,yy=y;

then xx[], yy[] gives you the array fo coordintate x or y respectively.

so you can write some thing like

for(int i=0; i< Vh.ndof; ++i)
   {
      TheFile << xx[][i] << " " << yy[][i] << " " << u[][i] << endl; 
   }

FH.

Thank you!
This is exactly what I was looking for!