gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
gdncfilesync.f90 File Reference

Synchronize netCDF file to disk . More...

Go to the source code of this file.

Functions/Subroutines

subroutine gdncfilesync (fileid, stat)

Detailed Description

Synchronize netCDF file to disk

.

Author
Yasuhiro MORIKAWA, Eizi TOYODA

Definition in file gdncfilesync.f90.

Function/Subroutine Documentation

◆ gdncfilesync()

subroutine gdncfilesync ( integer, intent(in), optional fileid,
integer, intent(out), optional stat )

Synchronize netCDF file to disk

Flushes buffered data to disk for the specified file or all open files. Before syncing, switches the file to data mode if necessary.

Note
This subroutine does not call StoreError internally because it may be called from SysdepAbort within StoreError.
Parameters
[in]fileidnetCDF file ID (optional, sync all if omitted)
[out]statStatus code (optional)

Definition at line 43 of file gdncfilesync.f90.

47 use netcdf, only: nf90_sync, nf90_noerr
48 use dc_error
49 integer, intent(in), optional:: fileid
50 integer, intent(out), optional:: stat
51 integer:: ncid, mystat
52 type(GD_NC_FILE_ID_ENTRY), pointer:: identptr
53continue
54 mystat = nf90_noerr
55 if (present(fileid)) then
56 ncid = fileid
57 mystat = gdncfiledatamode(ncid)
58 if (mystat /= nf90_noerr) goto 999
59 mystat = nf90_sync(ncid)
60 else if (id_used) then
61 identptr => id_head
62 do
63 if (.not. associated(identptr)) exit
64 ncid = identptr % id
65 mystat = gdncfiledatamode(ncid)
66 if (mystat /= nf90_noerr) exit
67 mystat = nf90_sync(ncid)
68 if (mystat /= nf90_noerr) exit
69 identptr => identptr % next
70 enddo
71 endif
72999 continue
73 ! 自発的には StoreError しない。StoreError の SysdepAbort
74 ! からも呼ばれる可能性があるためである。
75 if (present(stat)) stat = mystat
Error handling module.
Definition dc_error.f90:454
logical, save id_used
Flag indicating whether id_head has been initialized
type(gd_nc_file_id_entry), pointer, save id_head
ID table for open/close of netCDF files

References gtdata_netcdf_file_internal::id_head, and gtdata_netcdf_file_internal::id_used.