#!/bin/csh set IO = `basename $0` # #------------------------------------------------------- Fortran Code --------- cat >! ${IO}.f << FINEF90 implicit none real x,y,acaso,ngol ; integer i,ntiri ; character title*40 call graphiclayout ntiri=100 ; ngol=0 do i=1,ntiri x=acaso(x) ; y=acaso(y) call disegnapunto(x,y) if (x**2+y**2.lt.1) ngol=ngol+1 enddo write(title,'(a,f4.2)') 'Estimated value of pi-grec: ',4*ngol/ntiri call displayplot(' ',' ',title) end subroutine disegnapunto(x,y) implicit none real x,y call pallocchetto ((x+1)/2,(y+1)/2,0.005,9) return end subroutine graphiclayout call mvsetflags('Palette di colori',8.0) call mvsetflags('Colore Titoli',6.0) call mvsetflags('Random seed',3388148907.0) call scrivisulplot(' ',0.85,0.05) call set (0.0,1.0,0.0,1.0,-1.0,1.0,-1.0,1.0,1) call pallocchetto (0.5,0.5,0.5,8) call linea(0.0,-1.0,0.0,1.0) call linea(-1.0,0.0,1.0,0.0) return end FINEF90 set LOGF = "true" set LOGF = "false" goto chkplatf retchkplatf: if ( -f $IO.exe ) /bin/rm $IO.exe f90 $OPTION -o $IO.exe $IO.f $JETNET $MVLIB $NCARLIB $X11LIB >&! fortran.log if ( ! -x $IO.exe ) then echo " ${IO}: cannot find $IO.exe " echo " This is the log for compilation:" echo "******************************************************************" cat fortran.log echo "******************************************************************" goto CANCELLA else if ( $LOGF == "true" ) then cat fortran.log echo " Running $IO.exe" endif ./$IO.exe CANCELLA: if ( $LOGF == "true" ) echo " Removing all tmp files." foreach FILE ( $IO.exe gmeta core $IO.log fortran.log \ gifmerge.log ${IO}common.f CONDRV.SCR tbl.tmp ) if ( -f $FILE) /bin/rm $FILE end if ( $LOGF == "true" ) echo " Done." exit chkplatf: set CHKSEL = "${?IO}" if ( $CHKSEL == 0 ) set IO = `basename $0` set CHKSEL = "${?SELCOMP}" if ( $CHKSEL == 0 ) set SELCOMP = "nocomp" set X11LIB = " -lX11 -lm " set COMP = "f90" if ( -X gfortran ) then alias f90 gfortran ; set COMP = "gfortran" set OPTION = \ ' -ffixed-line-length-132 -fconvert=big-endian -w -Wno-tabs -O2' else if ( -X ifort ) then alias f90 ifort ; set COMP = "ifort" set OPTION = ' -O2 -extend-source -convert big_endian' else if ( -X pgf90 ) then alias f90 pgf90 ; set COMP = "pgf90" set OPTION = ' -silent -Mextend -byteswapio ' endif set IPLATF = 5 # Alla ricerca delle ncarlib set NCARLIB = ' ' foreach JDIR ( /usr/lib /usr/local/lib /usr/local/ncarg /usr/local/ncarg/lib \ $HOME/../verdecch/ncarg/lib/ $HOME/ncarg $HOME/ncarg/lib \ ./ncarg ./ncarg/lib ) if ( -f $JDIR/libncarg.a ) then set NCARLIB = " -L$JDIR -lncarg -lncarg_gks -lncarg_c " setenv NCARG_ROOT $JDIR endif end # Alla ricerca delle mvlib set MVLIB = " " if ( -f /usr/local/lib/libmv.a ) set MVLIB = " -L/usr/local/lib -lmvgraf -lncaruti -lmv" if ( -f ./libmv.a ) set MVLIB = " -L. -lmvgraf -lncaruti -lmv" if ( -f /usr/local/ncarg/lib/libmv.a ) set MVLIB = " -L/usr/local/ncarg/lib -lmvgraf -lncaruti -lmv" if ( -f $HOME/../verdecch//mvlib/lib/$IPLATF/libmv.a ) set MVLIB = " -L$HOME/../verdecch//mvlib/lib/$IPLATF/ -lmvgraf -lncaruti -lmv" if ( -f $HOME/mvlib/lib/$IPLATF/libmv.a ) set MVLIB = " -L$HOME/mvlib/lib/$IPLATF/ -lmvgraf -lncaruti -lmv" if ( -f ./libchym.a ) set MVLIB = " -L. -lchym " set JETNET = ' ' foreach JDIR ( $HOME/../verdecch/mvlib/lib/$IPLATF /usr/local/lib \ /usr/lib $HOME/mvlib/lib/$IPLATF ) if ( -f $JDIR/libjetnet20.a ) set JETNET = " -L$JDIR -ljetnet20" if ( -f $JDIR/jetnet20.a ) set JETNET = " $JDIR/jetnet20.a" end goto retchkplatf