include ${SEPINC}/SEP.top
include IluMakefile
LATOPTS = option=web 'style=jfc,makeidx,html,amsmath'
#LATOPTS = 'style=amsmath'
BINDIR = ./Bin/${MTYPE}
OBJDIR = ./Obj/${MTYPE}
SRCDIR = ./Src/main
RESDIR = ./Fig
PARDIR = ./Par
TXTDIR = ./Txt
LIBDIR = ./Lib/${MTYPE}
INCDIR = ./Inc
MYDEV  = ./
PYTDIR = ./Pyth
SIGDIR = /data/sigsbee_multiple
#COLOR=yes

#RESULTSNR = eigenvalues_const eigenvalues_bill
RESULTSER = compare compare_mig1
RESULTSCR = 
OLEVEL=2
#UF90FLAGS =-mp -check bounds
UF90FLAGS =-parallel -openmp -openmp_report2  -O3 -axW -vec_report3
MAINLIBS=-lsep2df90 -lsep3df90 -lsep3d -lsepf90 -lsep -L${LIBDIR}  -lsepgeef90
UF90LIBS=${MPILIBS} ${MAINLIBS} -lsepparf90 -lseppar_mpi -lsepgeef90 -lsep2df90 -static-libcxa -lguide#-Bstatic 
UF77LIBS = ${BEILIB}



###########################
#       My stuffs         #
###########################
Prog=/net/koko/brad/bin/LINUX/ShotMig

fs-splitspread_shots.H: ${SIGDIR}/fs-splitspread-shots.H
	Cp  ${SIGDIR}/fs-splitspread-shots.H > $@

nfs-splitspread_shots.H: ${SIGDIR}/nfs-splitspread-shots.H
	Cp  ${SIGDIR}/nfs-splitspread-shots.H > $@

prep.H: ${SIGDIR}/nfs-splitspread-shots.H
	Cp  ${SIGDIR}/nfs-splitspread-shots.H  splitspread_shots.H
	<splitspread_shots.H /net/koko/bob/SEP_BOB/bin/Transf shotmig=y is2d=y f_min=2 f_min1=6 f_max1=36 f_max=42  maxsize=1000 > $@

prep-fs.H: ${SIGDIR}/fs-splitspread-shots.H
	Cp  ${SIGDIR}/fs-splitspread-shots.H  fs-splitspread_shots.H
	<fs-splitspread_shots.H /net/koko/bob/SEP_BOB/bin/Transf shotmig=y is2d=y wei=y f_min=2 f_min1=6 f_max1=36 f_max=42  maxsize=1000 > $@

prep_mult.H:
	Math file1=fs-splitspread_shots.H file2=splitspread_shots.H exp="file1-file2" > mult-splitspread_shots.H
	<mult-splitspread_shots.H Window n1=800 n3=1 f3=200 | /net/koko/bob/SEP_BOB/bin/Transf shotmig=y is2d=y wei=y f_min=2 f_min1=6 \
	f_max1=36 f_max=42 maxsize=1000 > $@

source01.H:${SIGDIR}/nfs-splitspread-shots.H
	< ${SIGDIR}/nfs-splitspread-shots.H Window3d min1=4.88 max1=5.12 f3=5 n3=1 f2=673 n2=1 | \
	Pad end1=1470 > j1.H 
	echo o1=-0.112 n4=1 o4=1 d4=1 n5=1 o5=1 d5=1 >> j1.H
	<j1.H /net/koko/bob/SEP_BOB/bin/Transf shotmig=y is2d=y f_min=2 f_min1=6 f_max1=36 f_max=42  maxsize=1000 > $@

prep_pos.H:
	< prep.H Window3d min1=0 squeeze=n | Pad beg1=347 >$@

prep_neg.H:
	< prep.H Window3d max1=0 squeeze=n | Pad n1=695 >$@

prep_spl.H:
	< prep.H Window3d squeeze=n | Pad beg1=347 end1=347 >$@

prep_spl-fs.H:
	< prep-fs.H Window3d squeeze=n | Pad beg1=347 end1=347 >$@

prep_mult2.H: prep_mult.H
	< prep_mult.H Window3d squeeze=n | Pad beg1=347 end1=347 >$@

vel_pad.H:
	< ${SIGSMULT_DATA}/sigsbee2b_migration_velocity.H Window> j.H
	echo "hff=-1 gff=-1 d1=25 o2=10025 d2=37.5"      >>j.H
	< j.H Window3d n1=1201 j2=2|Pad beg2=2000 n2out=10000 extend=1|Transp> vel_pad.H
	/net/koko/alejandro/plib/pcs2/bin/Wedge.x vel_pad.H axis=2 nn=1 no=0. nd=75. 
	echo  "  label1="x" label2="y" label3="z" " >> vel_pad.H

