Interfacing function
eng


FFTCMPLX_f

File content


//FFTCMPLX_f Scicos complex fft block
//Classical interface function ver1.2 - scilab-3
//15 décembre 2004 - IRCOM GROUP - Author : A.Layec
function [x,y,typ]=FFTCMPLX_f(job,arg1,arg2)
x=[];y=[];typ=[]
select job
case 'plot' then
  if arg1.model.ipar(1)==-1 then
   txt=['FFT';'CMPLX'];
  else
   txt=['FFTI';'CMPLX'];
  end
  standard_draw(arg1)
case 'getinputs' then
  [x,y,typ]=standard_inputs(arg1)
case 'getoutputs' then
  [x,y,typ]=standard_outputs(arg1)
case 'getorigin' then
  [x,y]=standard_origin(arg1)
case 'set' then
   x=arg1;
   graphics=arg1.graphics;model=arg1.model;
   exprs=graphics.exprs;

   while %t do

      [ok,nu,herit,typ,mod,exprs]=getvalue('Scicos FFT complex block',...
      ['Size of inputs';'Inherit (no:0, yes:1)';...
      'Type of fft (-1:direct/1:indirect)';'Mode (0:Auto/1:Dfftmx)'],...
      list('vec',1,'vec',1,'vec',1,'vec',1),exprs)

      if ~ok then break,end;

      if ok then
          if herit==1 then
            model.dep_ut=[%t %f]
            [model,graphics,ok]=check_io(model,graphics,[nu;nu],[nu;nu],[],[])
          else
            model.dep_ut=[%t %f]
            [model,graphics,ok]=check_io(model,graphics,[nu;nu],[nu;nu],1,[])
          end
          graphics.exprs=exprs
          model.in=[nu;nu];
          model.out=[nu;nu];
          if mod==0 then
           if (nu<=2^15) then
             m=2^(int(log10(nu+0.5)/log10(2))); //test si nu est une puissance de 2
             if (m==nu) then
               model.ipar=[typ;0]; //fft842
             else
               [l,ierr]=dfftsize(nu);
               if ierr<>0 then
                 message('Problem in the size of input vector')
               end
               model.ipar=[typ;1;l];  //fftmx
             end
           else
             [l,ierr]=dfftsize(nu);
             if ierr<>0 then
                message('Problem in the size of input vector')
             end
             model.ipar=[typ;1;l];//fftmx
           end
          else
            [l,ierr]=dfftsize(nu);
            if ierr<>0 then
                message('Problem in the size of input vector')
            end
            model.ipar=[typ;1;l];//fftmx
          end
          x.graphics=graphics;x.model=model
          break;
      end
   end

case 'define' then
  nu=256
  herit=1
  typ=-1
  mod=0
  
  model=scicos_model()
  model.sim=list('fftcmplx',4)
  model.in=[nu;nu]
  model.out=[nu;nu]
  model.evtin=[]
  model.evtout=[]
  model.dstate=[]
  model.rpar=[]
  model.ipar=[typ;0] //fft842 par default
  model.blocktype='d'
  model.firing=[]
  model.dep_ut=[%t %f]
 //'txt=[''FFT'';''CMPLX''];';
  gr_i=['xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']
  exprs=[string(nu),string(herit),string(typ),string(mod)]
  x=standard_define([2 2],model,exprs,gr_i)
end
endfunction