ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c The following are I/O routines. This file contains a vanilla c FORTRAN version, which should work anywhere. c c NOTES: c - should be used with "assign -s bin" (see man page) to speed c tranfer rates and make SKTMP useable for other than file rewind. c The default file characteristics when assign is not used add c record headers, which mess things up. c c - Can be used with an SSD file system. c c - Does not do asynchronous transfers c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc C open the intermediate file, optionally allocating SIZE words SUBROUTINE OPNTMP(UNIT,NAME,SIZE) INTEGER SIZE CHARACTER*80 NAME INTEGER UNIT OPEN(UNIT=9+UNIT, FILE=NAME, FORM='UNFORMATTED', IOSTAT=IOS, * STATUS='SCRATCH') IF(IOS .NE. 0) THEN PRINT *,'ERROR In opening file ',NAME,IOS CALL ABORT ENDIF RETURN END SUBROUTINE CLOSTMP(UNIT,NAME) INTEGER UNIT CHARACTER*80 NAME CLOSE(9+UNIT, IOSTAT=IOS) IF(IOS .NE. 0) THEN PRINT *,'ERROR In closing file ',NAME,IOS CALL ABORT ENDIF RETURN END c Read NWORDS words into ARRAY from UNIT SUBROUTINE RDTMP(UNIT,ARRAY,NWORDS) INTEGER UNIT INTEGER ARRAY(NWORDS) INTEGER NWORDS READ(9+UNIT,IOSTAT=IOS, ERR=10)ARRAY RETURN 10 CONTINUE PRINT *,'ERROR In reading ',UNIT,IOS CALL ABORT END c Write NWORDS words from ARRAY SUBROUTINE WRTMP(UNIT,ARRAY,NWORDS) INTEGER UNIT INTEGER ARRAY(NWORDS) INTEGER NWORDS WRITE(9+UNIT,IOSTAT=IOS, ERR=10)ARRAY RETURN 10 CONTINUE PRINT *,'ERROR In writing ',UNIT,IOS CALL ABORT END c Seek to word number POS in UNIT SUBROUTINE SKTMP(UNIT,POS) INTEGER UNIT INTEGER ARYSIZ PARAMETER (ARYSIZ=16 384) INTEGER POS, LPOS INTEGER ARRAY(ARYSIZ) REWIND(9+UNIT) LPOS = POS IF(POS .GE. ARYSIZ) THEN DO 10 I = 1,POS-ARYSIZ,ARYSIZ READ(9+UNIT)ARRAY 10 CONTINUE LPOS = POS-I+1 ENDIF IF(LPOS .GT. 0) THEN READ(9+UNIT)(ARRAY(I),I=1,LPOS) ENDIF RETURN END c Make sure previous i/o to this unit is done SUBROUTINE SYNTMP(UNIT) RETURN END