gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
gtool_history_nmlinfo_internal.f90
Go to the documentation of this file.
1!> @file gtool_history_nmlinfo_internal.f90
2!>
3!> @author Yasuhiro MORIKAWA
4!> @copyright Copyright (C) GFD Dennou Club, 2007-2026. All rights reserved. <br/>
5!> License is BSD-2-Clause. See [COPYRIGHT](@ref COPYRIGHT) in detail
6!>
7!> @en
8!> @brief Internal constants, variables, procedures used in "gtool_history_nmlinfo"
9!> @enden
10!>
11!> @ja
12!> @brief gtool_history_nmlinfo 内で使用される内部向け定数, 変数, 手続き群
13!> @endja
14
16 !>
17 !> @en
18 !> @brief Internal constants, variables, procedures used in "gtool_history_nmlinfo"
19 !> @enden
20 !>
21 !> @ja
22 !> @brief gtool_history_nmlinfo 内で使用される内部向け定数, 変数, 手続き群
23 !> @endja
24 !>
25
26 use dc_hash, only: hash
27 implicit none
28 private
30
31 character(1), parameter, public:: name_delimiter = ','
32 ! 複数の変数名の区切り文字
33 ! Delimiter for multiple variable names
34
35 type(hash), save, public:: opened_files
36 ! 複数の変数を一つのファイルへ
37 ! 出力するためのチェック用変数.
38 !
39 ! Variables for checking for
40 ! output multiple variables to one file.
41
42 character(*), parameter, public:: version = &
43 & '$Name: $' // &
44 & '$Id: gtool_history_nmlinfo_internal.f90,v 1.1 2009-05-11 15:15:15 morikawa Exp $'
45
46 !-----------------------------------------------------------------
47 ! 非公開手続
48 ! Private procedures
49 !-----------------------------------------------------------------
50
51 interface listnext
52 module procedure hstnmlinfolistnext
53 end interface
54
55 interface listlast
56 module procedure hstnmlinfolistlast
57 end interface
58
59 interface listsearch
60 module procedure hstnmlinfolistsearch
61 end interface
62
63contains
64
65 !>
66 !> @en
67 !> @brief Advance to next entry in list
68 !>
69 !> gthstnml_list (type GTHST_NMLINFO_ENTRY) that is a list structure
70 !> is received, and gthstnml_list is reassociated to next entry, and
71 !> is returned.
72 !> If next entry is not found, gthstnml_list is associated to
73 !> next in last entry (null), and returned.
74 !> If gthstnml_list is null from the beginning, null is returned.
75 !>
76 !> @param[inout] gthstnml_list List entry pointer
77 !> @param[out] err Error flag (optional)
78 !> @enden
79 !>
80 !> @ja
81 !> @brief リストの次エントリへ移動
82 !>
83 !> リスト構造である gthstnml_list (GTHST_NMLINFO_ENTRY 型) を受け取り,
84 !> 次のエントリを gthstnml_list に再結合して返します.
85 !> 次のエントリが無い場合, gthstnml_list の最後のエントリの
86 !> next (空状態) に接続して返します.
87 !> gthstnml_list が始めから空の場合には空状態を返します.
88 !>
89 !> @param[inout] gthstnml_list リストエントリポインタ
90 !> @param[out] err 例外処理用フラグ (省略可能)
91 !> @endja
92 !>
93 subroutine hstnmlinfolistnext( &
94 & gthstnml_list, err )
96 use dc_trace, only: beginsub, endsub
97 use dc_error, only: storeerror, dc_noerr
98 use dc_types, only: string
99 implicit none
100 type(gthst_nmlinfo_entry), pointer:: gthstnml_list
101 ! (inout)
102 logical, intent(out), optional:: err
103 ! 例外処理用フラグ.
104 ! デフォルトでは, この手続き内でエラーが
105 ! 生じた場合, プログラムは強制終了します.
106 ! 引数 *err* が与えられる場合,
107 ! プログラムは強制終了せず, 代わりに
108 ! *err* に .true. が代入されます.
109 !
110 ! Exception handling flag.
111 ! By default, when error occur in
112 ! this procedure, the program aborts.
113 ! If this *err* argument is given,
114 ! .true. is substituted to *err* and
115 ! the program does not abort.
116
117 !-----------------------------------
118 ! 作業変数
119 ! Work variables
120 integer:: stat
121 character(STRING):: cause_c
122 character(*), parameter:: subname = 'HstNmlInfoListNext'
123 continue
124 call beginsub( subname )
125 stat = dc_noerr
126 cause_c = ''
127
128 !-----------------------------------------------------------------
129 ! 空状態の場合は何もしないで返す
130 ! If null, return without change
131 !-----------------------------------------------------------------
132 if ( .not. associated( gthstnml_list ) ) goto 999
133
134 !-----------------------------------------------------------------
135 ! 次のエントリに結合して返す
136 ! Next entry is associated, and returned
137 !-----------------------------------------------------------------
138 gthstnml_list => gthstnml_list % next
139
140 !-----------------------------------------------------------------
141 ! 終了処理, 例外処理
142 ! Termination and Exception handling
143 !-----------------------------------------------------------------
144999 continue
145 call storeerror( stat, subname, err, cause_c )
146 call endsub( subname )
147 end subroutine hstnmlinfolistnext
148
149 !>
150 !> @en
151 !> @brief Move to last entry in list
152 !>
153 !> gthstnml_list (type GTHST_NMLINFO_ENTRY) that is a list structure
154 !> is received, and gthstnml_list is reassociated to
155 !> last entry, and returned.
156 !> If gthstnml_list is null from the beginning, null is returned.
157 !>
158 !> If previous is given, an entry previous to the above entry
159 !> is associated.
160 !>
161 !> @param[inout] gthstnml_list List entry pointer
162 !> @param[out] previous Previous entry pointer (optional)
163 !> @param[out] err Error flag (optional)
164 !> @enden
165 !>
166 !> @ja
167 !> @brief リストの最後のエントリへ移動
168 !>
169 !> リスト構造である gthstnml_list (GTHST_NMLINFO_ENTRY 型) を受け取り,
170 !> 最後のエントリに再結合して返します.
171 !> gthstnml_list が始めから空の場合には空状態を返します.
172 !>
173 !> previous が与えられる場合, 当該エントリの一つ前の
174 !> エントリに結合します.
175 !>
176 !> @param[inout] gthstnml_list リストエントリポインタ
177 !> @param[out] previous 前のエントリポインタ (省略可能)
178 !> @param[out] err 例外処理用フラグ (省略可能)
179 !> @endja
180 !>
181 subroutine hstnmlinfolistlast( &
182 & gthstnml_list, previous, err )
184 use dc_trace, only: beginsub, endsub
185 use dc_error, only: storeerror, dc_noerr
186 use dc_types, only: string
187 implicit none
188 type(gthst_nmlinfo_entry), pointer:: gthstnml_list
189 ! (inout)
190 type(gthst_nmlinfo_entry), pointer, optional:: previous
191 ! (out)
192 logical, intent(out), optional:: err
193 ! 例外処理用フラグ.
194 ! デフォルトでは, この手続き内でエラーが
195 ! 生じた場合, プログラムは強制終了します.
196 ! 引数 *err* が与えられる場合,
197 ! プログラムは強制終了せず, 代わりに
198 ! *err* に .true. が代入されます.
199 !
200 ! Exception handling flag.
201 ! By default, when error occur in
202 ! this procedure, the program aborts.
203 ! If this *err* argument is given,
204 ! .true. is substituted to *err* and
205 ! the program does not abort.
206
207 !-----------------------------------
208 ! 作業変数
209 ! Work variables
210 integer:: stat
211 character(STRING):: cause_c
212 character(*), parameter:: subname = 'HstNmlInfoListLast'
213 continue
214 call beginsub( subname )
215 stat = dc_noerr
216 cause_c = ''
217
218 if ( present( previous ) ) nullify( previous )
219
220 !-----------------------------------------------------------------
221 ! 空状態の場合は何もしないで返す
222 ! If null, return without change
223 !-----------------------------------------------------------------
224 if ( .not. associated( gthstnml_list ) ) goto 999
225
226 !-----------------------------------------------------------------
227 ! 最後のエントリの *next* に結合して返す
228 ! "*next*" in last entry is associated, and returned
229 !-----------------------------------------------------------------
230 do while ( associated( gthstnml_list % next ) )
231 if ( present( previous ) ) previous => gthstnml_list
232 call listnext( gthstnml_list = gthstnml_list ) ! (inout)
233 end do
234
235 !-----------------------------------------------------------------
236 ! 終了処理, 例外処理
237 ! Termination and Exception handling
238 !-----------------------------------------------------------------
239999 continue
240 call storeerror( stat, subname, err, cause_c )
241 call endsub( subname )
242 end subroutine hstnmlinfolistlast
243
244 !>
245 !> @en
246 !> @brief Search list entry by name
247 !>
248 !> gthstnml_list (type GTHST_NMLINFO_ENTRY) that is a list structure
249 !> is received, and gthstnml_list is reassociated to
250 !> the entry that has a value that is same as argument name,
251 !> and returned.
252 !> If the entry is not found, null is returned.
253 !> If gthstnml_list is null from the beginning, null is returned.
254 !>
255 !> If previous is given, an entry previous to the above entry
256 !> is associated. If previous entries are not found,
257 !> null is returned.
258 !>
259 !> If next is given, an entry next to the above entry
260 !> is associated. If next entries are not found,
261 !> null is returned.
262 !>
263 !> @param[inout] gthstnml_list List entry pointer
264 !> @param[in] name Variable identifier
265 !> @param[out] previous Previous entry pointer (optional)
266 !> @param[out] next Next entry pointer (optional)
267 !> @param[out] err Error flag (optional)
268 !> @enden
269 !>
270 !> @ja
271 !> @brief 名前でリストエントリを検索
272 !>
273 !> リスト構造である gthstnml_list (GTHST_NMLINFO_ENTRY 型) を受け取り,
274 !> 引数 name と同じ値を持つエントリに再結合して返します.
275 !> 見つからない場合は空状態を返します.
276 !> gthstnml_list が始めから空の場合には空状態を返します.
277 !>
278 !> previous が与えられる場合, 当該エントリの一つ前の
279 !> エントリに結合します. 前のエントリが無い場合には
280 !> 空状態を返します.
281 !>
282 !> next が与えられる場合, 当該エントリの一つ後ろの
283 !> エントリに結合します. 後ろのエントリが無い場合には
284 !> 空状態を返します.
285 !>
286 !> @param[inout] gthstnml_list リストエントリポインタ
287 !> @param[in] name 変数名 (先頭の空白は無視される)
288 !> @param[out] previous 前のエントリポインタ (省略可能)
289 !> @param[out] next 次のエントリポインタ (省略可能)
290 !> @param[out] err 例外処理用フラグ (省略可能)
291 !> @endja
292 !>
293 subroutine hstnmlinfolistsearch( &
294 & gthstnml_list, name, &
295 & previous, next, err )
297 use dc_trace, only: beginsub, endsub
298 use dc_error, only: storeerror, dc_noerr
299 use dc_types, only: string
300 implicit none
301 type(gthst_nmlinfo_entry), pointer:: gthstnml_list
302 ! (inout)
303 character(*), intent(in):: name
304 ! 変数名.
305 ! 先頭の空白は無視されます.
306 !
307 ! Variable identifier.
308 ! Blanks at the head of the name are ignored.
309 type(gthst_nmlinfo_entry), pointer, optional:: previous
310 ! (out)
311 type(gthst_nmlinfo_entry), pointer, optional:: next
312 ! (out)
313 logical, intent(out), optional:: err
314 ! 例外処理用フラグ.
315 ! デフォルトでは, この手続き内でエラーが
316 ! 生じた場合, プログラムは強制終了します.
317 ! 引数 *err* が与えられる場合,
318 ! プログラムは強制終了せず, 代わりに
319 ! *err* に .true. が代入されます.
320 !
321 ! Exception handling flag.
322 ! By default, when error occur in
323 ! this procedure, the program aborts.
324 ! If this *err* argument is given,
325 ! .true. is substituted to *err* and
326 ! the program does not abort.
327
328 !-----------------------------------
329 ! 作業変数
330 ! Work variables
331 integer:: stat
332 character(STRING):: cause_c
333 character(*), parameter:: subname = 'HstNmlInfoListSearch'
334 continue
335 call beginsub( subname )
336 stat = dc_noerr
337 cause_c = ''
338
339 !-----------------------------------------------------------------
340 ! 空状態の場合は何もしないで返す
341 ! If null, return without change
342 !-----------------------------------------------------------------
343 if ( .not. associated( gthstnml_list ) ) goto 999
344
345 !-----------------------------------------------------------------
346 ! 引数 *name* と同じ *name* を持つエントリを探査
347 ! The entry that has *name* that is same as argument *name* is searched
348 !-----------------------------------------------------------------
349 if ( present( previous ) ) nullify( previous )
350 if ( present( next ) ) nullify( next )
351 if ( trim( adjustl( gthstnml_list % name ) ) == trim( adjustl( name ) ) ) then
352 if ( present( next ) ) then
353 next => gthstnml_list % next
354 end if
355 goto 999
356 end if
357
358 do while ( associated( gthstnml_list ) )
359 if ( present( previous ) ) previous => gthstnml_list
360 call listnext( gthstnml_list = gthstnml_list ) ! (inout)
361 if ( .not. associated( gthstnml_list ) ) goto 999
362 if ( trim( adjustl( gthstnml_list % name ) ) == trim( adjustl( name ) ) ) then
363 if ( present( next ) ) then
364 next => gthstnml_list % next
365 end if
366 goto 999
367 end if
368 end do
369
370 !-----------------------------------------------------------------
371 ! 終了処理, 例外処理
372 ! Termination and Exception handling
373 !-----------------------------------------------------------------
374999 continue
375 call storeerror( stat, subname, err, cause_c )
376 call endsub( subname )
377 end subroutine hstnmlinfolistsearch
378
エラー処理用モジュール
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
ハッシュ (連想配列) モジュール
Definition dc_hash.f90:143
デバッグ時の追跡用モジュール
Definition dc_trace.f90:150
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:476
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:599
種別型パラメタを提供します。
Definition dc_types.f90:55
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition dc_types.f90:137
character(1), parameter, public name_delimiter