




















































































































 


































































































































































 





































































































































































































 

























































 










 








































































































































































































































 










                                
                                

                                
                                

                                
                                

                                









































































































































subroutine TestLoopControlFortran_all(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_alig&
  &nment,cctk_alignment_offset,cctk_from,cctk_to,cctk_bbox,cctk_delta_time,cctk_time,cctk_delta_space,cctk_origin_space,cctk_levfac&
  &,cctk_levoff,cctk_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_ash&
  &2,cctk_ash3, csum_all,csum_bnd,csum_int,csum_intbnd,fsum_all,fsum_bnd,fsum_int,fsum_intbnd,pointtypes, coarse_dx,coarse_dy,coars&
  &e_dz,r,x,y,z)
  use loopcontrol
  implicit none

  INTEGER cctk_dim
  integer, parameter :: cctki_use_cctk_dim = kind(cctk_dim)
  INTEGER cctk_gsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_gsh = kind(cctk_gsh)
  INTEGER cctk_lsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_lsh = kind(cctk_lsh)
  INTEGER cctk_lbnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_lbnd = kind(cctk_lbnd)
  INTEGER cctk_ubnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_ubnd = kind(cctk_ubnd)
  INTEGER cctk_tile_min (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_min = kind(cctk_tile_min)
  INTEGER cctk_tile_max (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_max = kind(cctk_tile_max)
  INTEGER cctk_ash (cctk_dim)
  integer, parameter :: cctki_use_cctk_ash = kind(cctk_ash)
  INTEGER cctk_alignment
  integer, parameter :: cctki_use_cctk_alignment = kind(cctk_alignment)
  INTEGER cctk_alignment_offset
  integer, parameter :: cctki_use_cctk_alignment_offset = kind(cctk_alignment_offset)
  INTEGER cctk_from (cctk_dim)
  integer, parameter :: cctki_use_cctk_from = kind(cctk_from)
  INTEGER cctk_to (cctk_dim)
  integer, parameter :: cctki_use_cctk_to = kind(cctk_to)
  INTEGER cctk_bbox (2*cctk_dim)
  integer, parameter :: cctki_use_cctk_bbox = kind(cctk_bbox)
  REAL*8 cctk_delta_time
  integer, parameter :: cctki_use_cctk_delta_time = kind(cctk_delta_time)
  REAL*8 cctk_time
  integer, parameter :: cctki_use_cctk_time = kind(cctk_time)
  REAL*8 cctk_delta_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_delta_space = kind(cctk_delta_space)
  REAL*8 cctk_origin_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_origin_space = kind(cctk_origin_space)
  INTEGER cctk_levfac (cctk_dim)
  integer, parameter :: cctki_use_cctk_levfac = kind(cctk_levfac)
  INTEGER cctk_levoff (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoff = kind(cctk_levoff)
  INTEGER cctk_levoffdenom (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoffdenom = kind(cctk_levoffdenom)
  INTEGER cctk_timefac
  integer, parameter :: cctki_use_cctk_timefac = kind(cctk_timefac)
  INTEGER cctk_convlevel
  integer, parameter :: cctki_use_cctk_convlevel = kind(cctk_convlevel)
  INTEGER cctk_convfac
  integer, parameter :: cctki_use_cctk_convfac = kind(cctk_convfac)
  INTEGER cctk_nghostzones (cctk_dim)
  integer, parameter :: cctki_use_cctk_nghostzones = kind(cctk_nghostzones)
  INTEGER cctk_iteration
  integer, parameter :: cctki_use_cctk_iteration = kind(cctk_iteration)
  integer*8 cctkGH
  integer, parameter :: cctki_use_cctkGH = kind(cctkGH)
  INTEGER cctk_ash1
  integer, parameter :: cctki_use_cctk_ash1 = kind(cctk_ash1)
  INTEGER cctk_ash2
  integer, parameter :: cctki_use_cctk_ash2 = kind(cctk_ash2)
  INTEGER cctk_ash3
  integer, parameter :: cctki_use_cctk_ash3 = kind(cctk_ash3)
  REAL*8 csum_all
  integer, parameter :: cctki_use_csum_all = kind(csum_all)
  REAL*8 csum_bnd
  integer, parameter :: cctki_use_csum_bnd = kind(csum_bnd)
  REAL*8 csum_int
  integer, parameter :: cctki_use_csum_int = kind(csum_int)
  REAL*8 csum_intbnd
  integer, parameter :: cctki_use_csum_intbnd = kind(csum_intbnd)
  REAL*8 fsum_all
  integer, parameter :: cctki_use_fsum_all = kind(fsum_all)
  REAL*8 fsum_bnd
  integer, parameter :: cctki_use_fsum_bnd = kind(fsum_bnd)
  REAL*8 fsum_int
  integer, parameter :: cctki_use_fsum_int = kind(fsum_int)
  REAL*8 fsum_intbnd
  integer, parameter :: cctki_use_fsum_intbnd = kind(fsum_intbnd)
  INTEGER*4 pointtypes (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_pointtypes = kind(pointtypes)
  REAL*8 coarse_dx
  integer, parameter :: cctki_use_coarse_dx = kind(coarse_dx)
  REAL*8 coarse_dy
  integer, parameter :: cctki_use_coarse_dy = kind(coarse_dy)
  REAL*8 coarse_dz
  integer, parameter :: cctki_use_coarse_dz = kind(coarse_dz)
  REAL*8 r (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_r = kind(r)
  REAL*8 x (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_x = kind(x)
  REAL*8 y (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_y = kind(y)
  REAL*8 z (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_z = kind(z)
  interface
  integer*8 function CCTK_PointerTo (var)
  implicit none
  type(*),dimension(..),TARGET :: var
  end function CCTK_PointerTo
  end interface
  interface
  integer function CCTK_Equals (arg1, arg2)
  implicit none
  integer*8 arg1
  character(*) arg2
  end function CCTK_Equals
  integer function CCTK_MyProc (cctkGH)
  implicit none
  integer*8 cctkGH
  end function CCTK_MyProc
  integer function CCTK_nProcs (cctkGH)
  implicit none
  integer*8 cctkGH
  end function CCTK_nProcs
  integer function CCTK_IsThornActive (name)
  implicit none
  character(*) name
  end function CCTK_IsThornActive
  integer*8 function CCTK_NullPointer ()
  implicit none
  end function CCTK_NullPointer
  end interface
  interface
  INTEGER*4 function GetBoundarySizesAndTypes (cctkGH, size, bndsize, is_ghostbnd, is_symbnd, is_physbnd)
  implicit none
  integer*8 cctkGH
  INTEGER*4 size
  INTEGER*4 bndsize(*)
  INTEGER*4 is_ghostbnd(*)
  INTEGER*4 is_symbnd(*)
  INTEGER*4 is_physbnd(*)
  end function GetBoundarySizesAndTypes
  end interface
  
  

  integer :: all3_all_dir1, all3_all_dir2, all3_all_dir3
  integer :: all3_all_ash1, all3_all_ash2, all3_all_ash3
  integer :: all3_all_str1
  integer*8, save :: all3_all_descr = 0
  type(lc_control_t) :: all3_all_control
  integer :: all3_all_cmin1, all3_all_cmax1,                         all3_all_cstep1, all3_all_cpos1
  integer :: all3_all_cmin2, all3_all_cmax2,                         all3_all_cstep2, all3_all_cpos2
  integer :: all3_all_cmin3, all3_all_cmax3,                         all3_all_cstep3, all3_all_cpos3
  integer :: all3_all_fmin1, all3_all_fmax1,                         all3_all_fstep1
  integer :: all3_all_fmin2, all3_all_fmax2,                         all3_all_fstep2
  integer :: all3_all_fmin3, all3_all_fmax3,                         all3_all_fstep3
  integer :: all3_all1_ni,all3_all1_nj,all3_all1_nk
  integer :: all33_dummy_imin, all33_dummy_imax
  integer   :: i,j,k
  REAL*8 :: fsum
  
  call CCTK_Info("TestLoopControl","TestLoopControlFortran_all")
  fsum = 0
  !$OMP PARALLEL &
  !$OMP private (all3_all_control) &
  !$omp shared (all3_all_descr) &
  !$omp private (all3_all_dir1, all3_all_dir2, all3_all_dir3) &
  !$omp private (all3_all_ash1, all3_all_ash2, all3_all_ash3) &
  !$omp private (all3_all_str1) &
  !$omp private (all3_all_cmin1, all3_all_cmax1) &
  !$omp private (all3_all_cstep1, all3_all_cpos1) &
  !$omp private (all3_all_cmin2, all3_all_cmax2) &
  !$omp private (all3_all_cstep2, all3_all_cpos2) &
  !$omp private (all3_all_cmin3, all3_all_cmax3) &
  !$omp private (all3_all_cstep3, all3_all_cpos3) &
  !$omp private (all3_all_fmin1, all3_all_fmax1) &
  !$omp private (all3_all_fstep1, i, all3_all1_ni) &
  !$omp private (all3_all_fmin2, all3_all_fmax2) &
  !$omp private (all3_all_fstep2, j, all3_all1_nj) &
  !$omp private (all3_all_fmin3, all3_all_fmax3) &
  !$omp private (all3_all_fstep3, k, all3_all1_nk) &
  !$omp private(all33_dummy_imin, all33_dummy_imax) &
  !$OMP reduction(+: fsum) &
  !$OMP default(none) shared(cctkgh, cctk_ash, cctk_lsh, cctk_tile_min, cctk_tile_max, r)

  all3_all_dir1 = (                         0)
  all3_all_dir2 = (0)
  all3_all_dir3 = (0)
  all3_all_ash1 = (                                           cctk_ash(1))
  all3_all_ash2 = (cctk_ash(2))
  all3_all_ash3 = (cctk_ash(3))
  all3_all_str1 = (   1)
  call lc_descr_init(all3_all_descr, 27, "<stdin>", "all3_all")
  call lc_control_init(all3_all_control, all3_all_descr,                                       ((                                  &
  &         1)-1), ((1)-1), ((1)-1),                                  (                                           cctk_lsh(1)), (cc&
  &tk_lsh(2)), (cctk_lsh(3)),                                              all3_all_ash1, all3_all_ash2, all3_all_ash3,            &
  &                all3_all_str1, 0, all3_all_str1)
  call lc_thread_init(all3_all_control)
  do while (lc_thread_done(all3_all_control) == 0)
  all3_all_control%coarse_loop%min%v(3) =                                    all3_all_control%coarse_thread%pos%v(3)
  all3_all_control%coarse_loop%max%v(3) =                                    min(all3_all_control%coarse_thread%max%v(3),          &
  &                      all3_all_control%coarse_loop%min%v(3) +                                    all3_all_control%coarse_thread%&
  &step%v(3))
  all3_all_cmin3 = all3_all_control%coarse_loop%min%v(3)
  all3_all_cmax3 = all3_all_control%coarse_loop%max%v(3)
  all3_all_cstep3 = all3_all_control%coarse_loop%step%v(3)
  all3_all_control%coarse_loop%min%v(2) =                                    all3_all_control%coarse_thread%pos%v(2)
  all3_all_control%coarse_loop%max%v(2) =                                    min(all3_all_control%coarse_thread%max%v(2),          &
  &                      all3_all_control%coarse_loop%min%v(2) +                                    all3_all_control%coarse_thread%&
  &step%v(2))
  all3_all_cmin2 = all3_all_control%coarse_loop%min%v(2)
  all3_all_cmax2 = all3_all_control%coarse_loop%max%v(2)
  all3_all_cstep2 = all3_all_control%coarse_loop%step%v(2)
  all3_all_control%coarse_loop%min%v(1) =                                    all3_all_control%coarse_thread%pos%v(1)
  all3_all_control%coarse_loop%max%v(1) =                                    min(all3_all_control%coarse_thread%max%v(1),          &
  &                      all3_all_control%coarse_loop%min%v(1) +                                    all3_all_control%coarse_thread%&
  &step%v(1))
  all3_all_cmin1 = all3_all_control%coarse_loop%min%v(1)
  all3_all_cmax1 = all3_all_control%coarse_loop%max%v(1)
  all3_all_cstep1 = all3_all_control%coarse_loop%step%v(1)
  do all3_all_cpos3 = all3_all_cmin3, all3_all_cmax3,                                 all3_all_cstep3
  do all3_all_cpos2 = all3_all_cmin2, all3_all_cmax2,                                 all3_all_cstep2
  do all3_all_cpos1 = all3_all_cmin1, all3_all_cmax1,                                 all3_all_cstep1
  all3_all_control%fine_loop%min%v(3) = all3_all_cpos3
  all3_all_control%fine_loop%max%v(3) =                                      min(all3_all_control%coarse_loop%max%v(3),            &
  &                      all3_all_control%fine_loop%min%v(3) +                                      all3_all_control%coarse_loop%st&
  &ep%v(3))
  all3_all_fmin3 = all3_all_control%fine_loop%min%v(3)
  all3_all_fmax3 = all3_all_control%fine_loop%max%v(3)
  all3_all_fstep3 = all3_all_control%fine_loop%step%v(3)
  all3_all_control%fine_loop%min%v(2) = all3_all_cpos2
  all3_all_control%fine_loop%max%v(2) =                                      min(all3_all_control%coarse_loop%max%v(2),            &
  &                      all3_all_control%fine_loop%min%v(2) +                                      all3_all_control%coarse_loop%st&
  &ep%v(2))
  all3_all_fmin2 = all3_all_control%fine_loop%min%v(2)
  all3_all_fmax2 = all3_all_control%fine_loop%max%v(2)
  all3_all_fstep2 = all3_all_control%fine_loop%step%v(2)
  all3_all_control%fine_loop%min%v(1) = all3_all_cpos1
  all3_all_control%fine_loop%max%v(1) =                                      min(all3_all_control%coarse_loop%max%v(1),            &
  &                      all3_all_control%fine_loop%min%v(1) +                                      all3_all_control%coarse_loop%st&
  &ep%v(1))
  all3_all_fmin1 = all3_all_control%fine_loop%min%v(1)
  all3_all_fmax1 = all3_all_control%fine_loop%max%v(1)
  all3_all_fstep1 = all3_all_control%fine_loop%step%v(1)
  do  k = all3_all_fmin3+1, all3_all_fmax3,                               all3_all_fstep3
  all3_all1_nk = 0
  if (all3_all_dir3<0)  all3_all1_nk =  k
  if (all3_all_dir3>0)  all3_all1_nk = all3_all_control%overall%max%v(3)+1- k
  do  j = all3_all_fmin2+1, all3_all_fmax2,                               all3_all_fstep2
  all3_all1_nj = 0
  if (all3_all_dir2<0)  all3_all1_nj =  j
  if (all3_all_dir2>0)  all3_all1_nj = all3_all_control%overall%max%v(2)+1- j
  do                                                                    i = all3_all_fmin1+1, all3_all_fmax1,                      &
  &         all3_all_fstep1
  all3_all1_ni = 0
  if (all3_all_dir1<0)                           all3_all1_ni =                                                                    i
  if (all3_all_dir1>0)                           all3_all1_ni = all3_all_control%overall%max%v(1)+1-                               &
  &                                    i
     fsum = fsum + r(i,j,k)

  end do
  end do
  end do
  end do
  end do
  end do
  call lc_thread_step(all3_all_control)
  end do
  call lc_control_finish(all3_all_control, all3_all_descr)
  !$OMP END PARALLEL
  fsum_all = fsum
end subroutine TestLoopControlFortran_all



subroutine TestLoopControlFortran_int(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_alig&
  &nment,cctk_alignment_offset,cctk_from,cctk_to,cctk_bbox,cctk_delta_time,cctk_time,cctk_delta_space,cctk_origin_space,cctk_levfac&
  &,cctk_levoff,cctk_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_ash&
  &2,cctk_ash3, csum_all,csum_bnd,csum_int,csum_intbnd,fsum_all,fsum_bnd,fsum_int,fsum_intbnd,pointtypes, coarse_dx,coarse_dy,coars&
  &e_dz,r,x,y,z)
  use loopcontrol
  implicit none

  INTEGER cctk_dim
  integer, parameter :: cctki_use_cctk_dim = kind(cctk_dim)
  INTEGER cctk_gsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_gsh = kind(cctk_gsh)
  INTEGER cctk_lsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_lsh = kind(cctk_lsh)
  INTEGER cctk_lbnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_lbnd = kind(cctk_lbnd)
  INTEGER cctk_ubnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_ubnd = kind(cctk_ubnd)
  INTEGER cctk_tile_min (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_min = kind(cctk_tile_min)
  INTEGER cctk_tile_max (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_max = kind(cctk_tile_max)
  INTEGER cctk_ash (cctk_dim)
  integer, parameter :: cctki_use_cctk_ash = kind(cctk_ash)
  INTEGER cctk_alignment
  integer, parameter :: cctki_use_cctk_alignment = kind(cctk_alignment)
  INTEGER cctk_alignment_offset
  integer, parameter :: cctki_use_cctk_alignment_offset = kind(cctk_alignment_offset)
  INTEGER cctk_from (cctk_dim)
  integer, parameter :: cctki_use_cctk_from = kind(cctk_from)
  INTEGER cctk_to (cctk_dim)
  integer, parameter :: cctki_use_cctk_to = kind(cctk_to)
  INTEGER cctk_bbox (2*cctk_dim)
  integer, parameter :: cctki_use_cctk_bbox = kind(cctk_bbox)
  REAL*8 cctk_delta_time
  integer, parameter :: cctki_use_cctk_delta_time = kind(cctk_delta_time)
  REAL*8 cctk_time
  integer, parameter :: cctki_use_cctk_time = kind(cctk_time)
  REAL*8 cctk_delta_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_delta_space = kind(cctk_delta_space)
  REAL*8 cctk_origin_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_origin_space = kind(cctk_origin_space)
  INTEGER cctk_levfac (cctk_dim)
  integer, parameter :: cctki_use_cctk_levfac = kind(cctk_levfac)
  INTEGER cctk_levoff (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoff = kind(cctk_levoff)
  INTEGER cctk_levoffdenom (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoffdenom = kind(cctk_levoffdenom)
  INTEGER cctk_timefac
  integer, parameter :: cctki_use_cctk_timefac = kind(cctk_timefac)
  INTEGER cctk_convlevel
  integer, parameter :: cctki_use_cctk_convlevel = kind(cctk_convlevel)
  INTEGER cctk_convfac
  integer, parameter :: cctki_use_cctk_convfac = kind(cctk_convfac)
  INTEGER cctk_nghostzones (cctk_dim)
  integer, parameter :: cctki_use_cctk_nghostzones = kind(cctk_nghostzones)
  INTEGER cctk_iteration
  integer, parameter :: cctki_use_cctk_iteration = kind(cctk_iteration)
  integer*8 cctkGH
  integer, parameter :: cctki_use_cctkGH = kind(cctkGH)
  INTEGER cctk_ash1
  integer, parameter :: cctki_use_cctk_ash1 = kind(cctk_ash1)
  INTEGER cctk_ash2
  integer, parameter :: cctki_use_cctk_ash2 = kind(cctk_ash2)
  INTEGER cctk_ash3
  integer, parameter :: cctki_use_cctk_ash3 = kind(cctk_ash3)
  REAL*8 csum_all
  integer, parameter :: cctki_use_csum_all = kind(csum_all)
  REAL*8 csum_bnd
  integer, parameter :: cctki_use_csum_bnd = kind(csum_bnd)
  REAL*8 csum_int
  integer, parameter :: cctki_use_csum_int = kind(csum_int)
  REAL*8 csum_intbnd
  integer, parameter :: cctki_use_csum_intbnd = kind(csum_intbnd)
  REAL*8 fsum_all
  integer, parameter :: cctki_use_fsum_all = kind(fsum_all)
  REAL*8 fsum_bnd
  integer, parameter :: cctki_use_fsum_bnd = kind(fsum_bnd)
  REAL*8 fsum_int
  integer, parameter :: cctki_use_fsum_int = kind(fsum_int)
  REAL*8 fsum_intbnd
  integer, parameter :: cctki_use_fsum_intbnd = kind(fsum_intbnd)
  INTEGER*4 pointtypes (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_pointtypes = kind(pointtypes)
  REAL*8 coarse_dx
  integer, parameter :: cctki_use_coarse_dx = kind(coarse_dx)
  REAL*8 coarse_dy
  integer, parameter :: cctki_use_coarse_dy = kind(coarse_dy)
  REAL*8 coarse_dz
  integer, parameter :: cctki_use_coarse_dz = kind(coarse_dz)
  REAL*8 r (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_r = kind(r)
  REAL*8 x (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_x = kind(x)
  REAL*8 y (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_y = kind(y)
  REAL*8 z (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_z = kind(z)
  interface
  integer*8 function CCTK_PointerTo (var)
  implicit none
  type(*),dimension(..),TARGET :: var
  end function CCTK_PointerTo
  end interface
  interface
  integer function CCTK_Equals (arg1, arg2)
  implicit none
  integer*8 arg1
  character(*) arg2
  end function CCTK_Equals
  integer function CCTK_MyProc (cctkGH)
  implicit none
  integer*8 cctkGH
  end function CCTK_MyProc
  integer function CCTK_nProcs (cctkGH)
  implicit none
  integer*8 cctkGH
  end function CCTK_nProcs
  integer function CCTK_IsThornActive (name)
  implicit none
  character(*) name
  end function CCTK_IsThornActive
  integer*8 function CCTK_NullPointer ()
  implicit none
  end function CCTK_NullPointer
  end interface
  interface
  INTEGER*4 function GetBoundarySizesAndTypes (cctkGH, size, bndsize, is_ghostbnd, is_symbnd, is_physbnd)
  implicit none
  integer*8 cctkGH
  INTEGER*4 size
  INTEGER*4 bndsize(*)
  INTEGER*4 is_ghostbnd(*)
  INTEGER*4 is_symbnd(*)
  INTEGER*4 is_physbnd(*)
  end function GetBoundarySizesAndTypes
  end interface
  
  

  integer :: int3_int_interior_dir1, int3_int_interior_dir2, int3_int_interior_dir3
  integer :: int3_int_interior_ash1, int3_int_interior_ash2, int3_int_interior_ash3
  integer :: int3_int_interior_str1
  integer*8, save :: int3_int_interior_descr = 0
  type(lc_control_t) :: int3_int_interior_control
  integer :: int3_int_interior_cmin1, int3_int_interior_cmax1,                         int3_int_interior_cstep1, int3_int_interior_&
  &cpos1
  integer :: int3_int_interior_cmin2, int3_int_interior_cmax2,                         int3_int_interior_cstep2, int3_int_interior_&
  &cpos2
  integer :: int3_int_interior_cmin3, int3_int_interior_cmax3,                         int3_int_interior_cstep3, int3_int_interior_&
  &cpos3
  integer :: int3_int_interior_fmin1, int3_int_interior_fmax1,                         int3_int_interior_fstep1
  integer :: int3_int_interior_fmin2, int3_int_interior_fmax2,                         int3_int_interior_fstep2
  integer :: int3_int_interior_fmin3, int3_int_interior_fmax3,                         int3_int_interior_fstep3
  integer :: int3_int_interior1_ni,int3_int_interior1_nj,int3_int_interior1_nk
  INTEGER*4, parameter :: int33_isize = 6
  INTEGER*4 :: int33_bndsize    (6)
  INTEGER*4 :: int33_is_ghostbnd(6)
  INTEGER*4 :: int33_is_symbnd  (6)
  INTEGER*4 :: int33_is_physbnd (6)
  INTEGER*4 :: int33_ierr
  integer :: int33_dummy_imin, int33_dummy_imax
  integer   :: i,j,k
  REAL*8 :: fsum
  
  call CCTK_Info("TestLoopControl","TestLoopControlFortran_int")
  fsum = 0
  !$OMP PARALLEL reduction(+: fsum) private (int3_int_interior_control) &
  !$omp shared (int3_int_interior_descr) &
  !$omp private (int3_int_interior_dir1, int3_int_interior_dir2, int3_int_interior_dir3) &
  !$omp private (int3_int_interior_ash1, int3_int_interior_ash2, int3_int_interior_ash3) &
  !$omp private (int3_int_interior_str1) &
  !$omp private (int3_int_interior_cmin1, int3_int_interior_cmax1) &
  !$omp private (int3_int_interior_cstep1, int3_int_interior_cpos1) &
  !$omp private (int3_int_interior_cmin2, int3_int_interior_cmax2) &
  !$omp private (int3_int_interior_cstep2, int3_int_interior_cpos2) &
  !$omp private (int3_int_interior_cmin3, int3_int_interior_cmax3) &
  !$omp private (int3_int_interior_cstep3, int3_int_interior_cpos3) &
  !$omp private (int3_int_interior_fmin1, int3_int_interior_fmax1) &
  !$omp private (int3_int_interior_fstep1, i, int3_int_interior1_ni) &
  !$omp private (int3_int_interior_fmin2, int3_int_interior_fmax2) &
  !$omp private (int3_int_interior_fstep2, j, int3_int_interior1_nj) &
  !$omp private (int3_int_interior_fmin3, int3_int_interior_fmax3) &
  !$omp private (int3_int_interior_fstep3, k, int3_int_interior1_nk) &
  !$omp private(int33_bndsize) &
  !$omp private(int33_is_ghostbnd) &
  !$omp private(int33_is_symbnd) &
  !$omp private(int33_is_physbnd) &
  !$omp private(int33_ierr) &
  !$omp private(int33_dummy_imin, int33_dummy_imax) &
  !$OMP default(none) shared(cctkgh, cctk_ash, cctk_lsh, cctk_tile_min, cctk_tile_max, r)

  !$omp single
  int33_ierr = GetBoundarySizesAndTypes          (cctkGH, int33_isize, int33_bndsize, int33_is_ghostbnd, int33_is_symbnd, int33_is_&
  &physbnd)
  !$omp end single copyprivate(int33_bndsize)
  
  int3_int_interior_dir1 = (                         0)
  int3_int_interior_dir2 = (0)
  int3_int_interior_dir3 = (0)
  int3_int_interior_ash1 = (                                           cctk_ash(1))
  int3_int_interior_ash2 = (cctk_ash(2))
  int3_int_interior_ash3 = (cctk_ash(3))
  int3_int_interior_str1 = (   ( 1))
  call lc_descr_init(int3_int_interior_descr, 51, "<stdin>", "int3_int_interior")
  call lc_control_init(int3_int_interior_control, int3_int_interior_descr,                                       ((                &
  &                           max(cctk_tile_min(1)+1, (                              int(int33_bndsize(1+1)))+1))-1), ((           &
  &       max(cctk_tile_min(2)+1, (int(int33_bndsize(3+1)))+1))-1), ((                  max(cctk_tile_min(3)+1, (int(int33_bndsize(&
  &5+1)))+1))-1),                                  (                                           min(cctk_tile_max(1), cctk_lsh(1)-( &
  &                              int(int33_bndsize(2))))), (                  min(cctk_tile_max(2), cctk_lsh(2)-(int(int33_bndsize(&
  &4))))), (                  min(cctk_tile_max(3), cctk_lsh(3)-(int(int33_bndsize(6))))),                                         &
  &     int3_int_interior_ash1, int3_int_interior_ash2, int3_int_interior_ash3,                            int3_int_interior_str1, &
  &0, int3_int_interior_str1)
  call lc_thread_init(int3_int_interior_control)
  do while (lc_thread_done(int3_int_interior_control) == 0)
  int3_int_interior_control%coarse_loop%min%v(3) =                                    int3_int_interior_control%coarse_thread%pos%v&
  &(3)
  int3_int_interior_control%coarse_loop%max%v(3) =                                    min(int3_int_interior_control%coarse_thread%m&
  &ax%v(3),                                int3_int_interior_control%coarse_loop%min%v(3) +                                    int3&
  &_int_interior_control%coarse_thread%step%v(3))
  int3_int_interior_cmin3 = int3_int_interior_control%coarse_loop%min%v(3)
  int3_int_interior_cmax3 = int3_int_interior_control%coarse_loop%max%v(3)
  int3_int_interior_cstep3 = int3_int_interior_control%coarse_loop%step%v(3)
  int3_int_interior_control%coarse_loop%min%v(2) =                                    int3_int_interior_control%coarse_thread%pos%v&
  &(2)
  int3_int_interior_control%coarse_loop%max%v(2) =                                    min(int3_int_interior_control%coarse_thread%m&
  &ax%v(2),                                int3_int_interior_control%coarse_loop%min%v(2) +                                    int3&
  &_int_interior_control%coarse_thread%step%v(2))
  int3_int_interior_cmin2 = int3_int_interior_control%coarse_loop%min%v(2)
  int3_int_interior_cmax2 = int3_int_interior_control%coarse_loop%max%v(2)
  int3_int_interior_cstep2 = int3_int_interior_control%coarse_loop%step%v(2)
  int3_int_interior_control%coarse_loop%min%v(1) =                                    int3_int_interior_control%coarse_thread%pos%v&
  &(1)
  int3_int_interior_control%coarse_loop%max%v(1) =                                    min(int3_int_interior_control%coarse_thread%m&
  &ax%v(1),                                int3_int_interior_control%coarse_loop%min%v(1) +                                    int3&
  &_int_interior_control%coarse_thread%step%v(1))
  int3_int_interior_cmin1 = int3_int_interior_control%coarse_loop%min%v(1)
  int3_int_interior_cmax1 = int3_int_interior_control%coarse_loop%max%v(1)
  int3_int_interior_cstep1 = int3_int_interior_control%coarse_loop%step%v(1)
  do int3_int_interior_cpos3 = int3_int_interior_cmin3, int3_int_interior_cmax3,                                 int3_int_interior_&
  &cstep3
  do int3_int_interior_cpos2 = int3_int_interior_cmin2, int3_int_interior_cmax2,                                 int3_int_interior_&
  &cstep2
  do int3_int_interior_cpos1 = int3_int_interior_cmin1, int3_int_interior_cmax1,                                 int3_int_interior_&
  &cstep1
  int3_int_interior_control%fine_loop%min%v(3) = int3_int_interior_cpos3
  int3_int_interior_control%fine_loop%max%v(3) =                                      min(int3_int_interior_control%coarse_loop%max&
  &%v(3),                                  int3_int_interior_control%fine_loop%min%v(3) +                                      int3&
  &_int_interior_control%coarse_loop%step%v(3))
  int3_int_interior_fmin3 = int3_int_interior_control%fine_loop%min%v(3)
  int3_int_interior_fmax3 = int3_int_interior_control%fine_loop%max%v(3)
  int3_int_interior_fstep3 = int3_int_interior_control%fine_loop%step%v(3)
  int3_int_interior_control%fine_loop%min%v(2) = int3_int_interior_cpos2
  int3_int_interior_control%fine_loop%max%v(2) =                                      min(int3_int_interior_control%coarse_loop%max&
  &%v(2),                                  int3_int_interior_control%fine_loop%min%v(2) +                                      int3&
  &_int_interior_control%coarse_loop%step%v(2))
  int3_int_interior_fmin2 = int3_int_interior_control%fine_loop%min%v(2)
  int3_int_interior_fmax2 = int3_int_interior_control%fine_loop%max%v(2)
  int3_int_interior_fstep2 = int3_int_interior_control%fine_loop%step%v(2)
  int3_int_interior_control%fine_loop%min%v(1) = int3_int_interior_cpos1
  int3_int_interior_control%fine_loop%max%v(1) =                                      min(int3_int_interior_control%coarse_loop%max&
  &%v(1),                                  int3_int_interior_control%fine_loop%min%v(1) +                                      int3&
  &_int_interior_control%coarse_loop%step%v(1))
  int3_int_interior_fmin1 = int3_int_interior_control%fine_loop%min%v(1)
  int3_int_interior_fmax1 = int3_int_interior_control%fine_loop%max%v(1)
  int3_int_interior_fstep1 = int3_int_interior_control%fine_loop%step%v(1)
  do  k = int3_int_interior_fmin3+1, int3_int_interior_fmax3,                               int3_int_interior_fstep3
  int3_int_interior1_nk = 0
  if (int3_int_interior_dir3<0)  int3_int_interior1_nk =  k
  if (int3_int_interior_dir3>0)  int3_int_interior1_nk = int3_int_interior_control%overall%max%v(3)+1- k
  do  j = int3_int_interior_fmin2+1, int3_int_interior_fmax2,                               int3_int_interior_fstep2
  int3_int_interior1_nj = 0
  if (int3_int_interior_dir2<0)  int3_int_interior1_nj =  j
  if (int3_int_interior_dir2>0)  int3_int_interior1_nj = int3_int_interior_control%overall%max%v(2)+1- j
  do                                                                                                   i = int3_int_interior_fmin1+&
  &1, int3_int_interior_fmax1,                               int3_int_interior_fstep1
  int3_int_interior1_ni = 0
  if (int3_int_interior_dir1<0)                           int3_int_interior1_ni =                                                  &
  &                                                 i
  if (int3_int_interior_dir1>0)                           int3_int_interior1_ni = int3_int_interior_control%overall%max%v(1)+1-    &
  &                                                                                              i
     fsum = fsum + r(i,j,k)

  end do
  end do
  end do
  end do
  end do
  end do
  call lc_thread_step(int3_int_interior_control)
  end do
  call lc_control_finish(int3_int_interior_control, int3_int_interior_descr)
  !$OMP END PARALLEL
  fsum_int = fsum
end subroutine TestLoopControlFortran_int



subroutine TestLoopControlFortran_bnd(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_alig&
  &nment,cctk_alignment_offset,cctk_from,cctk_to,cctk_bbox,cctk_delta_time,cctk_time,cctk_delta_space,cctk_origin_space,cctk_levfac&
  &,cctk_levoff,cctk_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_ash&
  &2,cctk_ash3, csum_all,csum_bnd,csum_int,csum_intbnd,fsum_all,fsum_bnd,fsum_int,fsum_intbnd,pointtypes, coarse_dx,coarse_dy,coars&
  &e_dz,r,x,y,z)
  use loopcontrol
  implicit none

  INTEGER cctk_dim
  integer, parameter :: cctki_use_cctk_dim = kind(cctk_dim)
  INTEGER cctk_gsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_gsh = kind(cctk_gsh)
  INTEGER cctk_lsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_lsh = kind(cctk_lsh)
  INTEGER cctk_lbnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_lbnd = kind(cctk_lbnd)
  INTEGER cctk_ubnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_ubnd = kind(cctk_ubnd)
  INTEGER cctk_tile_min (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_min = kind(cctk_tile_min)
  INTEGER cctk_tile_max (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_max = kind(cctk_tile_max)
  INTEGER cctk_ash (cctk_dim)
  integer, parameter :: cctki_use_cctk_ash = kind(cctk_ash)
  INTEGER cctk_alignment
  integer, parameter :: cctki_use_cctk_alignment = kind(cctk_alignment)
  INTEGER cctk_alignment_offset
  integer, parameter :: cctki_use_cctk_alignment_offset = kind(cctk_alignment_offset)
  INTEGER cctk_from (cctk_dim)
  integer, parameter :: cctki_use_cctk_from = kind(cctk_from)
  INTEGER cctk_to (cctk_dim)
  integer, parameter :: cctki_use_cctk_to = kind(cctk_to)
  INTEGER cctk_bbox (2*cctk_dim)
  integer, parameter :: cctki_use_cctk_bbox = kind(cctk_bbox)
  REAL*8 cctk_delta_time
  integer, parameter :: cctki_use_cctk_delta_time = kind(cctk_delta_time)
  REAL*8 cctk_time
  integer, parameter :: cctki_use_cctk_time = kind(cctk_time)
  REAL*8 cctk_delta_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_delta_space = kind(cctk_delta_space)
  REAL*8 cctk_origin_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_origin_space = kind(cctk_origin_space)
  INTEGER cctk_levfac (cctk_dim)
  integer, parameter :: cctki_use_cctk_levfac = kind(cctk_levfac)
  INTEGER cctk_levoff (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoff = kind(cctk_levoff)
  INTEGER cctk_levoffdenom (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoffdenom = kind(cctk_levoffdenom)
  INTEGER cctk_timefac
  integer, parameter :: cctki_use_cctk_timefac = kind(cctk_timefac)
  INTEGER cctk_convlevel
  integer, parameter :: cctki_use_cctk_convlevel = kind(cctk_convlevel)
  INTEGER cctk_convfac
  integer, parameter :: cctki_use_cctk_convfac = kind(cctk_convfac)
  INTEGER cctk_nghostzones (cctk_dim)
  integer, parameter :: cctki_use_cctk_nghostzones = kind(cctk_nghostzones)
  INTEGER cctk_iteration
  integer, parameter :: cctki_use_cctk_iteration = kind(cctk_iteration)
  integer*8 cctkGH
  integer, parameter :: cctki_use_cctkGH = kind(cctkGH)
  INTEGER cctk_ash1
  integer, parameter :: cctki_use_cctk_ash1 = kind(cctk_ash1)
  INTEGER cctk_ash2
  integer, parameter :: cctki_use_cctk_ash2 = kind(cctk_ash2)
  INTEGER cctk_ash3
  integer, parameter :: cctki_use_cctk_ash3 = kind(cctk_ash3)
  REAL*8 csum_all
  integer, parameter :: cctki_use_csum_all = kind(csum_all)
  REAL*8 csum_bnd
  integer, parameter :: cctki_use_csum_bnd = kind(csum_bnd)
  REAL*8 csum_int
  integer, parameter :: cctki_use_csum_int = kind(csum_int)
  REAL*8 csum_intbnd
  integer, parameter :: cctki_use_csum_intbnd = kind(csum_intbnd)
  REAL*8 fsum_all
  integer, parameter :: cctki_use_fsum_all = kind(fsum_all)
  REAL*8 fsum_bnd
  integer, parameter :: cctki_use_fsum_bnd = kind(fsum_bnd)
  REAL*8 fsum_int
  integer, parameter :: cctki_use_fsum_int = kind(fsum_int)
  REAL*8 fsum_intbnd
  integer, parameter :: cctki_use_fsum_intbnd = kind(fsum_intbnd)
  INTEGER*4 pointtypes (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_pointtypes = kind(pointtypes)
  REAL*8 coarse_dx
  integer, parameter :: cctki_use_coarse_dx = kind(coarse_dx)
  REAL*8 coarse_dy
  integer, parameter :: cctki_use_coarse_dy = kind(coarse_dy)
  REAL*8 coarse_dz
  integer, parameter :: cctki_use_coarse_dz = kind(coarse_dz)
  REAL*8 r (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_r = kind(r)
  REAL*8 x (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_x = kind(x)
  REAL*8 y (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_y = kind(y)
  REAL*8 z (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_z = kind(z)
  interface
  integer*8 function CCTK_PointerTo (var)
  implicit none
  type(*),dimension(..),TARGET :: var
  end function CCTK_PointerTo
  end interface
  interface
  integer function CCTK_Equals (arg1, arg2)
  implicit none
  integer*8 arg1
  character(*) arg2
  end function CCTK_Equals
  integer function CCTK_MyProc (cctkGH)
  implicit none
  integer*8 cctkGH
  end function CCTK_MyProc
  integer function CCTK_nProcs (cctkGH)
  implicit none
  integer*8 cctkGH
  end function CCTK_nProcs
  integer function CCTK_IsThornActive (name)
  implicit none
  character(*) name
  end function CCTK_IsThornActive
  integer*8 function CCTK_NullPointer ()
  implicit none
  end function CCTK_NullPointer
  end interface
  interface
  INTEGER*4 function GetBoundarySizesAndTypes (cctkGH, size, bndsize, is_ghostbnd, is_symbnd, is_physbnd)
  implicit none
  integer*8 cctkGH
  INTEGER*4 size
  INTEGER*4 bndsize(*)
  INTEGER*4 is_ghostbnd(*)
  INTEGER*4 is_symbnd(*)
  INTEGER*4 is_physbnd(*)
  end function GetBoundarySizesAndTypes
  end interface
  
  

  integer :: bnd3_bnd_boundaries_dir1, bnd3_bnd_boundaries_dir2, bnd3_bnd_boundaries_dir3
  integer :: bnd3_bnd_boundaries_ash1, bnd3_bnd_boundaries_ash2, bnd3_bnd_boundaries_ash3
  integer :: bnd3_bnd_boundaries_str1
  integer*8, save :: bnd3_bnd_boundaries_descr = 0
  type(lc_control_t) :: bnd3_bnd_boundaries_control
  integer :: bnd3_bnd_boundaries_cmin1, bnd3_bnd_boundaries_cmax1,                         bnd3_bnd_boundaries_cstep1, bnd3_bnd_bou&
  &ndaries_cpos1
  integer :: bnd3_bnd_boundaries_cmin2, bnd3_bnd_boundaries_cmax2,                         bnd3_bnd_boundaries_cstep2, bnd3_bnd_bou&
  &ndaries_cpos2
  integer :: bnd3_bnd_boundaries_cmin3, bnd3_bnd_boundaries_cmax3,                         bnd3_bnd_boundaries_cstep3, bnd3_bnd_bou&
  &ndaries_cpos3
  integer :: bnd3_bnd_boundaries_fmin1, bnd3_bnd_boundaries_fmax1,                         bnd3_bnd_boundaries_fstep1
  integer :: bnd3_bnd_boundaries_fmin2, bnd3_bnd_boundaries_fmax2,                         bnd3_bnd_boundaries_fstep2
  integer :: bnd3_bnd_boundaries_fmin3, bnd3_bnd_boundaries_fmax3,                         bnd3_bnd_boundaries_fstep3
  integer :: bnd3_bnd2_blo(3), bnd3_bnd2_bhi(3)
  integer :: bnd3_bnd2_bboxlo(3), bnd3_bnd2_bboxhi(3)
  integer :: bnd3_bnd2_istr
  integer :: bnd3_bnd2_idir,bnd3_bnd2_jdir,bnd3_bnd2_kdir
  logical :: bnd3_bnd2_any_bbox
  integer :: bnd3_bnd2_bmin(3), bnd3_bnd2_bmax(3)
  INTEGER*4, parameter :: bnd33_isize = 6
  INTEGER*4 :: bnd33_bndsize    (6)
  INTEGER*4 :: bnd33_is_ghostbnd(6)
  INTEGER*4 :: bnd33_is_symbnd  (6)
  INTEGER*4 :: bnd33_is_physbnd (6)
  INTEGER*4 :: bnd33_ierr
  integer :: bnd33_dummy_imin, bnd33_dummy_imax
  integer   :: i,j,k
  integer   :: n_i,n_j,n_k
  REAL*8 :: fsum
  
  call CCTK_Info("TestLoopControl","TestLoopControlFortran_bnd")
  fsum = 0
  !$omp parallel private (bnd3_bnd_boundaries_control) &
  !$omp shared (bnd3_bnd_boundaries_descr) &
  !$omp private (bnd3_bnd_boundaries_dir1, bnd3_bnd_boundaries_dir2, bnd3_bnd_boundaries_dir3) &
  !$omp private (bnd3_bnd_boundaries_ash1, bnd3_bnd_boundaries_ash2, bnd3_bnd_boundaries_ash3) &
  !$omp private (bnd3_bnd_boundaries_str1) &
  !$omp private (bnd3_bnd_boundaries_cmin1, bnd3_bnd_boundaries_cmax1) &
  !$omp private (bnd3_bnd_boundaries_cstep1, bnd3_bnd_boundaries_cpos1) &
  !$omp private (bnd3_bnd_boundaries_cmin2, bnd3_bnd_boundaries_cmax2) &
  !$omp private (bnd3_bnd_boundaries_cstep2, bnd3_bnd_boundaries_cpos2) &
  !$omp private (bnd3_bnd_boundaries_cmin3, bnd3_bnd_boundaries_cmax3) &
  !$omp private (bnd3_bnd_boundaries_cstep3, bnd3_bnd_boundaries_cpos3) &
  !$omp private (bnd3_bnd_boundaries_fmin1, bnd3_bnd_boundaries_fmax1) &
  !$omp private (bnd3_bnd_boundaries_fstep1, i, n_i) &
  !$omp private (bnd3_bnd_boundaries_fmin2, bnd3_bnd_boundaries_fmax2) &
  !$omp private (bnd3_bnd_boundaries_fstep2, j, n_j) &
  !$omp private (bnd3_bnd_boundaries_fmin3, bnd3_bnd_boundaries_fmax3) &
  !$omp private (bnd3_bnd_boundaries_fstep3, k, n_k) &
  !$omp private(bnd3_bnd2_blo, bnd3_bnd2_bhi) &
  !$omp private(bnd3_bnd2_bboxlo, bnd3_bnd2_bboxhi) &
  !$omp private(bnd3_bnd2_istr) &
  !$omp private(bnd3_bnd2_idir,bnd3_bnd2_jdir,bnd3_bnd2_kdir) &
  !$omp private(bnd3_bnd2_any_bbox) &
  !$omp private(bnd3_bnd2_bmin, bnd3_bnd2_bmax) &
  !$omp private(bnd33_bndsize) &
  !$omp private(bnd33_is_ghostbnd) &
  !$omp private(bnd33_is_symbnd) &
  !$omp private(bnd33_is_physbnd) &
  !$omp private(bnd33_ierr) &
  !$omp private(bnd33_dummy_imin, bnd33_dummy_imax) &
  !$OMP reduction(+: fsum) &
  !$OMP default(none) shared(cctkgh, cctk_ash, cctk_lsh, cctk_tile_min, cctk_tile_max, r)

  !$omp single
  bnd33_ierr = GetBoundarySizesAndTypes          (cctkGH, bnd33_isize, bnd33_bndsize, bnd33_is_ghostbnd, bnd33_is_symbnd, bnd33_is_&
  &physbnd)
  !$omp end single copyprivate(bnd33_bndsize, bnd33_is_physbnd)
  
  bnd3_bnd2_blo = (/                                 int(bnd33_bndsize(1)),int(bnd33_bndsize(3)),int(bnd33_bndsize(5)) /)
  bnd3_bnd2_bhi = (/                                  int(bnd33_bndsize(2)),int(bnd33_bndsize(4)),int(bnd33_bndsize(6)) /)
  bnd3_bnd2_bboxlo = (/                                  int(bnd33_is_physbnd(1)),int(bnd33_is_physbnd(3)),int(bnd33_is_physbnd(5))&
  & /)
  bnd3_bnd2_bboxhi = (/                                  int(bnd33_is_physbnd(2)),int(bnd33_is_physbnd(4)),int(bnd33_is_physbnd(6))&
  & /)
  bnd3_bnd2_istr = ( ( 1))
  do bnd3_bnd2_kdir=-1, +1
  do bnd3_bnd2_jdir=-1, +1
  do bnd3_bnd2_idir=-1, +1
  bnd3_bnd2_any_bbox = .false.
  if (bnd3_bnd2_idir<0) bnd3_bnd2_any_bbox = bnd3_bnd2_any_bbox .or. bnd3_bnd2_bboxlo(1) /= 0
  if (bnd3_bnd2_jdir<0) bnd3_bnd2_any_bbox = bnd3_bnd2_any_bbox .or. bnd3_bnd2_bboxlo(2) /= 0
  if (bnd3_bnd2_kdir<0) bnd3_bnd2_any_bbox = bnd3_bnd2_any_bbox .or. bnd3_bnd2_bboxlo(3) /= 0
  if (bnd3_bnd2_idir>0) bnd3_bnd2_any_bbox = bnd3_bnd2_any_bbox .or. bnd3_bnd2_bboxhi(1) /= 0
  if (bnd3_bnd2_jdir>0) bnd3_bnd2_any_bbox = bnd3_bnd2_any_bbox .or. bnd3_bnd2_bboxhi(2) /= 0
  if (bnd3_bnd2_kdir>0) bnd3_bnd2_any_bbox = bnd3_bnd2_any_bbox .or. bnd3_bnd2_bboxhi(3) /= 0
  if (bnd3_bnd2_any_bbox) then
  bnd3_bnd2_bmin(1) = bnd3_bnd2_blo(1) + 1
  bnd3_bnd2_bmin(2) = bnd3_bnd2_blo(2) + 1
  bnd3_bnd2_bmin(3) = bnd3_bnd2_blo(3) + 1
  if (bnd3_bnd2_idir<0) bnd3_bnd2_bmin(1) = 1
  if (bnd3_bnd2_jdir<0) bnd3_bnd2_bmin(2) = 1
  if (bnd3_bnd2_kdir<0) bnd3_bnd2_bmin(3) = 1
  if (bnd3_bnd2_idir>0) bnd3_bnd2_bmin(1) = cctk_lsh(1) - bnd3_bnd2_bhi(1) + 1
  if (bnd3_bnd2_jdir>0) bnd3_bnd2_bmin(2) = cctk_lsh(2) - bnd3_bnd2_bhi(2) + 1
  if (bnd3_bnd2_kdir>0) bnd3_bnd2_bmin(3) = cctk_lsh(3) - bnd3_bnd2_bhi(3) + 1
  bnd3_bnd2_bmax(1) = cctk_lsh(1) - bnd3_bnd2_bhi(1)
  bnd3_bnd2_bmax(2) = cctk_lsh(2) - bnd3_bnd2_bhi(2)
  bnd3_bnd2_bmax(3) = cctk_lsh(3) - bnd3_bnd2_bhi(3)
  if (bnd3_bnd2_idir<0) bnd3_bnd2_bmax(1) = bnd3_bnd2_blo(1)
  if (bnd3_bnd2_jdir<0) bnd3_bnd2_bmax(2) = bnd3_bnd2_blo(2)
  if (bnd3_bnd2_kdir<0) bnd3_bnd2_bmax(3) = bnd3_bnd2_blo(3)
  if (bnd3_bnd2_idir>0) bnd3_bnd2_bmax(1) = cctk_lsh(1)
  if (bnd3_bnd2_jdir>0) bnd3_bnd2_bmax(2) = cctk_lsh(2)
  if (bnd3_bnd2_kdir>0) bnd3_bnd2_bmax(3) = cctk_lsh(3)
  
  bnd3_bnd_boundaries_dir1 = (                                  bnd3_bnd2_idir)
  bnd3_bnd_boundaries_dir2 = (bnd3_bnd2_jdir)
  bnd3_bnd_boundaries_dir3 = (bnd3_bnd2_kdir)
  bnd3_bnd_boundaries_ash1 = (                                   cctk_ash(1))
  bnd3_bnd_boundaries_ash2 = (cctk_ash(2))
  bnd3_bnd_boundaries_ash3 = (cctk_ash(3))
  bnd3_bnd_boundaries_str1 = ( bnd3_bnd2_istr)
  call lc_descr_init(bnd3_bnd_boundaries_descr, 77, "<stdin>", "bnd3_bnd_boundaries")
  call lc_control_init(bnd3_bnd_boundaries_control, bnd3_bnd_boundaries_descr,                                       ((            &
  &                      max(cctk_tile_min(1)+1, bnd3_bnd2_bmin(1)))-1), ((max(cctk_tile_min(2)+1, bnd3_bnd2_bmin(2)))-1), ((max(cc&
  &tk_tile_min(3)+1, bnd3_bnd2_bmin(3)))-1),                                  (                                   min(cctk_tile_max&
  &(1), bnd3_bnd2_bmax(1))), (min(cctk_tile_max(2), bnd3_bnd2_bmax(2))), (min(cctk_tile_max(3), bnd3_bnd2_bmax(3))),               &
  &                               bnd3_bnd_boundaries_ash1, bnd3_bnd_boundaries_ash2, bnd3_bnd_boundaries_ash3,                    &
  &        bnd3_bnd_boundaries_str1, 0, bnd3_bnd_boundaries_str1)
  call lc_thread_init(bnd3_bnd_boundaries_control)
  do while (lc_thread_done(bnd3_bnd_boundaries_control) == 0)
  bnd3_bnd_boundaries_control%coarse_loop%min%v(3) =                                    bnd3_bnd_boundaries_control%coarse_thread%p&
  &os%v(3)
  bnd3_bnd_boundaries_control%coarse_loop%max%v(3) =                                    min(bnd3_bnd_boundaries_control%coarse_thre&
  &ad%max%v(3),                                bnd3_bnd_boundaries_control%coarse_loop%min%v(3) +                                  &
  &  bnd3_bnd_boundaries_control%coarse_thread%step%v(3))
  bnd3_bnd_boundaries_cmin3 = bnd3_bnd_boundaries_control%coarse_loop%min%v(3)
  bnd3_bnd_boundaries_cmax3 = bnd3_bnd_boundaries_control%coarse_loop%max%v(3)
  bnd3_bnd_boundaries_cstep3 = bnd3_bnd_boundaries_control%coarse_loop%step%v(3)
  bnd3_bnd_boundaries_control%coarse_loop%min%v(2) =                                    bnd3_bnd_boundaries_control%coarse_thread%p&
  &os%v(2)
  bnd3_bnd_boundaries_control%coarse_loop%max%v(2) =                                    min(bnd3_bnd_boundaries_control%coarse_thre&
  &ad%max%v(2),                                bnd3_bnd_boundaries_control%coarse_loop%min%v(2) +                                  &
  &  bnd3_bnd_boundaries_control%coarse_thread%step%v(2))
  bnd3_bnd_boundaries_cmin2 = bnd3_bnd_boundaries_control%coarse_loop%min%v(2)
  bnd3_bnd_boundaries_cmax2 = bnd3_bnd_boundaries_control%coarse_loop%max%v(2)
  bnd3_bnd_boundaries_cstep2 = bnd3_bnd_boundaries_control%coarse_loop%step%v(2)
  bnd3_bnd_boundaries_control%coarse_loop%min%v(1) =                                    bnd3_bnd_boundaries_control%coarse_thread%p&
  &os%v(1)
  bnd3_bnd_boundaries_control%coarse_loop%max%v(1) =                                    min(bnd3_bnd_boundaries_control%coarse_thre&
  &ad%max%v(1),                                bnd3_bnd_boundaries_control%coarse_loop%min%v(1) +                                  &
  &  bnd3_bnd_boundaries_control%coarse_thread%step%v(1))
  bnd3_bnd_boundaries_cmin1 = bnd3_bnd_boundaries_control%coarse_loop%min%v(1)
  bnd3_bnd_boundaries_cmax1 = bnd3_bnd_boundaries_control%coarse_loop%max%v(1)
  bnd3_bnd_boundaries_cstep1 = bnd3_bnd_boundaries_control%coarse_loop%step%v(1)
  do bnd3_bnd_boundaries_cpos3 = bnd3_bnd_boundaries_cmin3, bnd3_bnd_boundaries_cmax3,                                 bnd3_bnd_bou&
  &ndaries_cstep3
  do bnd3_bnd_boundaries_cpos2 = bnd3_bnd_boundaries_cmin2, bnd3_bnd_boundaries_cmax2,                                 bnd3_bnd_bou&
  &ndaries_cstep2
  do bnd3_bnd_boundaries_cpos1 = bnd3_bnd_boundaries_cmin1, bnd3_bnd_boundaries_cmax1,                                 bnd3_bnd_bou&
  &ndaries_cstep1
  bnd3_bnd_boundaries_control%fine_loop%min%v(3) = bnd3_bnd_boundaries_cpos3
  bnd3_bnd_boundaries_control%fine_loop%max%v(3) =                                      min(bnd3_bnd_boundaries_control%coarse_loop&
  &%max%v(3),                                  bnd3_bnd_boundaries_control%fine_loop%min%v(3) +                                    &
  &  bnd3_bnd_boundaries_control%coarse_loop%step%v(3))
  bnd3_bnd_boundaries_fmin3 = bnd3_bnd_boundaries_control%fine_loop%min%v(3)
  bnd3_bnd_boundaries_fmax3 = bnd3_bnd_boundaries_control%fine_loop%max%v(3)
  bnd3_bnd_boundaries_fstep3 = bnd3_bnd_boundaries_control%fine_loop%step%v(3)
  bnd3_bnd_boundaries_control%fine_loop%min%v(2) = bnd3_bnd_boundaries_cpos2
  bnd3_bnd_boundaries_control%fine_loop%max%v(2) =                                      min(bnd3_bnd_boundaries_control%coarse_loop&
  &%max%v(2),                                  bnd3_bnd_boundaries_control%fine_loop%min%v(2) +                                    &
  &  bnd3_bnd_boundaries_control%coarse_loop%step%v(2))
  bnd3_bnd_boundaries_fmin2 = bnd3_bnd_boundaries_control%fine_loop%min%v(2)
  bnd3_bnd_boundaries_fmax2 = bnd3_bnd_boundaries_control%fine_loop%max%v(2)
  bnd3_bnd_boundaries_fstep2 = bnd3_bnd_boundaries_control%fine_loop%step%v(2)
  bnd3_bnd_boundaries_control%fine_loop%min%v(1) = bnd3_bnd_boundaries_cpos1
  bnd3_bnd_boundaries_control%fine_loop%max%v(1) =                                      min(bnd3_bnd_boundaries_control%coarse_loop&
  &%max%v(1),                                  bnd3_bnd_boundaries_control%fine_loop%min%v(1) +                                    &
  &  bnd3_bnd_boundaries_control%coarse_loop%step%v(1))
  bnd3_bnd_boundaries_fmin1 = bnd3_bnd_boundaries_control%fine_loop%min%v(1)
  bnd3_bnd_boundaries_fmax1 = bnd3_bnd_boundaries_control%fine_loop%max%v(1)
  bnd3_bnd_boundaries_fstep1 = bnd3_bnd_boundaries_control%fine_loop%step%v(1)
  do  k = bnd3_bnd_boundaries_fmin3+1, bnd3_bnd_boundaries_fmax3,                               bnd3_bnd_boundaries_fstep3
  n_k = 0
  if (bnd3_bnd_boundaries_dir3<0)  n_k =  k
  if (bnd3_bnd_boundaries_dir3>0)  n_k = bnd3_bnd_boundaries_control%overall%max%v(3)+1- k
  do  j = bnd3_bnd_boundaries_fmin2+1, bnd3_bnd_boundaries_fmax2,                               bnd3_bnd_boundaries_fstep2
  n_j = 0
  if (bnd3_bnd_boundaries_dir2<0)  n_j =  j
  if (bnd3_bnd_boundaries_dir2>0)  n_j = bnd3_bnd_boundaries_control%overall%max%v(2)+1- j
  do                                                                                           i = bnd3_bnd_boundaries_fmin1+1, bnd&
  &3_bnd_boundaries_fmax1,                               bnd3_bnd_boundaries_fstep1
  n_i = 0
  if (bnd3_bnd_boundaries_dir1<0)                                                                                           n_i =  &
  &                                                                                         i
  if (bnd3_bnd_boundaries_dir1>0)                                                                                           n_i = b&
  &nd3_bnd_boundaries_control%overall%max%v(1)+1-                                                                                  &
  &        i
     fsum = fsum + r(i,j,k)

  end do
  end do
  end do
  end do
  end do
  end do
  call lc_thread_step(bnd3_bnd_boundaries_control)
  end do
  call lc_control_finish(bnd3_bnd_boundaries_control, bnd3_bnd_boundaries_descr)
  end if
  end do
  end do
  end do
  !$omp end parallel
  fsum_bnd = fsum
end subroutine TestLoopControlFortran_bnd



subroutine TestLoopControlFortran_intbnd(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_a&
  &lignment,cctk_alignment_offset,cctk_from,cctk_to,cctk_bbox,cctk_delta_time,cctk_time,cctk_delta_space,cctk_origin_space,cctk_lev&
  &fac,cctk_levoff,cctk_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_&
  &ash2,cctk_ash3, csum_all,csum_bnd,csum_int,csum_intbnd,fsum_all,fsum_bnd,fsum_int,fsum_intbnd,pointtypes, coarse_dx,coarse_dy,co&
  &arse_dz,r,x,y,z)
  use loopcontrol
  implicit none

  INTEGER cctk_dim
  integer, parameter :: cctki_use_cctk_dim = kind(cctk_dim)
  INTEGER cctk_gsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_gsh = kind(cctk_gsh)
  INTEGER cctk_lsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_lsh = kind(cctk_lsh)
  INTEGER cctk_lbnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_lbnd = kind(cctk_lbnd)
  INTEGER cctk_ubnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_ubnd = kind(cctk_ubnd)
  INTEGER cctk_tile_min (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_min = kind(cctk_tile_min)
  INTEGER cctk_tile_max (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_max = kind(cctk_tile_max)
  INTEGER cctk_ash (cctk_dim)
  integer, parameter :: cctki_use_cctk_ash = kind(cctk_ash)
  INTEGER cctk_alignment
  integer, parameter :: cctki_use_cctk_alignment = kind(cctk_alignment)
  INTEGER cctk_alignment_offset
  integer, parameter :: cctki_use_cctk_alignment_offset = kind(cctk_alignment_offset)
  INTEGER cctk_from (cctk_dim)
  integer, parameter :: cctki_use_cctk_from = kind(cctk_from)
  INTEGER cctk_to (cctk_dim)
  integer, parameter :: cctki_use_cctk_to = kind(cctk_to)
  INTEGER cctk_bbox (2*cctk_dim)
  integer, parameter :: cctki_use_cctk_bbox = kind(cctk_bbox)
  REAL*8 cctk_delta_time
  integer, parameter :: cctki_use_cctk_delta_time = kind(cctk_delta_time)
  REAL*8 cctk_time
  integer, parameter :: cctki_use_cctk_time = kind(cctk_time)
  REAL*8 cctk_delta_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_delta_space = kind(cctk_delta_space)
  REAL*8 cctk_origin_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_origin_space = kind(cctk_origin_space)
  INTEGER cctk_levfac (cctk_dim)
  integer, parameter :: cctki_use_cctk_levfac = kind(cctk_levfac)
  INTEGER cctk_levoff (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoff = kind(cctk_levoff)
  INTEGER cctk_levoffdenom (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoffdenom = kind(cctk_levoffdenom)
  INTEGER cctk_timefac
  integer, parameter :: cctki_use_cctk_timefac = kind(cctk_timefac)
  INTEGER cctk_convlevel
  integer, parameter :: cctki_use_cctk_convlevel = kind(cctk_convlevel)
  INTEGER cctk_convfac
  integer, parameter :: cctki_use_cctk_convfac = kind(cctk_convfac)
  INTEGER cctk_nghostzones (cctk_dim)
  integer, parameter :: cctki_use_cctk_nghostzones = kind(cctk_nghostzones)
  INTEGER cctk_iteration
  integer, parameter :: cctki_use_cctk_iteration = kind(cctk_iteration)
  integer*8 cctkGH
  integer, parameter :: cctki_use_cctkGH = kind(cctkGH)
  INTEGER cctk_ash1
  integer, parameter :: cctki_use_cctk_ash1 = kind(cctk_ash1)
  INTEGER cctk_ash2
  integer, parameter :: cctki_use_cctk_ash2 = kind(cctk_ash2)
  INTEGER cctk_ash3
  integer, parameter :: cctki_use_cctk_ash3 = kind(cctk_ash3)
  REAL*8 csum_all
  integer, parameter :: cctki_use_csum_all = kind(csum_all)
  REAL*8 csum_bnd
  integer, parameter :: cctki_use_csum_bnd = kind(csum_bnd)
  REAL*8 csum_int
  integer, parameter :: cctki_use_csum_int = kind(csum_int)
  REAL*8 csum_intbnd
  integer, parameter :: cctki_use_csum_intbnd = kind(csum_intbnd)
  REAL*8 fsum_all
  integer, parameter :: cctki_use_fsum_all = kind(fsum_all)
  REAL*8 fsum_bnd
  integer, parameter :: cctki_use_fsum_bnd = kind(fsum_bnd)
  REAL*8 fsum_int
  integer, parameter :: cctki_use_fsum_int = kind(fsum_int)
  REAL*8 fsum_intbnd
  integer, parameter :: cctki_use_fsum_intbnd = kind(fsum_intbnd)
  INTEGER*4 pointtypes (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_pointtypes = kind(pointtypes)
  REAL*8 coarse_dx
  integer, parameter :: cctki_use_coarse_dx = kind(coarse_dx)
  REAL*8 coarse_dy
  integer, parameter :: cctki_use_coarse_dy = kind(coarse_dy)
  REAL*8 coarse_dz
  integer, parameter :: cctki_use_coarse_dz = kind(coarse_dz)
  REAL*8 r (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_r = kind(r)
  REAL*8 x (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_x = kind(x)
  REAL*8 y (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_y = kind(y)
  REAL*8 z (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_z = kind(z)
  interface
  integer*8 function CCTK_PointerTo (var)
  implicit none
  type(*),dimension(..),TARGET :: var
  end function CCTK_PointerTo
  end interface
  interface
  integer function CCTK_Equals (arg1, arg2)
  implicit none
  integer*8 arg1
  character(*) arg2
  end function CCTK_Equals
  integer function CCTK_MyProc (cctkGH)
  implicit none
  integer*8 cctkGH
  end function CCTK_MyProc
  integer function CCTK_nProcs (cctkGH)
  implicit none
  integer*8 cctkGH
  end function CCTK_nProcs
  integer function CCTK_IsThornActive (name)
  implicit none
  character(*) name
  end function CCTK_IsThornActive
  integer*8 function CCTK_NullPointer ()
  implicit none
  end function CCTK_NullPointer
  end interface
  interface
  INTEGER*4 function GetBoundarySizesAndTypes (cctkGH, size, bndsize, is_ghostbnd, is_symbnd, is_physbnd)
  implicit none
  integer*8 cctkGH
  INTEGER*4 size
  INTEGER*4 bndsize(*)
  INTEGER*4 is_ghostbnd(*)
  INTEGER*4 is_symbnd(*)
  INTEGER*4 is_physbnd(*)
  end function GetBoundarySizesAndTypes
  end interface
  
  

  integer :: intbnd3_bnd_intboundaries_dir1, intbnd3_bnd_intboundaries_dir2, intbnd3_bnd_intboundaries_dir3
  integer :: intbnd3_bnd_intboundaries_ash1, intbnd3_bnd_intboundaries_ash2, intbnd3_bnd_intboundaries_ash3
  integer :: intbnd3_bnd_intboundaries_str1
  integer*8, save :: intbnd3_bnd_intboundaries_descr = 0
  type(lc_control_t) :: intbnd3_bnd_intboundaries_control
  integer :: intbnd3_bnd_intboundaries_cmin1, intbnd3_bnd_intboundaries_cmax1,                         intbnd3_bnd_intboundaries_cs&
  &tep1, intbnd3_bnd_intboundaries_cpos1
  integer :: intbnd3_bnd_intboundaries_cmin2, intbnd3_bnd_intboundaries_cmax2,                         intbnd3_bnd_intboundaries_cs&
  &tep2, intbnd3_bnd_intboundaries_cpos2
  integer :: intbnd3_bnd_intboundaries_cmin3, intbnd3_bnd_intboundaries_cmax3,                         intbnd3_bnd_intboundaries_cs&
  &tep3, intbnd3_bnd_intboundaries_cpos3
  integer :: intbnd3_bnd_intboundaries_fmin1, intbnd3_bnd_intboundaries_fmax1,                         intbnd3_bnd_intboundaries_fs&
  &tep1
  integer :: intbnd3_bnd_intboundaries_fmin2, intbnd3_bnd_intboundaries_fmax2,                         intbnd3_bnd_intboundaries_fs&
  &tep2
  integer :: intbnd3_bnd_intboundaries_fmin3, intbnd3_bnd_intboundaries_fmax3,                         intbnd3_bnd_intboundaries_fs&
  &tep3
  integer :: intbnd3_bnd2_blo(3), intbnd3_bnd2_bhi(3)
  integer :: intbnd3_bnd2_bboxlo(3), intbnd3_bnd2_bboxhi(3)
  integer :: intbnd3_bnd2_istr
  integer :: intbnd3_bnd2_idir,intbnd3_bnd2_jdir,intbnd3_bnd2_kdir
  logical :: intbnd3_bnd2_any_bbox, intbnd3_bnd2_all_bbox
  integer :: intbnd3_bnd2_bmin(3), intbnd3_bnd2_bmax(3)
  INTEGER*4, parameter :: intbnd33_isize = 6
  INTEGER*4 :: intbnd33_bndsize    (6)
  INTEGER*4 :: intbnd33_is_ghostbnd(6)
  INTEGER*4 :: intbnd33_is_symbnd  (6)
  INTEGER*4 :: intbnd33_is_physbnd (6)
  INTEGER*4 :: intbnd33_ierr
  integer :: intbnd33_dummy_imin, intbnd33_dummy_imax
  integer   :: i,j,k
  integer   :: n_i,n_j,n_k
  REAL*8 :: fsum
  
  call CCTK_Info("TestLoopControl","TestLoopControlFortran_intbnd")
  fsum = 0
  !$OMP PARALLEL &
  !$OMP default(none) shared(cctkgh, cctk_ash, cctk_lsh, cctk_tile_min, cctk_tile_max, r) &
  !$OMP reduction(+: fsum) &
  !$omp private (intbnd3_bnd_intboundaries_control) &
  !$omp shared (intbnd3_bnd_intboundaries_descr) &
  !$omp private (intbnd3_bnd_intboundaries_dir1, intbnd3_bnd_intboundaries_dir2, intbnd3_bnd_intboundaries_dir3) &
  !$omp private (intbnd3_bnd_intboundaries_ash1, intbnd3_bnd_intboundaries_ash2, intbnd3_bnd_intboundaries_ash3) &
  !$omp private (intbnd3_bnd_intboundaries_str1) &
  !$omp private (intbnd3_bnd_intboundaries_cmin1, intbnd3_bnd_intboundaries_cmax1) &
  !$omp private (intbnd3_bnd_intboundaries_cstep1, intbnd3_bnd_intboundaries_cpos1) &
  !$omp private (intbnd3_bnd_intboundaries_cmin2, intbnd3_bnd_intboundaries_cmax2) &
  !$omp private (intbnd3_bnd_intboundaries_cstep2, intbnd3_bnd_intboundaries_cpos2) &
  !$omp private (intbnd3_bnd_intboundaries_cmin3, intbnd3_bnd_intboundaries_cmax3) &
  !$omp private (intbnd3_bnd_intboundaries_cstep3, intbnd3_bnd_intboundaries_cpos3) &
  !$omp private (intbnd3_bnd_intboundaries_fmin1, intbnd3_bnd_intboundaries_fmax1) &
  !$omp private (intbnd3_bnd_intboundaries_fstep1, i, n_i) &
  !$omp private (intbnd3_bnd_intboundaries_fmin2, intbnd3_bnd_intboundaries_fmax2) &
  !$omp private (intbnd3_bnd_intboundaries_fstep2, j, n_j) &
  !$omp private (intbnd3_bnd_intboundaries_fmin3, intbnd3_bnd_intboundaries_fmax3) &
  !$omp private (intbnd3_bnd_intboundaries_fstep3, k, n_k) &
  !$omp private(intbnd3_bnd2_blo, intbnd3_bnd2_bhi) &
  !$omp private(intbnd3_bnd2_bboxlo, intbnd3_bnd2_bboxhi) &
  !$omp private(intbnd3_bnd2_istr) &
  !$omp private(intbnd3_bnd2_idir,intbnd3_bnd2_jdir,intbnd3_bnd2_kdir) &
  !$omp private(intbnd3_bnd2_any_bbox, intbnd3_bnd2_all_bbox) &
  !$omp private(intbnd3_bnd2_bmin, intbnd3_bnd2_bmax) &
  !$omp private(intbnd33_bndsize) &
  !$omp private(intbnd33_is_ghostbnd) &
  !$omp private(intbnd33_is_symbnd) &
  !$omp private(intbnd33_is_physbnd) &
  !$omp private(intbnd33_ierr) &
  !$omp private(intbnd33_dummy_imin, intbnd33_dummy_imax)

  !$omp single
  intbnd33_ierr = GetBoundarySizesAndTypes          (cctkGH, intbnd33_isize, intbnd33_bndsize, intbnd33_is_ghostbnd, intbnd33_is_sy&
  &mbnd, intbnd33_is_physbnd)
  !$omp end single copyprivate(intbnd33_bndsize, intbnd33_is_physbnd)
  
  intbnd3_bnd2_blo = (/                                    int(intbnd33_bndsize(1)),int(intbnd33_bndsize(3)),int(intbnd33_bndsize(5&
  &)) /)
  intbnd3_bnd2_bhi = (/                                     int(intbnd33_bndsize(2)),int(intbnd33_bndsize(4)),int(intbnd33_bndsize(&
  &6)) /)
  intbnd3_bnd2_bboxlo = (/                                     int(intbnd33_is_physbnd(1)),int(intbnd33_is_physbnd(3)),int(intbnd33&
  &_is_physbnd(5)) /)
  intbnd3_bnd2_bboxhi = (/                                     int(intbnd33_is_physbnd(2)),int(intbnd33_is_physbnd(4)),int(intbnd33&
  &_is_physbnd(6)) /)
  intbnd3_bnd2_istr = ( ( 1))
  do intbnd3_bnd2_kdir=-1, +1
  do intbnd3_bnd2_jdir=-1, +1
  do intbnd3_bnd2_idir=-1, +1
  intbnd3_bnd2_any_bbox = .false.
  if (intbnd3_bnd2_idir<0) intbnd3_bnd2_any_bbox = intbnd3_bnd2_any_bbox .or. intbnd3_bnd2_bboxlo(1) /= 0
  if (intbnd3_bnd2_jdir<0) intbnd3_bnd2_any_bbox = intbnd3_bnd2_any_bbox .or. intbnd3_bnd2_bboxlo(2) /= 0
  if (intbnd3_bnd2_kdir<0) intbnd3_bnd2_any_bbox = intbnd3_bnd2_any_bbox .or. intbnd3_bnd2_bboxlo(3) /= 0
  if (intbnd3_bnd2_idir>0) intbnd3_bnd2_any_bbox = intbnd3_bnd2_any_bbox .or. intbnd3_bnd2_bboxhi(1) /= 0
  if (intbnd3_bnd2_jdir>0) intbnd3_bnd2_any_bbox = intbnd3_bnd2_any_bbox .or. intbnd3_bnd2_bboxhi(2) /= 0
  if (intbnd3_bnd2_kdir>0) intbnd3_bnd2_any_bbox = intbnd3_bnd2_any_bbox .or. intbnd3_bnd2_bboxhi(3) /= 0
  intbnd3_bnd2_all_bbox = .true.
  if (intbnd3_bnd2_idir<0) intbnd3_bnd2_all_bbox = intbnd3_bnd2_all_bbox .and. intbnd3_bnd2_bboxlo(1) /= 0
  if (intbnd3_bnd2_jdir<0) intbnd3_bnd2_all_bbox = intbnd3_bnd2_all_bbox .and. intbnd3_bnd2_bboxlo(2) /= 0
  if (intbnd3_bnd2_kdir<0) intbnd3_bnd2_all_bbox = intbnd3_bnd2_all_bbox .and. intbnd3_bnd2_bboxlo(3) /= 0
  if (intbnd3_bnd2_idir>0) intbnd3_bnd2_all_bbox = intbnd3_bnd2_all_bbox .and. intbnd3_bnd2_bboxhi(1) /= 0
  if (intbnd3_bnd2_jdir>0) intbnd3_bnd2_all_bbox = intbnd3_bnd2_all_bbox .and. intbnd3_bnd2_bboxhi(2) /= 0
  if (intbnd3_bnd2_kdir>0) intbnd3_bnd2_all_bbox = intbnd3_bnd2_all_bbox .and. intbnd3_bnd2_bboxhi(3) /= 0
  if (intbnd3_bnd2_all_bbox .and. intbnd3_bnd2_any_bbox) then
  intbnd3_bnd2_bmin(1) = intbnd3_bnd2_blo(1) + 1
  intbnd3_bnd2_bmin(2) = intbnd3_bnd2_blo(2) + 1
  intbnd3_bnd2_bmin(3) = intbnd3_bnd2_blo(3) + 1
  if (intbnd3_bnd2_idir<0) intbnd3_bnd2_bmin(1) = 1
  if (intbnd3_bnd2_jdir<0) intbnd3_bnd2_bmin(2) = 1
  if (intbnd3_bnd2_kdir<0) intbnd3_bnd2_bmin(3) = 1
  if (intbnd3_bnd2_idir>0) intbnd3_bnd2_bmin(1) = cctk_lsh(1) - intbnd3_bnd2_bhi(1) + 1
  if (intbnd3_bnd2_jdir>0) intbnd3_bnd2_bmin(2) = cctk_lsh(2) - intbnd3_bnd2_bhi(2) + 1
  if (intbnd3_bnd2_kdir>0) intbnd3_bnd2_bmin(3) = cctk_lsh(3) - intbnd3_bnd2_bhi(3) + 1
  intbnd3_bnd2_bmax(1) = cctk_lsh(1) - intbnd3_bnd2_bhi(1)
  intbnd3_bnd2_bmax(2) = cctk_lsh(2) - intbnd3_bnd2_bhi(2)
  intbnd3_bnd2_bmax(3) = cctk_lsh(3) - intbnd3_bnd2_bhi(3)
  if (intbnd3_bnd2_idir<0) intbnd3_bnd2_bmax(1) = intbnd3_bnd2_blo(1)
  if (intbnd3_bnd2_jdir<0) intbnd3_bnd2_bmax(2) = intbnd3_bnd2_blo(2)
  if (intbnd3_bnd2_kdir<0) intbnd3_bnd2_bmax(3) = intbnd3_bnd2_blo(3)
  if (intbnd3_bnd2_idir>0) intbnd3_bnd2_bmax(1) = cctk_lsh(1)
  if (intbnd3_bnd2_jdir>0) intbnd3_bnd2_bmax(2) = cctk_lsh(2)
  if (intbnd3_bnd2_kdir>0) intbnd3_bnd2_bmax(3) = cctk_lsh(3)
  
  intbnd3_bnd_intboundaries_dir1 = (                                  intbnd3_bnd2_idir)
  intbnd3_bnd_intboundaries_dir2 = (intbnd3_bnd2_jdir)
  intbnd3_bnd_intboundaries_dir3 = (intbnd3_bnd2_kdir)
  intbnd3_bnd_intboundaries_ash1 = (                                   cctk_ash(1))
  intbnd3_bnd_intboundaries_ash2 = (cctk_ash(2))
  intbnd3_bnd_intboundaries_ash3 = (cctk_ash(3))
  intbnd3_bnd_intboundaries_str1 = ( intbnd3_bnd2_istr)
  call lc_descr_init(intbnd3_bnd_intboundaries_descr, 104, "<stdin>", "intbnd3_bnd_intboundaries")
  call lc_control_init(intbnd3_bnd_intboundaries_control, intbnd3_bnd_intboundaries_descr,                                       ((&
  &                                  max(cctk_tile_min(1)+1, intbnd3_bnd2_bmin(1)))-1), ((max(cctk_tile_min(2)+1, intbnd3_bnd2_bmin&
  &(2)))-1), ((max(cctk_tile_min(3)+1, intbnd3_bnd2_bmin(3)))-1),                                  (                               &
  &    min(cctk_Tile_max(1), intbnd3_bnd2_bmax(1))), (min(cctk_Tile_max(2), intbnd3_bnd2_bmax(2))), (min(cctk_Tile_max(3), intbnd3_&
  &bnd2_bmax(3))),                                              intbnd3_bnd_intboundaries_ash1, intbnd3_bnd_intboundaries_ash2, int&
  &bnd3_bnd_intboundaries_ash3,                            intbnd3_bnd_intboundaries_str1, 0, intbnd3_bnd_intboundaries_str1)
  call lc_thread_init(intbnd3_bnd_intboundaries_control)
  do while (lc_thread_done(intbnd3_bnd_intboundaries_control) == 0)
  intbnd3_bnd_intboundaries_control%coarse_loop%min%v(3) =                                    intbnd3_bnd_intboundaries_control%coa&
  &rse_thread%pos%v(3)
  intbnd3_bnd_intboundaries_control%coarse_loop%max%v(3) =                                    min(intbnd3_bnd_intboundaries_control&
  &%coarse_thread%max%v(3),                                intbnd3_bnd_intboundaries_control%coarse_loop%min%v(3) +                &
  &                    intbnd3_bnd_intboundaries_control%coarse_thread%step%v(3))
  intbnd3_bnd_intboundaries_cmin3 = intbnd3_bnd_intboundaries_control%coarse_loop%min%v(3)
  intbnd3_bnd_intboundaries_cmax3 = intbnd3_bnd_intboundaries_control%coarse_loop%max%v(3)
  intbnd3_bnd_intboundaries_cstep3 = intbnd3_bnd_intboundaries_control%coarse_loop%step%v(3)
  intbnd3_bnd_intboundaries_control%coarse_loop%min%v(2) =                                    intbnd3_bnd_intboundaries_control%coa&
  &rse_thread%pos%v(2)
  intbnd3_bnd_intboundaries_control%coarse_loop%max%v(2) =                                    min(intbnd3_bnd_intboundaries_control&
  &%coarse_thread%max%v(2),                                intbnd3_bnd_intboundaries_control%coarse_loop%min%v(2) +                &
  &                    intbnd3_bnd_intboundaries_control%coarse_thread%step%v(2))
  intbnd3_bnd_intboundaries_cmin2 = intbnd3_bnd_intboundaries_control%coarse_loop%min%v(2)
  intbnd3_bnd_intboundaries_cmax2 = intbnd3_bnd_intboundaries_control%coarse_loop%max%v(2)
  intbnd3_bnd_intboundaries_cstep2 = intbnd3_bnd_intboundaries_control%coarse_loop%step%v(2)
  intbnd3_bnd_intboundaries_control%coarse_loop%min%v(1) =                                    intbnd3_bnd_intboundaries_control%coa&
  &rse_thread%pos%v(1)
  intbnd3_bnd_intboundaries_control%coarse_loop%max%v(1) =                                    min(intbnd3_bnd_intboundaries_control&
  &%coarse_thread%max%v(1),                                intbnd3_bnd_intboundaries_control%coarse_loop%min%v(1) +                &
  &                    intbnd3_bnd_intboundaries_control%coarse_thread%step%v(1))
  intbnd3_bnd_intboundaries_cmin1 = intbnd3_bnd_intboundaries_control%coarse_loop%min%v(1)
  intbnd3_bnd_intboundaries_cmax1 = intbnd3_bnd_intboundaries_control%coarse_loop%max%v(1)
  intbnd3_bnd_intboundaries_cstep1 = intbnd3_bnd_intboundaries_control%coarse_loop%step%v(1)
  do intbnd3_bnd_intboundaries_cpos3 = intbnd3_bnd_intboundaries_cmin3, intbnd3_bnd_intboundaries_cmax3,                           &
  &      intbnd3_bnd_intboundaries_cstep3
  do intbnd3_bnd_intboundaries_cpos2 = intbnd3_bnd_intboundaries_cmin2, intbnd3_bnd_intboundaries_cmax2,                           &
  &      intbnd3_bnd_intboundaries_cstep2
  do intbnd3_bnd_intboundaries_cpos1 = intbnd3_bnd_intboundaries_cmin1, intbnd3_bnd_intboundaries_cmax1,                           &
  &      intbnd3_bnd_intboundaries_cstep1
  intbnd3_bnd_intboundaries_control%fine_loop%min%v(3) = intbnd3_bnd_intboundaries_cpos3
  intbnd3_bnd_intboundaries_control%fine_loop%max%v(3) =                                      min(intbnd3_bnd_intboundaries_control&
  &%coarse_loop%max%v(3),                                  intbnd3_bnd_intboundaries_control%fine_loop%min%v(3) +                  &
  &                    intbnd3_bnd_intboundaries_control%coarse_loop%step%v(3))
  intbnd3_bnd_intboundaries_fmin3 = intbnd3_bnd_intboundaries_control%fine_loop%min%v(3)
  intbnd3_bnd_intboundaries_fmax3 = intbnd3_bnd_intboundaries_control%fine_loop%max%v(3)
  intbnd3_bnd_intboundaries_fstep3 = intbnd3_bnd_intboundaries_control%fine_loop%step%v(3)
  intbnd3_bnd_intboundaries_control%fine_loop%min%v(2) = intbnd3_bnd_intboundaries_cpos2
  intbnd3_bnd_intboundaries_control%fine_loop%max%v(2) =                                      min(intbnd3_bnd_intboundaries_control&
  &%coarse_loop%max%v(2),                                  intbnd3_bnd_intboundaries_control%fine_loop%min%v(2) +                  &
  &                    intbnd3_bnd_intboundaries_control%coarse_loop%step%v(2))
  intbnd3_bnd_intboundaries_fmin2 = intbnd3_bnd_intboundaries_control%fine_loop%min%v(2)
  intbnd3_bnd_intboundaries_fmax2 = intbnd3_bnd_intboundaries_control%fine_loop%max%v(2)
  intbnd3_bnd_intboundaries_fstep2 = intbnd3_bnd_intboundaries_control%fine_loop%step%v(2)
  intbnd3_bnd_intboundaries_control%fine_loop%min%v(1) = intbnd3_bnd_intboundaries_cpos1
  intbnd3_bnd_intboundaries_control%fine_loop%max%v(1) =                                      min(intbnd3_bnd_intboundaries_control&
  &%coarse_loop%max%v(1),                                  intbnd3_bnd_intboundaries_control%fine_loop%min%v(1) +                  &
  &                    intbnd3_bnd_intboundaries_control%coarse_loop%step%v(1))
  intbnd3_bnd_intboundaries_fmin1 = intbnd3_bnd_intboundaries_control%fine_loop%min%v(1)
  intbnd3_bnd_intboundaries_fmax1 = intbnd3_bnd_intboundaries_control%fine_loop%max%v(1)
  intbnd3_bnd_intboundaries_fstep1 = intbnd3_bnd_intboundaries_control%fine_loop%step%v(1)
  do  k = intbnd3_bnd_intboundaries_fmin3+1, intbnd3_bnd_intboundaries_fmax3,                               intbnd3_bnd_intboundari&
  &es_fstep3
  n_k = 0
  if (intbnd3_bnd_intboundaries_dir3<0)  n_k =  k
  if (intbnd3_bnd_intboundaries_dir3>0)  n_k = intbnd3_bnd_intboundaries_control%overall%max%v(3)+1- k
  do  j = intbnd3_bnd_intboundaries_fmin2+1, intbnd3_bnd_intboundaries_fmax2,                               intbnd3_bnd_intboundari&
  &es_fstep2
  n_j = 0
  if (intbnd3_bnd_intboundaries_dir2<0)  n_j =  j
  if (intbnd3_bnd_intboundaries_dir2>0)  n_j = intbnd3_bnd_intboundaries_control%overall%max%v(2)+1- j
  do                                                                                                 i = intbnd3_bnd_intboundaries_&
  &fmin1+1, intbnd3_bnd_intboundaries_fmax1,                               intbnd3_bnd_intboundaries_fstep1
  n_i = 0
  if (intbnd3_bnd_intboundaries_dir1<0)                                                                                            &
  &     n_i =                                                                                                 i
  if (intbnd3_bnd_intboundaries_dir1>0)                                                                                            &
  &     n_i = intbnd3_bnd_intboundaries_control%overall%max%v(1)+1-                                                                &
  &                                i
     fsum = fsum + r(i,j,k)

  end do
  end do
  end do
  end do
  end do
  end do
  call lc_thread_step(intbnd3_bnd_intboundaries_control)
  end do
  call lc_control_finish(intbnd3_bnd_intboundaries_control, intbnd3_bnd_intboundaries_descr)
  end if
  end do
  end do
  end do
  !$OMP END PARALLEL
  fsum_intbnd = fsum
end subroutine TestLoopControlFortran_intbnd



subroutine TestLoopControlFortran(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_alignmen&
  &t,cctk_alignment_offset,cctk_from,cctk_to,cctk_bbox,cctk_delta_time,cctk_time,cctk_delta_space,cctk_origin_space,cctk_levfac,cct&
  &k_levoff,cctk_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_ash2,cc&
  &tk_ash3, csum_all,csum_bnd,csum_int,csum_intbnd,fsum_all,fsum_bnd,fsum_int,fsum_intbnd,pointtypes, coarse_dx,coarse_dy,coarse_dz&
  &,r,x,y,z)
  use loopcontrol
  implicit none

  INTEGER cctk_dim
  integer, parameter :: cctki_use_cctk_dim = kind(cctk_dim)
  INTEGER cctk_gsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_gsh = kind(cctk_gsh)
  INTEGER cctk_lsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_lsh = kind(cctk_lsh)
  INTEGER cctk_lbnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_lbnd = kind(cctk_lbnd)
  INTEGER cctk_ubnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_ubnd = kind(cctk_ubnd)
  INTEGER cctk_tile_min (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_min = kind(cctk_tile_min)
  INTEGER cctk_tile_max (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_max = kind(cctk_tile_max)
  INTEGER cctk_ash (cctk_dim)
  integer, parameter :: cctki_use_cctk_ash = kind(cctk_ash)
  INTEGER cctk_alignment
  integer, parameter :: cctki_use_cctk_alignment = kind(cctk_alignment)
  INTEGER cctk_alignment_offset
  integer, parameter :: cctki_use_cctk_alignment_offset = kind(cctk_alignment_offset)
  INTEGER cctk_from (cctk_dim)
  integer, parameter :: cctki_use_cctk_from = kind(cctk_from)
  INTEGER cctk_to (cctk_dim)
  integer, parameter :: cctki_use_cctk_to = kind(cctk_to)
  INTEGER cctk_bbox (2*cctk_dim)
  integer, parameter :: cctki_use_cctk_bbox = kind(cctk_bbox)
  REAL*8 cctk_delta_time
  integer, parameter :: cctki_use_cctk_delta_time = kind(cctk_delta_time)
  REAL*8 cctk_time
  integer, parameter :: cctki_use_cctk_time = kind(cctk_time)
  REAL*8 cctk_delta_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_delta_space = kind(cctk_delta_space)
  REAL*8 cctk_origin_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_origin_space = kind(cctk_origin_space)
  INTEGER cctk_levfac (cctk_dim)
  integer, parameter :: cctki_use_cctk_levfac = kind(cctk_levfac)
  INTEGER cctk_levoff (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoff = kind(cctk_levoff)
  INTEGER cctk_levoffdenom (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoffdenom = kind(cctk_levoffdenom)
  INTEGER cctk_timefac
  integer, parameter :: cctki_use_cctk_timefac = kind(cctk_timefac)
  INTEGER cctk_convlevel
  integer, parameter :: cctki_use_cctk_convlevel = kind(cctk_convlevel)
  INTEGER cctk_convfac
  integer, parameter :: cctki_use_cctk_convfac = kind(cctk_convfac)
  INTEGER cctk_nghostzones (cctk_dim)
  integer, parameter :: cctki_use_cctk_nghostzones = kind(cctk_nghostzones)
  INTEGER cctk_iteration
  integer, parameter :: cctki_use_cctk_iteration = kind(cctk_iteration)
  integer*8 cctkGH
  integer, parameter :: cctki_use_cctkGH = kind(cctkGH)
  INTEGER cctk_ash1
  integer, parameter :: cctki_use_cctk_ash1 = kind(cctk_ash1)
  INTEGER cctk_ash2
  integer, parameter :: cctki_use_cctk_ash2 = kind(cctk_ash2)
  INTEGER cctk_ash3
  integer, parameter :: cctki_use_cctk_ash3 = kind(cctk_ash3)
  REAL*8 csum_all
  integer, parameter :: cctki_use_csum_all = kind(csum_all)
  REAL*8 csum_bnd
  integer, parameter :: cctki_use_csum_bnd = kind(csum_bnd)
  REAL*8 csum_int
  integer, parameter :: cctki_use_csum_int = kind(csum_int)
  REAL*8 csum_intbnd
  integer, parameter :: cctki_use_csum_intbnd = kind(csum_intbnd)
  REAL*8 fsum_all
  integer, parameter :: cctki_use_fsum_all = kind(fsum_all)
  REAL*8 fsum_bnd
  integer, parameter :: cctki_use_fsum_bnd = kind(fsum_bnd)
  REAL*8 fsum_int
  integer, parameter :: cctki_use_fsum_int = kind(fsum_int)
  REAL*8 fsum_intbnd
  integer, parameter :: cctki_use_fsum_intbnd = kind(fsum_intbnd)
  INTEGER*4 pointtypes (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_pointtypes = kind(pointtypes)
  REAL*8 coarse_dx
  integer, parameter :: cctki_use_coarse_dx = kind(coarse_dx)
  REAL*8 coarse_dy
  integer, parameter :: cctki_use_coarse_dy = kind(coarse_dy)
  REAL*8 coarse_dz
  integer, parameter :: cctki_use_coarse_dz = kind(coarse_dz)
  REAL*8 r (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_r = kind(r)
  REAL*8 x (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_x = kind(x)
  REAL*8 y (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_y = kind(y)
  REAL*8 z (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_z = kind(z)
  interface
  integer*8 function CCTK_PointerTo (var)
  implicit none
  type(*),dimension(..),TARGET :: var
  end function CCTK_PointerTo
  end interface
  interface
  integer function CCTK_Equals (arg1, arg2)
  implicit none
  integer*8 arg1
  character(*) arg2
  end function CCTK_Equals
  integer function CCTK_MyProc (cctkGH)
  implicit none
  integer*8 cctkGH
  end function CCTK_MyProc
  integer function CCTK_nProcs (cctkGH)
  implicit none
  integer*8 cctkGH
  end function CCTK_nProcs
  integer function CCTK_IsThornActive (name)
  implicit none
  character(*) name
  end function CCTK_IsThornActive
  integer*8 function CCTK_NullPointer ()
  implicit none
  end function CCTK_NullPointer
  end interface
  interface
  INTEGER*4 function GetBoundarySizesAndTypes (cctkGH, size, bndsize, is_ghostbnd, is_symbnd, is_physbnd)
  implicit none
  integer*8 cctkGH
  INTEGER*4 size
  INTEGER*4 bndsize(*)
  INTEGER*4 is_ghostbnd(*)
  INTEGER*4 is_symbnd(*)
  INTEGER*4 is_physbnd(*)
  end function GetBoundarySizesAndTypes
  end interface
  
  
  call TestLoopControlFortran_all(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_alignmen&
  &t,cctk_alignment_offset,cctk_from,cctk_to,cctk_bbox,cctk_delta_time,cctk_time,cctk_delta_space,cctk_origin_space,cctk_levfac,cct&
  &k_levoff,cctk_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_ash2,cc&
  &tk_ash3, csum_all,csum_bnd,csum_int,csum_intbnd,fsum_all,fsum_bnd,fsum_int,fsum_intbnd,pointtypes, coarse_dx,coarse_dy,coarse_dz&
  &,r,x,y,z)
  call TestLoopControlFortran_int(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_alignmen&
  &t,cctk_alignment_offset,cctk_from,cctk_to,cctk_bbox,cctk_delta_time,cctk_time,cctk_delta_space,cctk_origin_space,cctk_levfac,cct&
  &k_levoff,cctk_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_ash2,cc&
  &tk_ash3, csum_all,csum_bnd,csum_int,csum_intbnd,fsum_all,fsum_bnd,fsum_int,fsum_intbnd,pointtypes, coarse_dx,coarse_dy,coarse_dz&
  &,r,x,y,z)
  call TestLoopControlFortran_bnd(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_alignmen&
  &t,cctk_alignment_offset,cctk_from,cctk_to,cctk_bbox,cctk_delta_time,cctk_time,cctk_delta_space,cctk_origin_space,cctk_levfac,cct&
  &k_levoff,cctk_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_ash2,cc&
  &tk_ash3, csum_all,csum_bnd,csum_int,csum_intbnd,fsum_all,fsum_bnd,fsum_int,fsum_intbnd,pointtypes, coarse_dx,coarse_dy,coarse_dz&
  &,r,x,y,z)
  call TestLoopControlFortran_intbnd(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_align&
  &ment,cctk_alignment_offset,cctk_from,cctk_to,cctk_bbox,cctk_delta_time,cctk_time,cctk_delta_space,cctk_origin_space,cctk_levfac,&
  &cctk_levoff,cctk_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_ash2&
  &,cctk_ash3, csum_all,csum_bnd,csum_int,csum_intbnd,fsum_all,fsum_bnd,fsum_int,fsum_intbnd,pointtypes, coarse_dx,coarse_dy,coarse&
  &_dz,r,x,y,z)
end subroutine TestLoopControlFortran