mig_Sis_Parallel_16000.H:  data_f.H wave.H vel_pad.H ${PARDIR}/go_sis.P 
	@date
	nohup Parallel command=/net/koko/brad/bin/LINUX/ShotMig files="data_f.H,wave.H,vel_pad.H,$@"  \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=60 axis=4,4,5,5 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY"  mach_mfile=machinefile_all nx_shots=327 ox_shots=10925. \
	par=${PARDIR}/go_sis.P  taper=y  taper_pcent=2 marine=y watercolumn=6000 #restart=y

mig_Sis_Parallel_pad.H:  data_f.H wave.H vel_pad.H ${PARDIR}/go_sis.P 
	@date
	nohup Parallel command=./ShotMigNew files="data_f_pad.H,wave.H,vel_pad.H,$@"  \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=37 axis=4,4,5,5 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY"  mach_mfile=machinefile_half nx_shots=327 ox_shots=10925. \
	par=${PARDIR}/go_sis.P  taper=y  taper_pcent=2 marine=y watercolumn=6000 minx=10925 maxx=60000   #restart=y

Mig_pos.H: 
	@date
	nohup Parallel command=./ShotMigNew files="prep_pos.H,source01.H,vel_pad.H,$@"  \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=496 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=496 ox_shots=10925 \
	par=go_sis.P  taper=y  taper_pcent=2 marine=y watercolumn=5400 minx=12000 maxx=70000   #restart=y

Mig_pos_paral.H: prep_pos.H source01.H vel_pad.H go_sis.P
	Window3d < prep_pos.H squeeze=n j4=50 n3=200> prep_pos_tmp.H
	Window3d < source01.H squeeze=n n3=200> source01_tmp.H
	Window3d < vel_pad.H squeeze=n n3=400 > vel_pad_tmp.H
	@date
	nohup Parallel command=./ShotMigNew files="prep_pos_tmp.H,source01_tmp.H,vel_pad_tmp.H,$@"  \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=10 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=496 ox_shots=10925 \
	nref=2 taper=y  taper_pcent=2 marine=y watercolumn=5400 minx=12000 maxx=70000   #restart=y

Mig_fs.H: prep-fs1.H source02.H vel_pad.H go_sis.P
	@date
	nohup Parallel command=./ShotMigNew files="prep-fs1.H,source02.H,vel_pad.H,$@"  \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=10 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=496 ox_shots=10925 \
	nref=2 taper=y  taper_pcent=2 marine=y watercolumn=5400 minx=12000 maxx=70000   #restart=y

Mig_serial.H: 
	Window n4=1 f4=250 squeeze=n <prep-fs1.H >j1.H
	./ShotMigNew D=j1.H D_d=source01a.H V=vel_pad.H R=$@  \
	nx_shots=1 ox_shots=48425 par=go_sis.P \
	nref=2 taper=y  taper_pcent=2 marine=y watercolumn=5400 minx=10000. maxx=75000.  #restart=y

Mig_pos_serial.H: prep_pos1.H source01a.H vel_pad.H go_sis.P
	@date
	./ShotMigNew D=prep_pos1.H D_d=source01a.H V=vel_pad.H R=$@  \
	nref=8 taper=y  taper_pcent=2 marine=y watercolumn=5400  minx=12000 maxx=70000  

Mig_pos_serial1.H: prep_pos1.H source01a.H vel_pad.H 
	Window squeeze=n <prep_pos1.H min4=15000 max4=45000 > junk1.H
	@date
	./ShotMigNew D=junk1.H D_d=source01a.H V=vel_pad.H R=$@  \
	nref=8 taper=y  taper_pcent=2 marine=y watercolumn=5400  minx=20000 maxx=40000  

Mig_pos_serial2.H: prep_pos1.H source01a.H vel_pad.H
	Window squeeze=n <prep_pos1.H min4=25000 n4=1 > junk1.H
	@date
	./ShotMigNew D=junk1.H D_d=source01a.H V=vel_pad.H R=$@  \
	nref=8 taper=y  taper_pcent=2 marine=y watercolumn=5400  # minx=20000 maxx=40000  

Mig_neg.H: prep_neg.H source01.H vel_pad.H go_sis.P
	@date
	nohup Parallel command=./ShotMigNew files="prep_neg.H,source01.H,vel_pad.H,$@"  \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=496 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=496 ox_shots=10925 \
	par=go_sis.P  taper=y  taper_pcent=2 marine=y watercolumn=5400 minx=12000 maxx=70000 restart=y

