
mesh Th1=square(10,10);
mesh Th2=square(20,10,[x+1,y]);
verbosity=3;
int[int] r1=[2,18],  r2=[4,0];
savemesh(Th1,"meshTh1_av.mesh");
Th1=change(Th1,refe=r1);
savemesh(Th1,"meshTh1_ap.mesh");
Th2=change(Th2,refe=r2);
mesh Th=Th1+Th2;

cout << " nb ref = " << int1d(Th1,1,3,4)(1./lenEdge)+int1d(Th2,1,2,3)(1./lenEdge) 
     << " == " << int1d(Th,1,2,3,4)(1./lenEdge) <<" == " << ((10+20)+10)*2 << endl; 
plot(Th,wait=1);
fespace Vh(Th,P1);
macro Grad(u) [dx(u),dy(u)]//
Vh u,v;
solve P(u,v)=int2d(Th)(Grad(u)'*Grad(v))-int2d(Th)(v)+on(1,3,u=0);
plot(u,wait=1);
mesh[int] TT(2);
TT[0]=Th1;
TT[1]=Th2;
Th=gluemesh([Th1,Th2],eps=0); //  no glue 

// Th=gluemesh(Th1+Th2,eps=0); //  no glue 
// Th=gluemesh(TT,eps=0); //  no glue 
 
solve PP(u,v)=int2d(Th)(Grad(u)'*Grad(v))-int2d(Th)(v)+on(1,3,u=0);
// FFCS: for regression tests
real regtest;

{
// ---------------
real R=50.*sqrt(2.); //  theta = 
//un quart du paraboloide
border t1(t=0,R) {x=t;y=0;    label=1;}
border t2(t=0,R) {x=(R-t);y=t;label=2;}
border t3(t=R,0) {x=0;y=t;    label=3;}
int nn=3;
mesh Th= buildmesh(t1(5*nn)+t2(5*sqrt(2.)*nn)+t3(5*nn));  
plot(Th,wait=0);

 mesh Th4;

mesh th1=movemesh(Th,[x,-y]);
mesh th2=movemesh(Th,[-x,-y]);
mesh th3=movemesh(Th,[-x,y]);
plot(Th,th1,th2,th3,wait=1);
 Th4=Th+th1+th2+th3;

plot(Th4,wait=1);
Th=Th4;
regtest=Th.nv;
}
