gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
hstnmlinfoassocgthist.f90
Go to the documentation of this file.
1!> @file hstnmlinfoassocgthist.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 Associate a gtool_history_types::GT_HISTORY variable
9!> @enden
10!>
11!> @ja
12!> @brief gtool_history_types::GT_HISTORY 型変数の結合
13!> @endja
14
15 !> @en
16 !> @brief Associate a gtool_history_types::GT_HISTORY variable
17 !>
18 !> This subroutine associates given gtool_history_types::GT_HISTORY
19 !> pointer @p history to
20 !> gtool_history_types::GT_HISTORY corresponding to @p name in @p gthstnml.
21 !> Give null @p history.
22 !>
23 !> Use after state is changed from define mode to
24 !> output mode by HstNmlInfoEndDefine.
25 !> If this subroutine is used before
26 !> HstNmlInfoEndDefine is used, error is occurred.
27 !>
28 !> When data corresponding to @p name is not found,
29 !> error is occurred.
30 !> When @p name is blank,
31 !> error is occurred too.
32 !>
33 !> If @p gthstnml is not initialized by HstNmlInfoCreate yet,
34 !> error is occurred.
35 !> @enden
36 !>
37 !> @ja
38 !> @brief gtool_history_types::GT_HISTORY 型変数の結合
39 !>
40 !> 与えられた gtool_history_types::GT_HISTORY 型のポインタ @p history に対し,
41 !> @p gthstnml 内の @p name に関する gtool_history_types::GT_HISTORY 型変数を
42 !> 結合します.
43 !> 空状態の @p history を与えてください.
44 !>
45 !> HstNmlInfoEndDefine で定義モードから出力モードに
46 !> 移行した後に呼び出してください.
47 !> HstNmlInfoEndDefine を呼ぶ前にこのサブルーチンを使用すると,
48 !> プログラムはエラーを発生させます.
49 !>
50 !> @p name に関する情報が見当たらない場合,
51 !> プログラムはエラーを発生させます.
52 !> @p name が空文字の場合にも,
53 !> プログラムはエラーを発生させます.
54 !>
55 !> なお, 与えられた @p gthstnml が HstNmlInfoCreate によって初期設定
56 !> されていない場合にも, プログラムはエラーを発生させます.
57 !> @endja
58 !>
59 !> @param[in] gthstnml gtool_history_nmlinfo_types::GTHST_NMLINFO 型変数
60 !> @param[in] name 変数名. 先頭の空白は無視されます.
61 !> Variable identifier. Blanks at the head of the name are ignored.
62 !> @param[out] history gtool_history_types::GT_HISTORY 型ポインタ.
63 !> Pointer of gtool_history_types::GT_HISTORY.
64 !> @param[out] err 例外処理用フラグ. Exception handling flag.
65 subroutine hstnmlinfoassocgthist( gthstnml, &
66 & name, history, err )
69 use gtool_history, only: gt_history
70 use dc_trace, only: beginsub, endsub
71 use dc_types, only: string
73 implicit none
74 type(gthst_nmlinfo), intent(in):: gthstnml
75 character(*), intent(in):: name
76 ! 変数名.
77 ! 先頭の空白は無視されます.
78 !
79 ! Variable identifier.
80 ! Blanks at the head of the name are ignored.
81 type(gt_history), pointer:: history
82 ! (out)
83 !
84 ! gtool_history モジュール用構造体.
85 ! Derived type for "gtool_history" module
86 logical, intent(out), optional:: err
87 ! 例外処理用フラグ.
88 ! デフォルトでは, この手続き内でエラーが
89 ! 生じた場合, プログラムは強制終了します.
90 ! 引数 *err* が与えられる場合,
91 ! プログラムは強制終了せず, 代わりに
92 ! *err* に .true. が代入されます.
93 !
94 ! Exception handling flag.
95 ! By default, when error occur in
96 ! this procedure, the program aborts.
97 ! If this *err* argument is given,
98 ! .true. is substituted to *err* and
99 ! the program does not abort.
100
101 !-----------------------------------
102 ! 作業変数
103 ! Work variables
104 type(gthst_nmlinfo_entry), pointer:: hptr =>null()
105 integer:: stat
106 character(STRING):: cause_c
107 character(*), parameter:: subname = 'HstNmlInfoAssocGtHist'
108 continue
109 call beginsub( subname )
110 stat = dc_noerr
111 cause_c = ''
112
113 !-----------------------------------------------------------------
114 ! 初期設定のチェック
115 ! Check initialization
116 !-----------------------------------------------------------------
117 if ( .not. gthstnml % initialized ) then
118 stat = dc_enotinit
119 cause_c = 'GTHST_NMLINFO'
120 goto 999
121 end if
122
123 if ( trim( name ) == '' ) then
124 stat = hst_ebadname
125 cause_c = ''
126 goto 999
127 end if
128
129 if ( gthstnml % define_mode ) then
130 stat = hst_eindefine
131 cause_c = 'AssocGtHist'
132 goto 999
133 end if
134
135 !-----------------------------------------------------------------
136 ! *gthstnml* 内から, *name* に関する history を探査.
137 ! Search "history" correspond to *name* in *gthstnml*
138 !-----------------------------------------------------------------
139 hptr => gthstnml % gthstnml_list
140 call listsearch( gthstnml_list = hptr, & ! (inout)
141 & name = name ) ! (in)
142
143 if ( .not. associated( hptr ) ) then
144 stat = dc_enoentry
145 cause_c = adjustl( name )
146 goto 999
147 end if
148
149 nullify( history )
150 history => hptr % history
151
152 nullify( hptr )
153
154 !-----------------------------------------------------------------
155 ! 終了処理, 例外処理
156 ! Termination and Exception handling
157 !-----------------------------------------------------------------
158999 continue
159 call storeerror( stat, subname, err, cause_c )
160 call endsub( subname )
161 end subroutine hstnmlinfoassocgthist
subroutine hstnmlinfoassocgthist(gthstnml, name, history, err)
Error handling module.
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_enotinit
-400 or less: DC utilities errors
Definition dc_error.f90:534
integer, parameter, public dc_noerr
Error storage variables
Definition dc_error.f90:468
integer, parameter, public hst_eindefine
Definition dc_error.f90:558
integer, parameter, public hst_ebadname
Definition dc_error.f90:560
integer, parameter, public dc_enoentry
Definition dc_error.f90:548
Debug tracing module.
Definition dc_trace.f90:150
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
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public string
Character length for string
Definition dc_types.f90:137