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