Understanding FreeFem output

Can someone help me understand the ouput of freefem++?

when we do

cout << u[] << ;

it shows the values of the DoF?

if I want tha value of u on a given point, do I do:

fespace Vh(Th, P0);
Vh xx = x, yy = y;

cout << u(xx, yy) << ;

for example?

I think the parens do interpolation and take any coordinates. See this
example I happen to have handy. It uses a 3D line mesh so it may be
a little confusing but has a lot of the issues in the code,

load "msh3"
//load "medit"
// load "mjm_dscope_freefem"

int nx=5;
int nx2=7;
int[int] lbe=[100,200]; // begin and end point labels 
meshL Th1=Sline(nx, [1.0*x],label=lbe);
meshL Th2=Sline(nx2, [.5+ .25*(x-.5)],label=lbe);
fespace Vh1(Th1,P1);
fespace Vh2(Th2,P2);
Vh1 u1x=x;
Vh1 u1=(x>.5)?1:0;
Vh2 u2x=x;
Vh2 u2;
matrix A=interpolate(Vh2,Vh1);
u2[]=A*u1[];
cout<<"u1x[]="<<u1x[]<<endl;
cout<<"u1[]="<<u1[]<<endl;
cout<<" u2 "<<endl;
cout<<" u2x[]="<<u2x[]<<endl;
cout<<" u2[]= "<<u2[]<<endl;
cout<<"u1x(.7123,0,0)="<<u1x(.7123,0,0)<<endl;
cout.flush;

1 Like