| OptFEM2DP1 Toolbox 1.2b4 Matlab/Octave Optimized P1-Lagrange Finite Element Method in 2D

- Main Page
- Related Pages
- Files

- File List
- File Members

bench/benchMassW2DP1.m
Go to the documentation of this file.

    00001 function bench=benchMassW2DP1(varargin)
    00002 % function benchMassW2DP1()
    00003 %   Benchmark function for MassWAssembling2DP1 functions.
    00004 %
    00005 % See also:
    00006 %   #MassWAssembling2DP1base, #MassWAssembling2DP1OptV0, #MassWAssembling2DP1OptV1, #MassWAssembling2DP1OptV2
    00007 %   #SquareMesh
    00008 % Copyright:
    00009 %   See \ref license
    00010
    00011   p = inputParser;
    00012
    00013   if isOctave()
    00014     p=p.addParamValue('LN', [20:20:100] , @isnumeric );
    00015     p=p.parse(varargin{:});
    00016   else % Matlab
    00017     p.addParamValue('LN', [20:20:100], @isnumeric );
    00018     p.parse(varargin{:});
    00019   end
    00020   w=@(x,y) cos(x+y);
    00021   k=1;
    00022   for N=p.Results.LN
    00023     Th=SquareMesh(N);
    00024     fprintf('---------------------------------------------------------\n')
    00025     fprintf('BENCH (MassW Matrix Assembling) %d\n',k)
    00026     fprintf(' Vertices number : %d - Triangles number : %d\n',Th.nq,Th.nme)
    00027     fprintf(' Matrix size   : %d\n',Th.nq)
    00028     Lnq(k)=Th.nq;
    00029     Tw=w(Th.q(1,:),Th.q(2,:));
    00030     tic();
    00031     M=MassWAssembling2DP1base(Th.nq,Th.nme,Th.me,Th.areas,Tw);
    00032     T(k,1)=toc();
    00033     Ldof(k)=length(M);
    00034     fprintf('    CPU times base (ref) : %3.4f (s)\n',T(k,1))
    00035     tic();
    00036     M=MassWAssembling2DP1OptV0(Th.nq,Th.nme,Th.me,Th.areas,Tw);
    00037     T(k,2)=toc();
    00038     fprintf('    CPU times OptV0      : %3.4f (s) - Speed Up X%3.3f\n',T(k,2),T(k,1)/T(k,2))
    00039     tic();
    00040     M=MassWAssembling2DP1OptV1(Th.nq,Th.nme,Th.me,Th.areas,Tw);
    00041     T(k,3)=toc();
    00042     fprintf('    CPU times OptV1      : %3.4f (s) - Speed Up X%3.3f\n',T(k,3),T(k,1)/T(k,3))
    00043     tic();
    00044     M=MassWAssembling2DP1OptV2(Th.nq,Th.nme,Th.me,Th.areas,Tw);
    00045     T(k,4)=toc();
    00046     fprintf('    CPU times OptV2      : %3.4f (s) - Speed Up X%3.3f\n',T(k,4),T(k,1)/T(k,4))
    00047     k=k+1;
    00048   end
    00049
    00050   bench.T=T;
    00051   bench.Lnq=Lnq;
    00052   bench.Ldof=Ldof;
    00053   bench.LN=p.Results.LN;

All Files Functions