	PROGRAM INITIAL 
	IMPLICIT NONE  
	include 'fcube.h'  
	INTEGER*4 MSS,NSS,L,ALLNODES,INITTYPE,APPLPID,INITMSGSIZE,
     1  HOSTPID,PARTTYPE,SIZE,SIZE1,MS,TIME,SEC,MIN,TSEC,ENDMSGSIZE   
	PARAMETER (L=901)  
	REAL*8 MSG1(20)  
	INTEGER*4 II,PARTTYPE,ENDMSGSIZE  
	REAL*8 HAT(L)    
	COMPLEX*16 YLS(2,2)   
	REAL*8 UM1S,UM2S,EM1S,EM2S,AL1S,AL2S,HAS,HBS,HDS,
     1  WLS,FAIS,R0,ANG0,AG  
	CHARACTER*50 CPYRIGHT  
	EQUIVALENCE (MSG1(1),MSS) 
	EQUIVALENCE (MSG1(2),NSS) 
	EQUIVALENCE (MSG1(3),HAS) 
	EQUIVALENCE (MSG1(4),HBS) 
	EQUIVALENCE (MSG1(5),HDS) 
	EQUIVALENCE (MSG1(6),AL1S) 
	EQUIVALENCE (MSG1(7),AL2S) 
	EQUIVALENCE (MSG1(8),WLS) 
	EQUIVALENCE (MSG1(9),R0) 
	EQUIVALENCE (MSG1(10),ANG0) 
	EQUIVALENCE (MSG1(11),FAIS) 
	EQUIVALENCE (MSG1(12),UM1S) 
	EQUIVALENCE (MSG1(13),UM2S) 
	EQUIVALENCE (MSG1(14),EM1S) 
	EQUIVALENCE (MSG1(15),EM2S) 
	EQUIVALENCE (MSG1(16),SIZE) 
	EQUIVALENCE (MSG1(17),YLS(1,1)) 
	DATA PARTTYPE /20/   
	DATA APPLPID /0/, INITTYPE /5/, INITMSGSIZE /180/,
     1  ALLNODES /-1/, HOSTPID /100/, PARTTYPE /20/ 
	CPYRIGHT='Copyright(c) 1992, Intel Corporation' 
        PRINT*,'We use implse based mode function expansion in the 
     1  moment method. Please input the expansion parameters.'   
        PRINT*,'I and J are the number of pulse base mode functions,'  
        PRINT*,'I=5','J=5'  
        PRINT*,'M and N are the number of pulse base functions, please
     1  input M and N.'  
        READ(5,*) MSS,NSS  
        PRINT*,'M=',MSS,'N=',NSS  
        PRINT*,'For getting scattering field strength pattern, we 
     1  divide the space by eaqual angals. The total measurement 
     2  point number is L. Here, we set L=901.'   
        PRINT*,'L=',L  
        PRINT*,'The following are the parameters of the two apertures  
     1  and the material medium. Please input the values one by one'  
        PRINT*,'aperture widths, input a, then input b(in meter) '  
        READ(5,*) HAS, HBS  
        PRINT*,'a=',HAS, 'b=',HBS  
        PRINT*,'input aperture separation d(in meter)'  
        READ(5,*) HDS  
        PRINT*,'d=',HDS  
        PRINT*,'input lengths of the two parallel plate waveguide(in   
     1  meter)'  
        READ(5,*) AL1S,AL2S  
        PRINT*,'L1=',AL1S,'L2=',AL2S  
        PRINT*,'input material medium parameters according to this order
     1  (1) space permittivity and (2) permeability. Then (3) wavequide
     2  permittivity and (4)  permeability.'    
        READ(5,*) EM1S,UM1S,EM2S,UM2S  
        PRINT*,'EM1=',EM1S,'UM1=',UM1S,'EM2=',EM2S,'UM2=',UM2S  
        PRINT*,'Input the electromagnetic wave incident angle(in
     1  radian) and wave-length(in meter)' 
        READ(5,*) FAIS,WLS   
        PRINT*,'Fi=',FAIS,'WL=',WLS    
        PRINT*,'Input the distance value from measurement points  
     1  to the middle of the two apertures(all point share the same 
     2  radiate distance). Then input the begin angal.(meter & radian)'  
        READ(5,*) R0,ANG0  
        PRINT*,'r=',R0,'The begin point angal=',ANG0  
        PRINT*,'Input the admittances of the microwave network.'  
        PRINT*,'input Y11,Y12,Y21,Y22 one by one(in 1/ohm).'  
        READ(5,*) YLS(1,1),YLS(1,2),YLS(2,1),YLS(2,2)    
        PRINT*,'Y11=',YLS(1,1),'Y12=',YLS(1,2),  
     1  'Y21=',YLS(2,1),'Y22=',YLS(2,2)   
        PRINT*,'Ok! You finish inputing oraginal data, afterwards you
     1  can pick up the results in the files: "bp1.dat" and "
     2  "bp2.dat".' 
	CALL SETPID(HOSTPID)  
	PRINT*,'Loading the cube...'  
	CALL LOAD('empnode',ALLNODES,APPLPID) 
10	SIZE=NUMNODES() 
C	send initial parameters into cube.  
        PRINT*
        PRINT*,'*************** EM scattering Application 
     1   *************** '
        PRINT*
112     WRITE(6,99) 
99      FORMAT('what is cube size(1-',i3,') do you want(0 or neg. value
     1  means quits)?')  
        READ (5,22) SIZE1  
22      FORMAT(I3) 
        IF(SIZE1.LE.0) GOTO 888   
        IF(SIZE1.GT.SIZE) GOTO 112  
        SIZE=SIZE1  
        PRINT*,'We use implse based mode function expansion   
     1  in monemt method' 
	CALL CSEND(INITTYPE,MSG1,INITMSGSIZE,ALLNODES,APPLPID)  
	OPEN(16,FILE='bp2.dat',STATUS='UNKNOWN')  
	ENDMSGSIZE=8*L  
	CALL CRECV(PARTTYPE,HAT,ENDMSGSIZE)  
	DO II=1,L 
	AG=3.1415926*(II-1)/(L-1)+ANG0  
	WRITE(16,*) AG,HAT(II)     
	END DO 
	CALL CRECV(PARTTYPE,TIME,4)  
C	clean out unreceived messages. 
	CALL FLUSHMSG(-1,ALLNODES,APPLPID)  
	MS=MOD(TIME,1000)  
	TSEC=(TIME-MS)/1000  
	SEC=MOD(TSEC,60)  
	MIN=(TSEC-SEC)/60  
	WRITE(6,114) MIN,SEC,MS   
114	FORMAT('elapsed time=',I4,'min.',I2,'.',I3,'sec.')  
	GOTO 10  
888	PRINT*,'please wait while I clean out the cube......' 
	CALL KILLCUBE(ALLNODES,APPLPID) 
	STOP 
	END 
c
c
c
