C	"top program" for rpress(main)
C	dynamic memory handling

C	Sven Ivansson  1991




	PROGRAM RPRESS

	IMPLICIT NONE

	INCLUDE 'INPARAM.INC'     ! to set kfwtyp, kfwbess
        INCLUDE 'fw/FWPARAM.INC'  ! to set iystab (for output only)

	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	-------------------------------------------------------------

	KFWTYP = 4   ! fourth component of the displacement-stress vector
	KFWBESS = 0  ! J0, H0(1)
	IYSTAB = 0   ! not relevant for the computations

	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 )

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
