view +noname/benchmark.m @ 60:e707cd9e6d0a

Euler1d: Created a general bc routine.
author Jonatan Werpers <jonatan@werpers.com>
date Sat, 14 Nov 2015 15:43:01 -0800
parents f121bf58c1b9
children 1fe783681f9f
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',[]);

    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