!---------------------------------------------------------------------
!---------------------------------------------------------------------
!
!  header.h
!
!---------------------------------------------------------------------
!---------------------------------------------------------------------
 
      implicit none

!---------------------------------------------------------------------
! The following include file is generated automatically by the
! "setparams" utility. It defines 
!      maxcells:      the square root of the maximum number of processors
!      problem_size:  12, 64, 102, 162 (for class T, A, B, C)
!      dt_default:    default time step for this problem size if no
!                     config file
!      niter_default: default number of iterations for this problem size
!---------------------------------------------------------------------

      include 'npbparams.h'

      integer           aa, bb, cc, BLOCK_SIZE
      parameter        (aa=1, bb=2, cc=3, BLOCK_SIZE=5)

      integer           grid_points(3)
      double precision  elapsed_time
      common /global/   elapsed_time, grid_points

      double precision  tx1, tx2, tx3, ty1, ty2, ty3, tz1, tz2, tz3
      double precision dx1, dx2, dx3, dx4, dx5, dy1, dy2, dy3, dy4
      double precision dy5, dz1, dz2, dz3, dz4, dz5, dssp, dt
      double precision ce(5,13), dxmax, dymax, dzmax, xxcon1, xxcon2 
      double precision xxcon3, xxcon4, xxcon5, dx1tx1, dx2tx1, dx3tx1
      double precision dx4tx1, dx5tx1, yycon1, yycon2, yycon3, yycon4
      double precision yycon5, dy1ty1, dy2ty1, dy3ty1, dy4ty1, dy5ty1
      double precision zzcon1, zzcon2, zzcon3, zzcon4, zzcon5, dz1tz1
      double precision dz2tz1, dz3tz1, dz4tz1, dz5tz1, dnxm1, dnym1 
      double precision dnzm1, c1c2, c1c5, c3c4, c1345, conz1, c1, c2
      double precision c3, c4, c5, c4dssp, c5dssp, dtdssp, dttx1
      double precision dttx2, dtty1, dtty2, dttz1, dttz2, c2dttx1
      double precision c2dtty1, c2dttz1, comz1, comz4, comz5, comz6
      double precision c3c4tx3, c3c4ty3, c3c4tz3, c2iv, con43, con16
      integer stage_n, BL, R

      common /constants/ tx1, tx2, tx3, ty1, ty2, ty3, tz1, tz2, tz3
      common /constants/ dx1, dx2, dx3, dx4, dx5, dy1, dy2, dy3, dy4 
      common /constants/ dy5, dz1, dz2, dz3, dz4, dz5, dssp, dt
      common /constants/ ce, dxmax, dymax, dzmax, xxcon1, xxcon2 
      common /constants/ xxcon3, xxcon4, xxcon5, dx1tx1, dx2tx1, dx3tx1
      common /constants/ dx4tx1, dx5tx1, yycon1, yycon2, yycon3, yycon4
      common /constants/ yycon5, dy1ty1, dy2ty1, dy3ty1, dy4ty1, dy5ty1
      common /constants/ zzcon1, zzcon2, zzcon3, zzcon4, zzcon5, dz1tz1 
      common /constants/ dz2tz1, dz3tz1, dz4tz1, dz5tz1, dnxm1, dnym1
      common /constants/ dnzm1, c1c2, c1c5, c3c4, c1345, conz1, c1, c2 
      common /constants/ c3, c4, c5, c4dssp, c5dssp, dtdssp, dttx1
      common /constants/ dttx2, dtty1, dtty2, dttz1, dttz2, c2dttx1 
      common /constants/ c2dtty1, c2dttz1, comz1, comz4, comz5, comz6 
      common /constants/ c3c4tx3, c3c4ty3, c3c4tz3, c2iv, con43, con16
      common /constants/ stage_n
	  
      integer IMAX, JMAX, KMAX

      parameter (IMAX=problem_size,JMAX=problem_size,KMAX=problem_size)
      parameter (BL=1, R=0)
!
!   to improve cache performance, grid dimensions padded by 1 
!   for even number sizes only.
!
      double precision us(0:IMAX/2*2, 0:JMAX/2*2,  0:KMAX/2*2)
      double precision vs(0:IMAX/2*2, 0:JMAX/2*2,  0:KMAX/2*2)
      double precision ws(0:IMAX/2*2, 0:JMAX/2*2,  0:KMAX/2*2)
      double precision qs(0:IMAX/2*2, 0:JMAX/2*2,  0:KMAX/2*2)
      double precision rho_i(0:IMAX/2*2, 0:JMAX/2*2,  0:KMAX/2*2)
      double precision square(0:IMAX/2*2, 0:JMAX/2*2,  0:KMAX/2*2)
      double precision forcing (5,0:IMAX/2*2,0:JMAX/2*2, 0:KMAX/2*2)
      double precision u(5,0:(IMAX+1)/2*2,0:(JMAX+1)/2*2,0:(KMAX+1)/2*2)
      double precision rhs(5,0:IMAX/2*2, 0:JMAX/2*2,   0:KMAX/2*2)
      double precision lhs__(5,5,0:IMAX/2*2,0:JMAX/2*2,0:KMAX/2*2/BL+R)
      common /fields/  u, us, vs, ws, qs, rho_i, square
      common /fields/ rhs, forcing, lhs__

      double precision cv(-2:problem_size+1)
      double precision cuf(-2:problem_size+1),  q(-2:problem_size+1)
      double precision ue(-2:problem_size+1,5), buf(-2:problem_size+1,5)
      common /work_1d/ cv, cuf, q, ue, buf

      double precision tmp1, tmp2, tmp3, tmp11, tmp22
      double precision t1, t2, t3, tm1, tm2, tm3

      common /work_lhs/ tmp1, tmp2, tmp3, tmp11, tmp22
      common /work_lhs/ t1, t2, t3, tm1, tm2, tm3
      double precision  tmp_block(5,5), b_inverse(5,5), tmp_vec(5)
      common /work_solve/ tmp_block, b_inverse, tmp_vec
!--------------------------------------------------------------------      
!               FDVM Specifications
!--------------------------------------------------------------------

!DVM$ DISTRIBUTE  us (BLOCK,BLOCK,BLOCK)
!DVM$ ALIGN (i,j,k)       WITH us(i,j,k)  :: vs, ws, qs, rho_i, square
!DVM$ ALIGN (*,*,i,j,k)   WITH us(i,j,k)  :: lhs__
!DVM$ ALIGN (*,i,j,k)     WITH us(i,j,k)  :: u, rhs
!DVM$ ALIGN (*,i,j,k)     WITH us(i,j,k)  :: forcing

!DVM$ SHADOW  u(2:2,2:2,2:2,2:2)

