subroutine init_fine_data(child,parent,old_head,drc,drp,dt,is)
!--------------------------------------------------------------------------
! Initialize data on a fine grid. Steps:
! 1. interpolate data from coarser level (parent) to finer one (child)
! 2. transfer fine data from previous structure, if exist
! 3. impose boundary conditions (internal and external)
!
! User and/or application dependent code is burried inside routines
! interpolate_data and impose_fine_boundaries
!
! AUTHOR: Tom Haupt, NPAC at Syracuse University, haupt@npac.syr.edu
!--------------------------------------------------------------------------
use types
use amr
type(ADAPTIVE_MESH),pointer    :: child,parent,old_head
real(SP), dimension(3)         :: drc,drp
real(SP)                       :: dt 
integer(I4B) is

real(SP) dt0,time,dt1

INTERFACE
       subroutine interpolate_data(childptr,drc)
       use types
       use amr
       type(ADAPTIVE_MESH),pointer       :: childptr
       real(SP), dimension(3)            :: drc   !dr of child     
       end subroutine interpolate_data
END INTERFACE


!--------------------------------------------------------------------------
! initalize integration time; also on all retarded meshes
!--------------------------------------------------------------------------

dt1=dt   
do i=1,parent%grid%n_gfcn
   dt0=0
   do j=1,parent%grid%gfcn(i)%n_t 
        child%grid%gfcn(i)%t(1)=parent%grid%gfcn(i)%t(1)-dt1
        dt1=dt0-dt1
   enddo 
enddo

time=child%grid%gfcn(1)%t(1)

!call interpolate_data(child,drc)
call interpolate_data(old_head,drc)

!if there is any overlap between old mesh at this level, it is better
!to transfer the data between meshes at the same laver than to
!interpolate them from coarser grid
! NOTE:  to ba done later         call rgtran(child,old_head,drc)
         write(6,*) 'WARNING: rgtran commented out'

!imposing boundary conditions is still missing!!!
! call impose_fine_boundaries(local,global)

return
end subroutine init_fine_data

