1classdef nfftTestcaseInitDelegate
2  %NFFTTESTCASEDELEGATEINIT Summary of this class goes here
3  %   Detailed explanation goes here
4
5  properties
6    name = '';
7    m = 0;
8    flags = 0;
9    fftw_flags = 0;
10    K;
11    sigma;
12  end
13
14  methods
15    function h = nfftTestcaseInitDelegate(name, m, flags, fftw_flags)
16      h.name = name;
17      h.m = m;
18      h.flags = flags;
19      h.fftw_flags = fftw_flags;
20    end
21
22    function [h, plan] = init(h, d, N, M)
23      n = 2.^(ceil(log2(N))+1);
24      h.sigma = n./N;
25      switch h.name
26        case 'init_guru'
27          argsin = num2cell([d, N(:)', M, n(:)', h.m, h.flags, h.fftw_flags]);
28          plan = nfft_init_guru(argsin{:});
29        case 'init_class_no_flags'
30          argsin = num2cell([n(:)', h.m]);
31          plan = nfft(d,N,M,argsin{:});
32        case 'init_class_flags'
33          argsin = num2cell([n(:)', h.m, h.flags, h.fftw_flags]);
34          plan = nfft(d,N,M,argsin{:});
35        case 'init_1d'
36          plan = nfft_init_1d(N, M);
37        case 'init_2d'
38          plan = nfft_init_2d(N(1), N(2), M);
39        case 'init_3d'
40          plan = nfft_init_3d(N(1), N(2), N(3), M);
41        case 'init'
42          plan = nfft_init(N, M);
43        case 'init_class'
44          plan = nfft(d, N, M);
45        otherwise
46          error('Unknown init name: %s', h.name);
47      end
48    end
49  end
50
51end
52
53