OptFEM2D  0.1
Matlab optimized FEM2D
 All Files Functions Groups Pages
benchMassWP1.m
Go to the documentation of this file.
1 function benchMassWP1()
2 % function benchMassWP1()
3 % Benchmark function for MassWAssembling P1 functions.
4 %
5 % See also:
7  LN=[20:20:100];
8  w=@(x,y) cos(x+y);
9  k=1;
10  for N=LN
11  Th=SquareMesh(N);
12  fprintf('---------------------------------------------------------\n')
13  fprintf('BENCH (MassW Matrix Assembling) %d\n',k)
14  fprintf(' Vertex number : %d - Triangles number : %d\n',Th.nq,Th.nme)
15  fprintf(' Matrix size : %d\n',Th.nq)
16  Tw=w(Th.q(1,:),Th.q(2,:));
17  tic();
18  M=MassWAssemblingP1base(Th.nq,Th.nme,Th.me,Th.areas,Tw);
19  T(1)=toc();
20  fprintf(' CPU times base (ref) : %3.4f (s)\n',T(1))
21  tic();
22  M=MassWAssemblingP1OptV0(Th.nq,Th.nme,Th.me,Th.areas,Tw);
23  T(2)=toc();
24  fprintf(' CPU times OptV0 : %3.4f (s) - Speed Up X%3.3f\n',T(2),T(1)/T(2))
25  tic();
26  M=MassWAssemblingP1OptV1(Th.nq,Th.nme,Th.me,Th.areas,Tw);
27  T(3)=toc();
28  fprintf(' CPU times OptV1 : %3.4f (s) - Speed Up X%3.3f\n',T(3),T(1)/T(3))
29  tic();
30  M=MassWAssemblingP1OptV2(Th.nq,Th.nme,Th.me,Th.areas,Tw);
31  T(4)=toc();
32  fprintf(' CPU times OptV2 : %3.4f (s) - Speed Up X%3.3f\n',T(4),T(1)/T(4))
33  k=k+1;
34  end