Mig_spl.H: prep_spl.H source01.H vel_pad.H go_sis.P
	@date
	nohup Parallel command=./ShotMigNew files="prep_spl.H,source01.H,vel_pad.H,$@"  \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=496 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=496 ox_shots=10925 \
	par=go_sis.P  taper=y  taper_pcent=2 marine=y watercolumn=5400 minx=12000 maxx=70000 #restart=y

Mig_spl-fs.H: prep_spl-fs.H source01.H vel_pad.H go_sis.P
	@date
	nohup Parallel command=./ShotMigNew files="prep_spl-fs.H,source01.H,vel_pad.H,$@"  \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=496 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=496 ox_shots=10925 \
	par=go_sis.P  taper=y  taper_pcent=2 marine=y watercolumn=5400 minx=12000 maxx=70000 #restart=y

Mig_mult.H: prep-mult.H source01.H vel_pad.H go_sis.P
	@date
	nohup Parallel command=./ShotMigNew files="prep-mult.H,source01.H,vel_pad.H,$@"  \
        tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=496 axis=4,4,4,6 pverb=2  \
        file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
        nx_shots=496 ox_shots=10925 \
        par=go_sis.P  taper=y  taper_pcent=2 marine=y watercolumn=5400 minx=12000 maxx=70000 #restart=y

Mig_mult2.H: prep_mult2.H source01.H vel_pad.H go_sis.P
	@date
	nohup Parallel command=./ShotMigNew files="prep_mult2.H,source01.H,vel_pad.H,$@"  \
        tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=200 axis=4,4,4,6 pverb=2  \
        file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
        jhx=2 nx_shots=200 ox_shots=10925 \
        par=go_sismult.P  taper=y  taper_pcent=2 marine=y watercolumn=5400 minx=12000 maxx=70000 #restart=y

Mig_spl_hi.H: prep_spl.H source01.H vel_pad_hi.H go_sis.P
	@date
	nohup Parallel command=./ShotMigNew files="prep_spl.H,source01.H,vel_pad_hi.H,$@"  \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=496 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=496 ox_shots=10925 \
	par=go_sis.P  taper=y  taper_pcent=2 marine=y watercolumn=5400 minx=12000 maxx=70000 #restart=y

Mig_spl_lo.H: prep_spl.H source01.H vel_pad_lo.H go_sis.P
	@date
	nohup Parallel command=./ShotMigNew files="prep_spl.H,source01.H,vel_pad_lo.H,$@"  \
	tags="D,D_d,V,R" usage="INPUT,INPUT,INPUT,OUTPUT" nblock=496 axis=4,4,4,6 pverb=2  \
	file_type="DISTRIBUTE,COPY,COPY,COPY" mach_mfile=machinefile_200 \
	nx_shots=496 ox_shots=10925 \
	par=go_sis.P  taper=y  taper_pcent=2 marine=y watercolumn=5400 minx=12000 maxx=70000 #restart=y

ADCIG_spl-fs.H:Mig_spl-fs.H
	< Mig_spl-fs.H Transp reshape=2,4,5 plane=13 | Pad beg2=43 end2=44 | /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y eps=1 maxmem=1000 >$@

ADCIG_spl.H:Mig_spl.H
	< Mig_spl.H Transp reshape=2,4,5 plane=13 | Pad beg2=43 end2=44 | /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y eps=1 maxmem=1000 >$@

ADCIG_spl_lo.H:Mig_spl_lo.H
	< Mig_spl_lo.H Transp reshape=2,4,5 plane=13 | Pad beg2=43 end2=44 | /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y eps=1 maxmem=1000 >$@

ADCIG_spl_hi.H:Mig_spl_hi.H
	< Mig_spl_hi.H Transp reshape=2,4,5 plane=13 | Pad beg2=43 end2=44 | /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y eps=1 maxmem=1000 >$@

ADCIG_pos.H:Mig_pos.H
	< Mig_pos.H Transp reshape=2,4,5 plane=13 | Pad beg2=43 end2=44 | /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y eps=1 maxmem=1000 >$@

ADCIG_neg.H:Mig_neg.H
	< Mig_neg.H Transp reshape=2,4,5 plane=13 | Pad beg2=43 end2=44 | /net/koko/bob/SEP_BOB/bin/OFF2ANG verb=y eps=1 maxmem=1000 >$@

Vo_pos:
	< Mig_pos.H Window3d | Transp plane=13 | Transp plane=23 | Grey eout=1 gainpanel=a pclip=95 | Ricksep &

Va_pos:
	Window3d < ang_pos.H | Transp plane=23 | Grey eout=1 gainpanel=a pclip=95 | Ricksep &
include ${SEPINC}/SEP.bottom

