      subroutine getvel(nt,nx,npad,ntau,vfe,stepdown,sc,iadalp)
      implicit none
      integer nt,nx,ntau,stepdown,iadalp,npad
      real vfe(ntau,nx),sc
      integer reed,auxpar,auxin,velfd,n1vel,n2vel,lseek
      integer ix,it,itau,icnt
      integer feoff(2),fedim(2),cmst(2),cmend(2),cmax(2)
      include '/usr/include/cm/paris-configuration-fort.h'
      velfd = auxin('vel')
      n1vel = nt
      n2vel = nx
      icnt= auxpar('n1','d',n1vel,'vel')
      icnt= auxpar('n2','d',n2vel,'vel')
      if(.not.(n1vel .lt. nt))goto 23000
         call erexit('trace and velocity profile length mismatch')
23000 continue
      if(.not.(n2vel .ne. 1 .and. n2vel .lt. nx))goto 23002
         call erexit('too few velocity profiles')
23002 continue
      do 23004 ix=npad+1,nx-npad 
c goto beginning of vel. profile
         icnt=lseek(velfd,(ix-1)*n1vel*4,0)
c read first nt velocities
         icnt=reed(velfd,vfe(1,ix),nt*4)
         if(.not.(icnt .eq. 0))goto 23006
c assume v(tau) and propagate
            do 23008 itau=1,ntau
               vfe(itau,ix) = vfe(itau,ix-1)
23008          continue
            goto 23007
c        else
23006       continue
c process v(tau,x)
            do 23010 it=1,nt
               vfe(it,ix)=sc*vfe(it,ix)**2
23010          continue
            if(.not.(stepdown .gt. 1))goto 23012
               call vpack(vfe(1,ix),nt,vfe(1,ix),ntau,stepdown)
23012       continue
23007    continue
23004    continue
      do 23014 ix=1,npad 
         do 23016 it=1,ntau 
            vfe(it,ix)=vfe(it,npad+1)
23016       continue
23014    continue
      do 23018 ix=nx-npad+1,nx 
         do 23020 it=1,ntau 
            vfe(it,ix)=vfe(it,nx-npad)
23020       continue
23018    continue
      feoff(1)=0
      feoff(2)=0
      cmst(1)=0
      cmst(2)=0
      cmend(2)=ntau
      cmend(1)=nx
      cmax(1)=0
      cmax(2)=1
      fedim(2)=ntau
      fedim(1)=nx
         call CM_f_move_zero_always_1L(iadalp,23,8)
         call CM_f_write_to_news_array_1L(vfe,feoff,cmst,cmend,
     1        cmax,iadalp,23,8,3,fedim,cm_float_single_array)
      return
      end
      subroutine vpack(vin,nt,vout,ntau,stepdown)
      integer nt,ntau,stepdown
      real vin(stepdown,ntau),vout(ntau)
      integer itau,it
C$DIR SCALAR
      do 23022 it=2,stepdown 
C$DIR NO_RECURRENCE
         do 23024 itau=1,ntau 
            vin(1,itau) = vin(1,itau)+vin(it,itau)
23024       continue
23022    continue
      do 23026 itau=1,ntau
         vout(itau) = vin(1,itau)
23026    continue
      return
      end
