1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
classdef nfsoftTestcaseInitDelegate
%nfsoftTESTCASEDELEGATEINIT Summary of this class goes here
% Detailed explanation goes here
properties
name = '';
txt = '';
flags = 0;
kappa = 1000;
nfft_flags = [];
nfft_cutoff_m = [];
fftw_size = [];
end
methods
function h = nfsoftTestcaseInitDelegate(name, flags, nfft_flags, nfft_cutoff_m, kappa, fftw_size)
h.name = name;
h.txt = h.name;
if exist('flags','var') && ~isempty(flags)
h.flags = flags;
if bitand(flags,NFSOFT_USE_DPT) ~= 0
h.txt = sprintf('%s DPT', h.name);
end
end
if exist('nfft_flags','var') && ~isempty(nfft_flags)
h.nfft_flags = nfft_flags;
end
if exist('nfft_cutoff_m','var') && ~isempty(nfft_cutoff_m)
h.nfft_cutoff_m = nfft_cutoff_m;
end
if exist('kappa','var') && ~isempty(kappa)
h.kappa = kappa;
end
if exist('fftw_size','var') && ~isempty(fftw_size)
h.fftw_size = fftw_size;
end
end
function [h, plan] = init(h, N, M)
if ~isempty(h.fftw_size)
h.fftw_size = h.fftw_size(N);
end
switch h.name
case 'init'
if ~isempty(h.nfft_cutoff_m) || ~isempty(h.nfft_flags) || ~isempty(h.fftw_size)
plan = nfsoft_init(N,M,h.flags,h.nfft_flags,h.nfft_cutoff_m,h.kappa,h.fftw_size);
elseif ~isempty(h.flags)
plan = nfsoft_init(N,M,h.flags);
else
plan = nfsoft_init(N,M);
end
case 'init_class'
if ~isempty(h.nfft_cutoff_m) || ~isempty(h.nfft_flags) || ~isempty(h.fftw_size)
plan = nfsoft(N,M,h.flags,h.nfft_flags,h.nfft_cutoff_m,h.kappa,h.fftw_size);
elseif ~isempty(h.flags)
plan = nfsoft(N,M,h.flags);
else
plan = nfsoft(N,M);
end
otherwise
error('Unknown init name: %s', h.name);
end
end
end
end
|