  subroutine f_swaptime(lb,ub,s, &
        an,anv1,anv1,bn,bnv1,bnv1,cn,cnv1,cnv1,dn,dnv1,dnv1,phi, &
     phiv1,phiv1)
  use tensors
  use input_params
  use swaptime_i !F90 interface blok for swaptime
  implicit none
  integer, dimension(3)         :: lb,ub,s
  real*8, dimension(s(1),s(2),s(3)), target :: & 
        an,anv1,anv1,bn,bnv1,bnv1,cn,cnv1,cnv1,dn,dnv1,dnv1,phi, &
     phiv1,phiv1 
   
  type(GridFunction) :: anm_
  type(GridFunction) :: anp_
  type(GridFunction) :: bnm_
  type(GridFunction) :: bnp_
  type(GridFunction) :: cnm_
  type(GridFunction) :: cnp_
  type(GridFunction) :: dnm_
  type(GridFunction) :: dnp_
  type(GridFunction) :: phim_
  type(GridFunction) :: phip_
   
  anm_%d => an

  anp_%d => an

  bnm_%d => bn

  bnp_%d => bn

  cnm_%d => cn

  cnp_%d => cn

  dnm_%d => dn

  dnp_%d => dn

  phim_%d => phi

  phip_%d => phi

  call swaptime(anm_,an,anp_,bnm_,bn,bnp_,cnm_,cn,cnp_,dnm_, &
     dn,dnp_,phim_,phi,phip_)
  return
  end
