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

- Main Page
- Related Pages
- Files

- File List
- File Members

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

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

All Files Functions