load "medit"
int nn=10;

border cc(t=0,2*pi){x=cos(t);y=sin(t);label=1;}
mesh Th2= buildmesh(cc(100));
fespace Vh2(Th2,P2);
Vh2 ux,uz,p2;
int[int] rup=[0,2],  rdown=[0,1], rmid=[1,1,2,1,3,1,4,1];
func zmin= 2-sqrt(4-(x*x+y*y));
func zmax= 2-sqrt(3.);

mesh3 Th=buildlayers(Th2,nn,
  coef=  (zmax-zmin)/zmax,
  zbound=[zmin,zmax],
  labelmid=rmid, 
  reffaceup = rup,
  reffacelow = rdown);


func u=x^2+y^2;

mesh3 Th3=trunc(Th,(u-0.5)>1.e-10,split=1,label=135);
medit("Lac",wait=1,Th);
plot(Th); // FFCS: testing 3d plots
medit("LacTruncated",Th3,wait=1);
plot(Th3); // FFCS: testing 3d plots
