C	"top program" for rpressfw(main);  full-wawe ("fw") option
C	dynamic memory handling

C	Sven Ivansson  1992




	PROGRAM RPRESSFW

	IMPLICIT NONE

	INCLUDE 'RPPARAMETER.INC'
C       nol <= noldim

	INCLUDE 'INPARAM.INC'     ! to set kfwtyp, kfwbess
	INCLUDE 'fw/FWPARAM.INC'  ! to set iystab

	INTEGER   LX,LITOP,ICWORKDIM

        REAL*8, DIMENSION(:), ALLOCATABLE :: EX, PM0GOR, EPS0
        COMPLEX*16, DIMENSION(:), ALLOCATABLE :: CR9T1E, CPRESSW
        COMPLEX, DIMENSION(:), ALLOCATABLE :: CPLOK
        COMPLEX, DIMENSION(:,:), ALLOCATABLE :: CP

C	-------------------------------------------------------------

	WRITE(*,*)
	WRITE(*,*) 'Give KFWTYP (for ys comp; 1,2,3,4) :'
	WRITE(*,*) '(u,w,tau_rz,tau_zz)'
	WRITE(*,*) '(sign-changed)'
	READ(*,*) KFWTYP
	IF ( KFWTYP.EQ.2 .OR. KFWTYP.EQ.4 ) THEN
	  KFWBESS = 0   ! J0, H0(1)
	ELSE IF ( KFWTYP.EQ.1 .OR. KFWTYP.EQ.3 ) THEN
	  KFWBESS = 1   ! J1, H1(1)
	ELSE
	  STOP 12345
	END IF
	WRITE(*,*) 'Give IYSTAB (for ys stabilization; -1="ordinary", ',
     $	'1="x") :'
	READ(*,*) IYSTAB
	WRITE(*,*)

	WRITE(*,*) 'Give LX, LI(top), ICWORKDIM :'
	WRITE(*,*) '( continuous wave:  lx <= 1 )'
	WRITE(*,*) '( transient:        lx "positive-integer power of 2" )'
	READ(*,*) LX, LITOP, ICWORKDIM
	IF (LX.EQ.0) LX = 1

        ALLOCATE ( EX(lx), PM0GOR(litop), EPS0(litop) )
        ALLOCATE ( CR9T1E(litop), CPRESSW(icworkdim) )
        ALLOCATE ( CPLOK(lx), CP(lx,litop) )

C	-------------------------------------------------------------

	CALL RPRESSMAIN ( 5,6, -20, LX,LITOP,ICWORKDIM, 
     $	EX, PM0GOR, EPS0, CR9T1E, CPRESSW, CPLOK, CP )   !!! "-" flag

C	-------------------------------------------------------------

C	the "de-allocation" below is actually done automatically upon exit
        DEALLOCATE ( EX, PM0GOR, EPS0 )
        DEALLOCATE ( CR9T1E, CPRESSW )
        DEALLOCATE ( CPLOK, CP )

	STOP

C	-------------------------------------------------------------

	END



