OptFEM3DP1 Toolbox: bench/benchMass3DP1.m Source File

| OptFEM3DP1 Toolbox 20130614_170440 Matlab/Octave Optimized P1-Lagrange Finite Element Method in 3D

- Main Page
- Related Pages
- Files

- File List
- File Members

All Files Functions Variables Pages
benchMass3DP1.m
Go to the documentation of this file.
1 function bench=benchMass3DP1(varargin)
2 % function benchMassP1()
3 % Benchmark function for MassAssembling `P_1` functions in 3D
4 %
5 % See also:
6 % #MassAssembling3DP1base, #MassAssembling3DP1OptV0, #MassAssembling3DP1OptV1, #MassAssembling3DP1OptV2
7 % Copyright:
8 % See \ref license
9 p = inputParser;
10
11 if isOctave()
12 p=p.addParamValue('LN', [20:10:60] , @isnumeric );
13 p=p.parse(varargin{:});
14 else % Matlab
15 p.addParamValue('LN', [20:10:60], @isnumeric );
16 p.parse(varargin{:});
17 end
18 k=1;
19 for N=p.Results.LN
20 Th=CubeMesh(N);
21 fprintf('---------------------------------------------------------\n')
22 fprintf('BENCH (Mass Matrix Assembling) %d\n',k)
23 fprintf(' Vertices number : %d - Tetrahedra number : %d\n',Th.nq,Th.nme)
24 fprintf(' Matrix size : %d\n',Th.nq)
25 Lnq(k)=Th.nq;
26 tic();
27 Mb=MassAssembling3DP1base(Th.nq,Th.nme,Th.me,Th.volumes);
28 T(k,1)=toc();
29 Ldof(k)=length(Mb);
30 fprintf(' CPU times base (ref) : %3.4f (s)\n',T(k,1))
31 tic();
32 M=MassAssembling3DP1OptV0(Th.nq,Th.nme,Th.me,Th.volumes);
33 T(k,2)=toc();
34 fprintf(' CPU times OptV0 : %3.4f (s) - Error = %e - Speed Up X%3.3f\n',T(k,2),norm(Mb-M,Inf),T(k,1)/T(k,2))
35 tic();
36 M=MassAssembling3DP1OptV1(Th.nq,Th.nme,Th.me,Th.volumes);
37 T(k,3)=toc();
38 fprintf(' CPU times OptV1 : %3.4f (s) - Error = %e - Speed Up X%3.3f\n',T(k,3),norm(Mb-M,Inf),T(k,1)/T(k,3))
39 tic();
40 M=MassAssembling3DP1OptV2(Th.nq,Th.nme,Th.me,Th.volumes);
41 T(k,4)=toc();
42 fprintf(' CPU times OptV2 : %3.4f (s) - Error = %e - Speed Up X%3.3f\n',T(k,4),norm(Mb-M,Inf),T(k,1)/T(k,4))
43 k=k+1;
44 end
45 bench.T=T;
46 bench.Lnq=Lnq;
47 bench.Ldof=Ldof;
48 bench.LN=p.Results.LN;
49