OptFEM2DP1  1.0
Matlab/Octave Optimized P1-Lagrange Finite Element Method in 2D
 All Files Functions Variables Groups Pages
benchMassWP1.m
Go to the documentation of this file.
1 function benchMassWP1()
2 % function benchMassWP1()
3 % Benchmark function for MassWAssembling `P_1` functions.
4 %
5 % See also:
7 %
8 % OptFEM2DP1 [V1.0e] - Copyright (C) 2013 CJS (LAGA)
9 %
10 % This file is part of OptFEM2DP1.
11 % OptFEM2DP1 is free software: you can redistribute it and/or modify
12 % it under the terms of the GNU General Public License as published by
13 % the Free Software Foundation, either version 3 of the License, or
14 % (at your option) any later version.
15 %
16 % OptFEM2DP1 is distributed in the hope that it will be useful,
17 % but WITHOUT ANY WARRANTY; without even the implied warranty of
18 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 % GNU General Public License for more details.
20 %
21 % You should have received a copy of the GNU General Public License
22 % along with this program. If not, see <http://www.gnu.org/licenses/>.
23  LN=[20:20:100];
24  w=@(x,y) cos(x+y);
25  k=1;
26  for N=LN
27  Th=SquareMesh(N);
28  fprintf('---------------------------------------------------------\n')
29  fprintf('BENCH (MassW Matrix Assembling) %d\n',k)
30  fprintf(' Vertices number : %d - Triangles number : %d\n',Th.nq,Th.nme)
31  fprintf(' Matrix size : %d\n',Th.nq)
32  Tw=w(Th.q(1,:),Th.q(2,:));
33  tic();
34  M=MassWAssemblingP1base(Th.nq,Th.nme,Th.me,Th.areas,Tw);
35  T(1)=toc();
36  fprintf(' CPU times base (ref) : %3.4f (s)\n',T(1))
37  tic();
38  M=MassWAssemblingP1OptV0(Th.nq,Th.nme,Th.me,Th.areas,Tw);
39  T(2)=toc();
40  fprintf(' CPU times OptV0 : %3.4f (s) - Speed Up X%3.3f\n',T(2),T(1)/T(2))
41  tic();
42  M=MassWAssemblingP1OptV1(Th.nq,Th.nme,Th.me,Th.areas,Tw);
43  T(3)=toc();
44  fprintf(' CPU times OptV1 : %3.4f (s) - Speed Up X%3.3f\n',T(3),T(1)/T(3))
45  tic();
46  M=MassWAssemblingP1OptV2(Th.nq,Th.nme,Th.me,Th.areas,Tw);
47  T(4)=toc();
48  fprintf(' CPU times OptV2 : %3.4f (s) - Speed Up X%3.3f\n',T(4),T(1)/T(4))
49  k=k+1;
50  end