gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
gdncfilesync.f90
Go to the documentation of this file.
1!>
2!> @file gdncfilesync.f90
3!>
4!> @author Yasuhiro MORIKAWA, Eizi TOYODA
5!> @copyright Copyright (C) GFD Dennou Club, 2000-2026. All rights reserved. <br/>
6!> License is BSD-2-Clause. See [COPYRIGHT](@ref COPYRIGHT) in detail
7!>
8!> @en
9!> @brief Synchronize netCDF file to disk
10!> @enden
11!>
12!> @ja
13!> @brief netCDF ファイルをディスクに同期
14!> @endja
15!>
16
17!>
18!> @en
19!> @brief Synchronize netCDF file to disk
20!>
21!> Flushes buffered data to disk for the specified file or all open files.
22!> Before syncing, switches the file to data mode if necessary.
23!>
24!> @note This subroutine does not call StoreError internally because it may
25!> be called from SysdepAbort within StoreError.
26!> @enden
27!>
28!> @ja
29!> @brief netCDF ファイルをディスクに同期
30!>
31!> 指定されたファイルまたは全てのオープンファイルのバッファデータを
32!> ディスクにフラッシュします。同期前に、必要に応じてファイルを
33!> データモードに切り替えます。
34!>
35!> @note このサブルーチンは StoreError の SysdepAbort から呼ばれる
36!> 可能性があるため、内部で StoreError を呼び出しません。
37!> @endja
38!>
39!> @param[in] fileid @en netCDF file ID (optional, sync all if omitted) @enden
40!> @ja netCDF ファイル ID (省略時は全ファイルを同期) @endja
41!> @param[out] stat @en Status code (optional) @enden @ja ステータスコード (省略可能) @endja
42!>
43subroutine gdncfilesync(fileid, stat)
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
76end subroutine gdncfilesync
subroutine gdncfilesync(fileid, stat)
エラー処理用モジュール
Definition dc_error.f90:454
logical, save id_used
id_head が初期化済みかを示すフラグ
type(gd_nc_file_id_entry), pointer, save id_head
netCDF ファイルのオープンクローズのための ID テーブル