# Print the solution at points

Dear all, I am new to FreeFEM.

I am solving Poisson’s equation. and I want to print the u solution to a text file. The solution printed include the solution at nodes and at cells as well.

How can I print the solutions at the nodes only.
This is my code to save the solution

{
ofstream file(“u_EXACT.txt”);
for (int j = 0; j < u[].n; j++)
file << u[][j]<< endl;

}

Remark, what is a node for you, if a node as a DoF (degree of freefem++) you print the correct thing, but
iT depend of the type on your finite element`
for (P1) your get value a vertex,
for (P2) the value are Vertex and middle edge with a strange numbering.
for other you can more complexe stuff.

Thanks a lot. That solved the issue. I was using P2. When I used P1 I got only vertices with correct numbering.

So what you want the value at vertices only, or get the value of the coordinate of middle edge.

if you do this:

``````mesh Th=square(3,3);
fespace Vh(Th,P2);
Vh u = x*x+y*y; // just for the test

int[int] I(Vh.ndof),II(Vh.ndof);
I=-1;
II=-1;
for(int k=0; k< Th.nt; ++k)
for(int j=0; j<6; ++j)
{
int dof = Vh(k,j); // dof number of dof j ok k
// the 3 first dof are 3 vertices
// the 3 first dof one  3 edges
if( j <3 ) I[dof] =Th[k][j]; // the vertex number
else {  //on edge e =j-3
int e = j-3;
int i1 = (e+1)%3,i2=(e+2)%3; //  vertex of edeg on triangle
int j1= Th[k][i1],j2= Th[k][i2]; // the 2 vertex number of edge
if( j2 < j2) swap(j1,j2);
I[dof] =j1;
II[dof] =j2;
}
}

for(int dof =0; dof< I.n;++dof)
cout << dof << " :: " << I[dof] << " " << II[dof] << endl;

``````

to find the numbering !!!