subroutine initialize_grid_functions(level,t)
!-------------------------------------------------------------------------
! this is a wrapper routine for user supplied subroutine u_init_gf
! that initialize grid functions at initial time
!
! the current version supports initialization on level 1 only
! and consequently initializes functions defined on the base grid
! pointed by lp(1)%ml
!
!-------------------------------------------------------------------------
use types
use amr
integer(I4B)                             :: level
real(SP)                                 :: t 

type(ADAPTIVE_MESH),pointer              :: grid
real(SP)                                 :: dt
real(SP), dimension(3)                   :: dr

      INTERFACE
      subroutine u_init_gf(grid,t,dt,dr)
      use types
      use amr
      type(GF3TL),pointer :: grid
      real(SP)                :: t,dt
      real(SP), dimension(3)  :: dr
      end subroutine u_init_gf
      END INTERFACE


if(level<>1) then
   write(6,*) 'INITIALIZE GRID FUNCTION: this routine should not be', &
   'called within this context: level=',level
   stop
endif

nullify(grid)
grid=>lp(level)%ml
    
dr=lp(level)%ldr
dt=lp(level)%ldt

call u_init_gf(grid%grid,t,dt,dr)

return 
end subroutine initialize_grid_functions






