      program main
      use types
      real(SP), dimension(13,13)::child
      real(SP), dimension(13)    :: xx,yy,zz
      integer(I4B)              :: order, dim, refinerat

      INTERFACE
      subroutine interpolate(childgrid,order,dim,refinerat,xx,yy,zz)
      use types
      implicit none
      real(SP), dimension(:,:) :: childgrid
      integer(I4B)               :: order, dim, refinerat
      real(SP), dimension(:)     :: xx,yy,zz 
      end subroutine interpolate
      END INTERFACE

      
      forall(i=1:13) xx(i)=i
      forall(i=1:13) yy(i)=i

      order = 2
      dim = 2
      refinerat = 3

      do i=1,13
        do j=1,13,3
      child(i,j) = xx(i)*xx(i)*yy(j)
        enddo
      enddo

      do i=1,13
       do j=1,13    
      write(6,*) xx(i),yy(j),child(i,j)
       enddo
      enddo
      
c      write(6,*) 'calling interpolate'

      call interpolate(child,order,dim,refinerat,xx,yy,zz)
  
      do i=1,13
       do j=1,13    
      write(6,*) xx(i),yy(j),child(i,j)
       enddo
      enddo

      end program
      

