view +noname/benchmark.m @ 1037:2d7ba44340d0 feature/burgers1d

Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 18 Jan 2019 09:02:02 +0100
parents 1fe783681f9f
children
line wrap: on
line source

% animate(discretization, N, time_method)
%
% Example:
%      benchmark(discr,100)
%      benchmark(discr,1000,'rk4')

function hand = benchmark(discretization,N ,time_method,do_profile)
    default_arg('N',100);
    default_arg('time_method',[]);
    default_arg('do_profile',true);

    fprintf('Creating time discretization');
    tic
    ts = discretization.getTimestepper(time_method);
    fprintf(' - done  %fs\n', toc());

    if do_profile
        profile on
    end

    fprintf('Taking %d steps',N);
    tic;
    ts.stepN(N,true);
    fprintf(' - done  %fs\n', toc());

    if do_profile
        profile viewer
    end
end