OptFEM2DP1  1.1
Matlab/Octave Optimized P1-Lagrange Finite Element Method in 2D
 All Files Functions Variables Pages
benchMassP1.m
Go to the documentation of this file.
1 function benchMassP1()
2 % function benchMassP1()
3 % Benchmark function for MassAssembling `P_1` functions.
4 %
5 % See also:
7 %
8 % OptFEM2DP1 [V1.1] - 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  k=1;
25  for N=LN
26  Th=SquareMesh(N);
27  fprintf('---------------------------------------------------------\n')
28  fprintf('BENCH (Mass Matrix Assembling) %d\n',k)
29  fprintf(' Vertices number : %d - Triangles number : %d\n',Th.nq,Th.nme)
30  fprintf(' Matrix size : %d\n',Th.nq)
31  tic();
32  M=MassAssemblingP1base(Th.nq,Th.nme,Th.me,Th.areas);
33  T(1)=toc();
34  fprintf(' CPU times base (ref) : %3.4f (s)\n',T(1))
35  tic();
36  M=MassAssemblingP1OptV0(Th.nq,Th.nme,Th.me,Th.areas);
37  T(2)=toc();
38  fprintf(' CPU times OptV0 : %3.4f (s) - Speed Up X%3.3f\n',T(2),T(1)/T(2))
39  tic();
40  M=MassAssemblingP1OptV1(Th.nq,Th.nme,Th.me,Th.areas);
41  T(3)=toc();
42  fprintf(' CPU times OptV1 : %3.4f (s) - Speed Up X%3.3f\n',T(3),T(1)/T(3))
43  tic();
44  M=MassAssemblingP1OptV2(Th.nq,Th.nme,Th.me,Th.areas);
45  T(4)=toc();
46  fprintf(' CPU times OptV2 : %3.4f (s) - Speed Up X%3.3f\n',T(4),T(1)/T(4))
47  k=k+1;
48  end