gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
Functions/Subroutines
historyclose.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine historyclose (history, quiet, err)
 

Function/Subroutine Documentation

◆ historyclose()

subroutine historyclose ( type(gt_history), intent(inout), optional, target  history,
logical, intent(in), optional  quiet,
logical, intent(out), optional  err 
)

Definition at line 37 of file historyclose.f90.

38 !
42 use gtdata_generic, only: close, inquire
43 use gtdata_types, only: gt_variable
44 use dc_message, only: messagenotify
45 use dc_url, only: urlsplit
48 use dc_types, only: string, dp
51 implicit none
52 type(GT_HISTORY), intent(inout), optional, target:: history
53 ! 出力ファイルの設定に関する情報を
54 ! 格納した構造体
55 !
56 ! ここに指定するものは,
57 ! HistoryCreate によって初期設定
58 ! されていなければなりません.
59 !
60 logical, intent(in), optional:: quiet
61 ! .true. を与えた場合,
62 ! メッセージ出力が抑制されます.
63 !
64 ! If ".true." is given,
65 ! messages are suppressed.
66 !
67 logical, intent(out), optional:: err
68 ! 例外処理用フラグ.
69 ! デフォルトでは, この手続き内でエラーが
70 ! 生じた場合, プログラムは強制終了します.
71 ! 引数 *err* が与えられる場合,
72 ! プログラムは強制終了せず, 代わりに
73 ! *err* に .true. が代入されます.
74 !
75 ! Exception handling flag.
76 ! By default, when error occur in
77 ! this procedure, the program aborts.
78 ! If this *err* argument is given,
79 ! .true. is substituted to *err* and
80 ! the program does not abort.
81 type(GT_HISTORY), pointer:: hst =>null()
82 character(STRING):: url, file
83 integer:: i, v_size
84 integer:: stat
85 character(STRING):: cause_c
86 character(len = *), parameter:: subname = "HistoryClose"
87 continue
88 call beginsub(subname)
89 stat = dc_noerr
90 cause_c = ""
91 if (present(history)) then
92 hst => history
93 else
94 hst => default
95 endif
96 !-----------------------------------------------------------------
97 ! 初期設定のチェック
98 ! Check initialization
99 !-----------------------------------------------------------------
100 if ( .not. hst % initialized ) then
101 stat = dc_enotinit
102 cause_c = 'GT_HISTORY'
103 goto 999
104 end if
105 !-----------------------------------------------------------------
106 ! メッセージ出力用にファイル名取得
107 ! Get filename for output messages
108 !-----------------------------------------------------------------
109 if ( .not. present_and_true(quiet) ) then
110 call inquire( hst % dimvars(1), & ! (in)
111 & url = url ) ! (out)
112 call urlsplit( fullname = url, & ! (in)
113 & file = file ) ! (out)
114 end if
115 !-----------------------------------------------------------------
116 ! 変数のクローズ
117 ! Close variables
118 !-----------------------------------------------------------------
119 v_size = size(hst % dimvars)
120 do, i = 1, v_size
121 if (.not. hst % dim_value_written(i)) &
122 call set_fake_dim_value(hst, i)
123 call close(hst % dimvars(i))
124 enddo
125 v_size = size(hst % vars)
126 do, i = 1, v_size
127 call close(hst % vars(i))
128 enddo
129 deallocate(hst % dimvars)
130 v_size = size(hst % vars)
131 !-----------------------------------------------------------------
132 ! 設定のクリア
133 ! Clear configurations
134 !-----------------------------------------------------------------
135 hst % unlimited_index = 0
136 hst % unlimited_units = ''
137 hst % unlimited_units_symbol = unit_symbol_err
138 if (associated(hst % dim_value_written)) deallocate(hst % dim_value_written)
139 if (associated(hst % vars)) deallocate(hst % vars)
140 if (associated(hst % growable_indices)) deallocate(hst % growable_indices)
141 if (associated(hst % count)) deallocate(hst % count)
142 if (associated(hst % var_avr_count)) deallocate(hst % var_avr_count)
143 do, i = 1, v_size
144 if (associated(hst % var_avr_data(i) % a_DataAvr)) deallocate(hst % var_avr_data(i) % a_DataAvr)
145 enddo
146 if (associated(hst % var_avr_data)) deallocate(hst % var_avr_data)
147 if (associated(hst % var_avr_firstput)) deallocate(hst % var_avr_firstput)
148 if (associated(hst % var_avr_coefsum)) deallocate(hst % var_avr_coefsum)
149 if (associated(hst % var_avr_baseint)) deallocate(hst % var_avr_baseint)
150 if (associated(hst % var_avr_prevtime)) deallocate(hst % var_avr_prevtime)
151 hst % time_bnds = 0.0_dp
152 hst % time_bnds_output_count = 0
153 hst % time_nv_index = 0
154 hst % origin_setting = .false.
155 !-----------------------------------------------------------------
156 ! メッセージ出力
157 ! Output messages
158 !-----------------------------------------------------------------
159 if ( .not. present_and_true(quiet) ) then
160 call messagenotify('M', subname, &
161 & '"%c" is closed', &
162 & c1 = trim( file ), rank_mpi = -1 )
163 end if
164 !-----------------------------------------------------------------
165 ! 終了処理, 例外処理
166 ! Termination and Exception handling
167 !-----------------------------------------------------------------
168 hst % initialized = .false.
169999 continue
170 call storeerror( stat, subname, err, cause_c )
171 call endsub( subname )
日付・時刻に関する構造データ型と定数
integer, parameter, public unit_symbol_err
無効な単位を示すシンボル
エラー処理用モジュール
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_noerr
エラー等を保持
Definition dc_error.f90:468
integer, parameter, public dc_enotinit
-400 以下: dc ユーティリティのエラー
Definition dc_error.f90:534
メッセージの出力
省略可能な制御パラメータの判定
logical function, public present_and_true(arg)
デバッグ時の追跡用モジュール
Definition dc_trace.f90:150
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:661
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:457
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:580
種別型パラメタを提供します。
Definition dc_types.f90:55
integer, parameter, public dp
倍精度実数型変数
Definition dc_types.f90:92
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition dc_types.f90:137
変数 URL の文字列解析
Definition dc_url.f90:61
type(gt_history), target, save, public default

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_enotinit, dc_error::dc_noerr, gtool_history_internal::default, dc_types::dp, dc_trace::endsub(), dc_present::present_and_true(), dc_error::storeerror(), dc_types::string, and dc_date_types::unit_symbol_err.

Here is the call graph for this function: