include 'npbparams.h'
	

! If processor array is 1x1 -> 0D grid decomposition


! Cache blocking params. These values are good for most
! RISC processors.  
! FFT parameters:
!  fftblock controls how many ffts are done at a time. 
!  The default is appropriate for most cache-based machines
!  On vector machines, the FFT can be vectorized with vector
!  length equal to the block size, so the block size should
!  be as large as possible. This is the size of the smallest
!  dimension of the problem: 128 for class A, 256 for class B and
!  512 for class C.
     

! we need a bunch of logic to keep track of how
! arrays are laid out. 


! Note: this serial version is the derived from the parallel 0D case
! of the ft NPB.
! The computation proceeds logically as

! set up initial conditions
! fftx(1)
! transpose (1->2)
! ffty(2)
! transpose (2->3)
! fftz(3)
! time evolution
! fftz(3)
! transpose (3->2)
! ffty(2)
! transpose (2->1)
! fftx(1)
! compute residual(1)

! for the 0D, 1D, 2D strategies, the layouts look like xxx
!        
!            0D        1D        2D
! 1:        xyz       xyz       xyz



integer T_total, T_setup, T_fft, T_evolve, T_checksum, T_fftx, T_ffty, T_fftz, T_max
parameter (T_total = 1, T_setup = 2, T_fft = 3, T_evolve = 4, T_checksum = 5, T_max = 5)

logical timers_enabled
parameter (timers_enabled = .FALSE.)
logical more_memory
parameter (more_memory = .FALSE.)

external timer_read
double precision timer_read
external ilog2
integer ilog2

external randlc
double precision randlc



double precision seed, a, pi, alpha
parameter (seed = 314159265.d0, a = 1220703125.d0, pi = 3.141592653589793238d0, alpha=1.0d-6)

double complex   u0(nxp,ny,nz), u1(nxp,ny,nz)   
double precision twiddle(nxp,ny,nz)
double complex u(nxp)
double complex y1(maxdim),y2(maxdim)
common /arrays/ u,u0,u1,twiddle,y1,y2

!dvm$ distribute (*,*,*) :: twiddle
!dvm$ distribute (*,*,*) :: u0
!dvm$ distribute (*,*,*) :: u1
!dvm$ distribute (*) :: u

	  
