38 |
C control whether the DFILE_OPEN routine opens a file in |
C control whether the DFILE_OPEN routine opens a file in |
39 |
C read-write or read-only mode. On some systems this is necessary |
C read-write or read-only mode. On some systems this is necessary |
40 |
C as the default is read-write and will fail for read-only files or |
C as the default is read-write and will fail for read-only files or |
41 |
C file systems. Other systems don't support the OPEN(...='READ_ONLY') |
C file systems. Other systems do not support the OPEN(...='READ_ONLY') |
42 |
C so this feature may need to be switched on or off as appropriate. |
C so this feature may need to be switched on or off as appropriate. |
43 |
C The DFILE_SET routines provide this mechanism. They work by setting |
C The DFILE_SET routines provide this mechanism. They work by setting |
44 |
C a "context" flag which is applied to IO ahndles when the DFILE_OPEN |
C a "context" flag which is applied to IO ahndles when the DFILE_OPEN |
216 |
metaDataStatus(fileHandle,myThid) = metaDataWritten |
metaDataStatus(fileHandle,myThid) = metaDataWritten |
217 |
IF ( fNamMeta .NE. ' ' ) THEN |
IF ( fNamMeta .NE. ' ' ) THEN |
218 |
IF ( aMode .EQ. accessModeRW ) THEN |
IF ( aMode .EQ. accessModeRW ) THEN |
219 |
OPEN(UNIT=mUnit,NAME=fNamMeta(i2Lo:i2Hi),STATUS='UNKNOWN',ERR=899) |
OPEN(UNIT=mUnit,NAME=fNamMeta(i2Lo:i2Hi), |
220 |
|
& STATUS='UNKNOWN',ERR=899) |
221 |
CLOSE(mUnit,ERR=899) |
CLOSE(mUnit,ERR=899) |
222 |
OPEN(UNIT=mUnit,NAME=fNamMeta(i2Lo:i2Hi),STATUS='UNKNOWN',ERR=899) |
OPEN(UNIT=mUnit,NAME=fNamMeta(i2Lo:i2Hi), |
223 |
|
& STATUS='UNKNOWN',ERR=899) |
224 |
metaDataStatus(fileHandle,myThid) = metaDataNotWritten |
metaDataStatus(fileHandle,myThid) = metaDataNotWritten |
225 |
nameOfMFile(fileHandle,myThid) = fNamMeta(i2Lo:i2Hi) |
nameOfMFile(fileHandle,myThid) = fNamMeta(i2Lo:i2Hi) |
226 |
ENDIF |
ENDIF |
240 |
CALL PRINT_ERROR( msgBuf , 1) |
CALL PRINT_ERROR( msgBuf , 1) |
241 |
WRITE(msgBuf,'(A,A)') ' Too many open files ' |
WRITE(msgBuf,'(A,A)') ' Too many open files ' |
242 |
CALL PRINT_ERROR( msgBuf , 1) |
CALL PRINT_ERROR( msgBuf , 1) |
243 |
WRITE(msgBuf,'(A,I4,A,A)') ' Thread ', myThid, ' trying to open ', |
WRITE(msgBuf,'(A,I4,A,A)') ' Thread ', myThid,' trying to open ', |
244 |
& fNam(i1Lo:i1Hi) |
& fNam(i1Lo:i1Hi) |
245 |
CALL PRINT_ERROR( msgBuf , 1) |
CALL PRINT_ERROR( msgBuf , 1) |
246 |
IF ( eMode .EQ. errorModeSTOP ) THEN |
IF ( eMode .EQ. errorModeSTOP ) THEN |
252 |
899 CONTINUE |
899 CONTINUE |
253 |
WRITE(msgBuf,'(A)') ' S/R DFILE_OPEN ' |
WRITE(msgBuf,'(A)') ' S/R DFILE_OPEN ' |
254 |
CALL PRINT_ERROR( msgBuf , 1) |
CALL PRINT_ERROR( msgBuf , 1) |
255 |
WRITE(msgBuf,'(A,I4,A,A)') ' Thread ', myThid, ' failed open for ', |
WRITE(msgBuf,'(A,I4,A,A)') ' Thread ',myThid,' failed open for ', |
256 |
& fNamMeta(i2Lo:i2Hi) |
& fNamMeta(i2Lo:i2Hi) |
257 |
CALL PRINT_ERROR( msgBuf , 1) |
CALL PRINT_ERROR( msgBuf , 1) |
258 |
IF ( eMode .EQ. errorModeSTOP ) THEN |
IF ( eMode .EQ. errorModeSTOP ) THEN |
264 |
799 CONTINUE |
799 CONTINUE |
265 |
WRITE(msgBuf,'(A)') ' S/R DFILE_OPEN ' |
WRITE(msgBuf,'(A)') ' S/R DFILE_OPEN ' |
266 |
CALL PRINT_ERROR( msgBuf , 1) |
CALL PRINT_ERROR( msgBuf , 1) |
267 |
WRITE(msgBuf,'(A,I4,A,A)') ' Thread ', myThid, ' failed open for ', |
WRITE(msgBuf,'(A,I4,A,A)') ' Thread ',myThid,' failed open for ', |
268 |
& fNam(i1Lo:i1Hi) |
& fNam(i1Lo:i1Hi) |
269 |
CALL PRINT_ERROR( msgBuf , 1) |
CALL PRINT_ERROR( msgBuf , 1) |
270 |
IF ( eMode .EQ. errorModeSTOP ) THEN |
IF ( eMode .EQ. errorModeSTOP ) THEN |
347 |
899 CONTINUE |
899 CONTINUE |
348 |
WRITE(msgBuf,'(A)') ' S/R DFILE_READ_R4 ' |
WRITE(msgBuf,'(A)') ' S/R DFILE_READ_R4 ' |
349 |
CALL PRINT_ERROR( msgBuf , 1) |
CALL PRINT_ERROR( msgBuf , 1) |
350 |
WRITE(msgBuf,'(A,I4,A)') ' Thread ', myThid, ' error reading file' |
WRITE(msgBuf,'(A,I4,A)') ' Thread ', myThid,' error reading file' |
351 |
CALL PRINT_ERROR( msgBuf , 1) |
CALL PRINT_ERROR( msgBuf , 1) |
352 |
WRITE(msgBuf,'(A,A,A)') ' "', fNam(iLo:iHi),'"' |
WRITE(msgBuf,'(A,A,A)') ' "', fNam(iLo:iHi),'"' |
353 |
CALL PRINT_ERROR( msgBuf , 1) |
CALL PRINT_ERROR( msgBuf , 1) |
430 |
899 CONTINUE |
899 CONTINUE |
431 |
WRITE(msgBuf,'(A)') ' S/R DFILE_READ_R8 ' |
WRITE(msgBuf,'(A)') ' S/R DFILE_READ_R8 ' |
432 |
CALL PRINT_ERROR( msgBuf , 1) |
CALL PRINT_ERROR( msgBuf , 1) |
433 |
WRITE(msgBuf,'(A,I4,A)') ' Thread ', myThid, ' error reading file' |
WRITE(msgBuf,'(A,I4,A)') ' Thread ', myThid,' error reading file' |
434 |
CALL PRINT_ERROR( msgBuf , 1) |
CALL PRINT_ERROR( msgBuf , 1) |
435 |
WRITE(msgBuf,'(A,A,A)') ' "', fNam(iLo:iHi),'"' |
WRITE(msgBuf,'(A,A,A)') ' "', fNam(iLo:iHi),'"' |
436 |
CALL PRINT_ERROR( msgBuf , 1) |
CALL PRINT_ERROR( msgBuf , 1) |
566 |
WRITE(ioUnit,ERR=899) (ioBuf_R4(I),I=1,lBuffer) |
WRITE(ioUnit,ERR=899) (ioBuf_R4(I),I=1,lBuffer) |
567 |
|
|
568 |
C-- Now write meta information |
C-- Now write meta information |
569 |
IF ( metaDataStatus(fileHandle,myThid) .EQ. metaDataNotWritten ) THEN |
IF ( metaDataStatus(fileHandle,myThid) .EQ. |
570 |
|
& metaDataNotWritten ) THEN |
571 |
ioUnit = mUnitNumber(fileHandle,myThid) |
ioUnit = mUnitNumber(fileHandle,myThid) |
572 |
|
|
573 |
WRITE(msgBuf,'(A)') '// START OF META DATA' |
WRITE(msgBuf,'(A)') '// START OF META DATA' |
575 |
|
|
576 |
WRITE(msgBuf,'(A,A)') ' id =[ ','/* Identifier */' |
WRITE(msgBuf,'(A,A)') ' id =[ ','/* Identifier */' |
577 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
578 |
CALL PRINT_LIST_I( fileId, 1, INDEX_NONE, .FALSE., .TRUE., ioUnit ) |
CALL PRINT_LIST_I( fileId, 1, INDEX_NONE, .FALSE., .TRUE., |
579 |
|
& ioUnit ) |
580 |
WRITE(msgBuf,'(A)') ' ]; ' |
WRITE(msgBuf,'(A)') ' ]; ' |
581 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
582 |
|
|
583 |
WRITE(msgBuf,'(A,A)') ' nDims =[ ','/* Number of dimensions */' |
WRITE(msgBuf,'(A,A)') ' nDims =[ ','/* Number of dimensions */' |
584 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
585 |
CALL PRINT_LIST_I( nDims, 1, INDEX_NONE, .FALSE., .TRUE., ioUnit ) |
CALL PRINT_LIST_I( nDims, 1, INDEX_NONE, .FALSE., .TRUE., |
586 |
|
& ioUnit ) |
587 |
WRITE(msgBuf,'(A)') ' ]; ' |
WRITE(msgBuf,'(A)') ' ]; ' |
588 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
589 |
|
|
591 |
& '/* Global1, local min1, local max1, ... */' |
& '/* Global1, local min1, local max1, ... */' |
592 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
593 |
DO I=1,nDims |
DO I=1,nDims |
594 |
CALL PRINT_LIST_I( dimList((I-1)*3+1), 3, INDEX_NONE, I.NE.nDims, .FALSE., ioUnit ) |
CALL PRINT_LIST_I( dimList((I-1)*3+1), 3, INDEX_NONE, |
595 |
|
& I.NE.nDims, .FALSE., ioUnit ) |
596 |
ENDDO |
ENDDO |
597 |
WRITE(msgBuf,'(A)') ' ]; ' |
WRITE(msgBuf,'(A)') ' ]; ' |
598 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
699 |
WRITE(ioUnit,ERR=899) (ioBuf_R8(I),I=1,lBuffer) |
WRITE(ioUnit,ERR=899) (ioBuf_R8(I),I=1,lBuffer) |
700 |
|
|
701 |
C-- Now write meta information |
C-- Now write meta information |
702 |
IF ( metaDataStatus(fileHandle,myThid) .EQ. metaDataNotWritten ) THEN |
IF ( metaDataStatus(fileHandle,myThid) .EQ. |
703 |
|
& metaDataNotWritten ) THEN |
704 |
ioUnit = mUnitNumber(fileHandle,myThid) |
ioUnit = mUnitNumber(fileHandle,myThid) |
705 |
|
|
706 |
WRITE(msgBuf,'(A)') '// START OF META DATA' |
WRITE(msgBuf,'(A)') '// START OF META DATA' |
708 |
|
|
709 |
WRITE(msgBuf,'(A,A)') ' id =[ ','/* Identifier */' |
WRITE(msgBuf,'(A,A)') ' id =[ ','/* Identifier */' |
710 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
711 |
CALL PRINT_LIST_I( fileId, 1, INDEX_NONE, .FALSE., .TRUE., ioUnit ) |
CALL PRINT_LIST_I( fileId, 1, INDEX_NONE, .FALSE., .TRUE., |
712 |
|
& ioUnit ) |
713 |
WRITE(msgBuf,'(A)') ' ]; ' |
WRITE(msgBuf,'(A)') ' ]; ' |
714 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
715 |
|
|
716 |
WRITE(msgBuf,'(A,A)') ' nDims =[ ','/* Number of dimensions */' |
WRITE(msgBuf,'(A,A)') ' nDims =[ ','/* Number of dimensions */' |
717 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
718 |
CALL PRINT_LIST_I( nDims, 1, INDEX_NONE, .FALSE., .TRUE., ioUnit ) |
CALL PRINT_LIST_I( nDims, 1, INDEX_NONE, .FALSE., .TRUE., |
719 |
|
& ioUnit ) |
720 |
WRITE(msgBuf,'(A)') ' ]; ' |
WRITE(msgBuf,'(A)') ' ]; ' |
721 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
722 |
|
|
724 |
& '/* Global1, local min1, local max1, ... */' |
& '/* Global1, local min1, local max1, ... */' |
725 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
726 |
DO I=1,nDims |
DO I=1,nDims |
727 |
CALL PRINT_LIST_I( dimList((I-1)*3+1), 3, INDEX_NONE, I.NE.nDims, .FALSE., ioUnit ) |
CALL PRINT_LIST_I( dimList((I-1)*3+1), 3, INDEX_NONE, |
728 |
|
& I.NE.nDims, .FALSE., ioUnit ) |
729 |
ENDDO |
ENDDO |
730 |
WRITE(msgBuf,'(A)') ' ]; ' |
WRITE(msgBuf,'(A)') ' ]; ' |
731 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |