  subroutine initialize_child(parent,child,grid)
  use parameters
  use adaptive
  real,dimension(:,:,:) :: parent,child
  type(ADAPTIVE_MESH),pointer :: grid

!HPF$ PROCESSORS P(2,2)
!HPF$ DISTRIBUTE *(*,BLOCK,BLOCK) ONTO *P :: parent,child


  integer offsetx,offsety,nx,ny
  type(ADAPTIVE_MESH),pointer :: parent_grid

  parent_grid=>grid%parent

  offsetx=(grid%rmin(1)-parent_grid%rmin(1))+1
  offsety=(grid%rmin(2)-parent_grid%rmin(2))+1
  nx=grid%nr(1)/rho
  ny=grid%nr(2)/rho

  child=0
  child(1:2,1:grid%nr(1):rho,1:grid%nr(2):rho)=  &
  parent(1:2,offsetx:nx,offsety:ny) 

  if(rho == 2) then
    if(mod(grid%nr(1),2) <> 1 .or. mod(grid%nr(2),2) <> 1) then
     write(6,*) 'it does not work for even size'
     stop
    endif
    forall(i=2:grid%nr(1)-1:2,j=1:grid%nr(2):2)  &
     child(1:2,i,j)=0.5*(child(1:2,i-1,j)+child(1:2,i+1,j))
    
    forall(i=1:grid%nr(1),j=2:grid%nr(2):2) &
     child(1:2,i,j)=0.5*(child(1:2,i,j-1)+child(1:2,i,j+1))

  else
   write(6,*) 'must supply interpolation routine'
   stop 
  endif

return
end




