1// test all FEspace 2verbosity=10; 3mesh Th=square(5,5); 4verbosity = 10; 5cout << " P0 " << endl; 6fespace Ph(Th,P0); 7cout << " P1 " << endl; 8fespace Vh(Th,P1); 9cout << " P2 " << endl; 10fespace Wh(Th,P2); 11cout << " nb of degre of freedom : " << Wh.ndof << endl; 12cout << " nb of degre of freedom / ELEMENT : " << Wh.ndofK << endl; 13//* don't work to day in progresse 14{ 15 int k= 2; 16 int kdf= Wh.ndofK ; 17cout << " df of element " << k << ":" ; 18for (int i=0;i<kdf;i++) 19 cout << Wh(k,i) << " "; 20 cout << endl; 21} 22//int[int] IK=[1,2,4]; 23//cout << "Wh(IK) = " << Wh(IK) << endl; 24//*/ 25cout << " P1nc " << endl; 26fespace Vnch(Th,P1nc); 27Vnch u1nc=x+10*y; 28cout << " Interpola P1nc : " << int2d(Th)(square(u1nc-(x+10*y))) << endl; 29 30cout << " P2dc " << endl; 31fespace Wdch(Th,P2dc); 32 33cout << " P1dc " << endl; 34fespace Vdch(Th,P1dc); 35Vdch u1dc=x+10*y; 36cout << " Interpola P1dc : " << int2d(Th)(square(u1dc-(x+10*y))) << endl; 37 38Wh w=x*x*y,dxw=2*x*y; 39 40Vdch vdc = dx(w); 41Wdch wdc = dx(w)*x; 42plot(vdc,dxw,wait=1); 43plot(wdc); 44Vnch vnc = x*x; 45Vh vh = x*x; 46Ph p = x*x; 47 48{ 49func f=x*x+10*y*y+50*x*y; 50cout << " P2b " << endl; 51fespace Wh2b(Th,P2); 52Wh2b vh=f; 53cout << " ?? " << vh(0.1,0.4) << " == " << f(0.1,0.4) << " diff = " << vh(0.1,0.4) - f(0.1,0.4) <<endl; 54assert( abs(vh(0.1,0.4) - f(0.1,0.4)) < 1e-12 ); 55} 56 57{ // version 3.41 58mesh TTh=Wdch.Th; 59plot(TTh,wait=1); 60mesh Tw =w.Th; 61} 62{// Version 3.58 63 Vh uu=x; 64 Vh uuu=uu[]; 65 varf va(u,v) = int2d(Th)(v)+on(1,u=1); 66 Vh vu = va(0,Vh,tgv=1); 67 plot(vu, wait=1); 68 69} 70