program amr_main
!--------------------------------------------------------------------------
!AUTHOR: Tom Haupt, NPAC, Syracuse University, haupt@npac.syr.edu
!                      some of the routines has been developed by 
!                      N. Chrisochoides, M.Miller and T. Shah
!-------------------------------------------------------------------------- 

use amr
use types

type(LEVEL_INFO), dimension(maxlev)     :: lp 
type(GF3TL),pointer                     :: grid
character(200)                          :: grid_name = 'test grid'
real(SP), dimension(maxdim)             :: gmin,gmax,gd
integer(I4B)                            :: gid,curlev,finlev
real(SP)                                :: t
integer(I4B), parameter                 :: nsteps = 32
real(SP)                                :: t3(1), t1(1), t2(1) !timer

      INTERFACE 
      subroutine initialize_grid_functions(lp,level,t)
      use amr
      use types
      type(LEVEL_INFO), dimension(maxlev) :: lp 
      integer(I4B)                        :: level
      real(SP)                            :: t 
      end subroutine initialize_grid_functions

      subroutine initialize_base_grid(lp,grid_name)
      use amr
      use types
      type(LEVEL_INFO), dimension(maxlev) :: lp 
      character(200)                      :: grid_name 
      end subroutine initialize_base_grid

      subroutine regrid(lp,curlev,finlev,first)
      use amr
      use types   
      type(LEVEL_INFO), dimension(maxlev) :: lp
      integer(I4B) curlev,finlev
      logical first
      end subroutine regrid       

      subroutine propagate(lp,crsstp,finlev)
      use amr
      use types
      type(LEVEL_INFO),dimension(maxlev) :: lp     
      integer(I4B) crsstp,finlev    
      end subroutine propagate

      END INTERFACE 

!     start_timer
      t1(1) =secnds( 0.0)


!     initialize data structures
      gid=get_g(-1)
      t=t_init
      curlev=1
      finlev=1  
      call initialize_level_info(lp)

      call initialize_base_grid(lp,grid_name)      !allocate data structures
      call initialize_grid_functions(lp,curlev,t)  !fill them with the data

! do we need initial regridding?   call regrid(lp,curlev,finlev,.true.)

      write(6,*) ' =========== END OF INITIALIZATION ============'

      call propagate(lp,nsteps,finlev)

      write(6,*) 'END OF PROGRAM'

!     stop_timer
      t2(1) = secnds(0.0)
      t3(1) = t2(1)-t1(1)
      print *,'time',t3(1),'seconds'
      stop
      end program

 
























