引数 history に設定されている情報を印字します。 デフォルトではメッセージは標準出力に出力されます。 unit に装置番号を指定することで、出力先を変更することが可能です。
42
51 implicit none
52 type(GT_HISTORY), intent(in), target, optional:: history
53 integer, intent(in), optional:: unit
54
55
56
57
58
59 character(*), intent(in), optional:: indent
60
61
62
63 logical, intent(out), optional:: err
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81 type(GT_HISTORY), pointer:: hst =>null()
82 integer:: i, max
83 integer:: stat
84 character(STRING):: cause_c
85 integer:: out_unit
86 integer:: indent_len
87 character(STRING):: indent_str
88
89 character(STRING):: file, title, source, institution
90 character(STRING):: conventions, gt_version
91 character(TOKEN), pointer:: dims(:) =>null()
92 integer, pointer:: dimsizes(:) =>null()
93 character(STRING), pointer:: longnames(:) =>null()
94 character(TOKEN), pointer:: units(:) =>null()
95 character(TOKEN), pointer:: xtypes(:) =>null()
96
97 real(DP):: origin, interval, newest, oldest
98 character(*), parameter:: subname = 'HistoryPutLine'
99 continue
102 cause_c = ''
103
104
105
106
107
108 if ( present(unit) ) then
109 out_unit = unit
110 else
112 end if
113
114 indent_len = 0
115 indent_str = ''
116 if ( present(indent) ) then
117 if ( len(indent) /= 0 ) then
118 indent_len = len(indent)
119 indent_str(1:indent_len) = indent
120 end if
121 end if
122
123 if (present(history)) then
124 hst => history
125 else
127 endif
128
129
130
131
132
133 if ( hst % initialized ) then
135 & indent_str(1:indent_len) // &
136 & '#<GT_HISTORY:: @initialized=%y', &
137 & l = (/hst % initialized/) )
138
140 & err = err, &
141 & file = file, title = title, &
142 & source = source, institution = institution, &
143 & dims = dims, dimsizes = dimsizes, &
144 & longnames = longnames, &
145 & units = units, xtypes = xtypes, &
146 & conventions = conventions, &
147 & gt_version = gt_version )
148
150 & indent_str(1:indent_len) // &
151 & ' @file=%c @title=%c', &
152 & c1 = trim(file), c2 = trim(title) )
153
155 & indent_str(1:indent_len) // &
156 & ' @source=%c @institution=%c', &
157 & c1 = trim(source), c2 = trim(institution) )
158
159 max = size( dims )
161 & indent_str(1:indent_len) // &
162 & ' @dims=%c @dimsizes=%*d', &
163 & c1 = trim(
joinchar(dims,
',') ), &
164 & i = dimsizes, n = (/max/) )
165 deallocate( dims, dimsizes )
166
168 & indent_str(1:indent_len) // &
169 & ' @longnames=%c', &
170 & c1 = trim(
joinchar(longnames,
',') ) )
171 deallocate( longnames )
172
174 & indent_str(1:indent_len) // &
175 & ' @units=%c @xtypes=%c', &
176 & c1 = trim(
joinchar(units,
',') ), &
177 & c2 = trim(
joinchar(xtypes,
',') ) )
178 deallocate( units, xtypes )
179
181 & indent_str(1:indent_len) // &
182 & ' @conventions=%c @gt_version=%c', &
183 & c1 = trim(conventions), c2 = trim(gt_version) )
184
186 & indent_str(1:indent_len) // &
187 & ' @unlimited_index=%d', &
188 & i = (/hst % unlimited_index/) )
189
190 max = size( hst % dim_value_written )
192 & indent_str(1:indent_len) // &
193 & ' @dim_value_written=%*y', &
194 & l = hst % dim_value_written, n = (/max/) )
195
196 origin = real(hst % origin, kind=kind(origin))
197 interval = real(hst % interval, kind=kind(interval))
198 newest = real(hst % newest, kind=kind(newest))
199 oldest = real(hst % oldest, kind=kind(oldest))
200
201
202
203
204
205
207 & indent_str(1:indent_len) // &
208 & ' @origin=%r @interval=%r @newest=%r @oldest=%r', &
209 & d = (/origin, interval, newest, oldest/) )
210
211 if ( associated( hst % growable_indices ) ) then
212 max = size( hst % growable_indices )
214 & indent_str(1:indent_len) // &
215 & ' @growable_indices=%*d', &
216 & i = hst % growable_indices, n = (/max/) )
217 else
219 & indent_str(1:indent_len) // &
220 & ' @growable_indices=<null>' )
221 end if
222
223 if ( associated( hst % count ) ) then
224 max = size( hst % count )
226 & indent_str(1:indent_len) // &
227 & ' @count=%*d', &
228 & i = hst % count, n = (/max/) )
229 else
231 & indent_str(1:indent_len) // &
232 & ' @count=<null>' )
233 end if
234
235 if ( associated( hst % dimvars ) ) then
237 & indent_str(1:indent_len) // &
238 & ' @dimvars=' )
239 max = size( hst % dimvars )
240 do i = 1, max
241 call gtputline( hst % dimvars(i), out_unit, &
242 & indent_str(1:indent_len) // ' ', err )
243 end do
244 else
246 & indent_str(1:indent_len) // &
247 & ' @dimvars=<null>' )
248 end if
249
250 if ( associated( hst % vars ) ) then
252 & indent_str(1:indent_len) // &
253 & ' @vars=' )
254 max = size( hst % vars )
255 do i = 1, max
256 call gtputline( hst % vars(i), out_unit, &
257 & indent_str(1:indent_len) // ' ', err )
258 end do
259 else
261 & indent_str(1:indent_len) // &
262 & ' @vars=<null>' )
263 end if
264
265 if ( associated( hst % var_avr_count ) ) then
266 max = size( hst % var_avr_count )
268 & indent_str(1:indent_len) // &
269 & ' @var_avr_count=%*d', &
270 & i = hst % var_avr_count, n = (/max/) )
271 else
273 & indent_str(1:indent_len) // &
274 & ' @var_avr_count=<null>' )
275 end if
276
277 if ( associated( hst % var_avr_firstput ) ) then
278 max = size( hst % var_avr_firstput )
280 & indent_str(1:indent_len) // &
281 & ' @var_avr_firstput=%*b', &
282 & l = hst % var_avr_firstput, n = (/max/) )
283 else
285 & indent_str(1:indent_len) // &
286 & ' @var_avr_firstput=<null>' )
287 end if
288
289 if ( associated( hst % var_avr_coefsum ) ) then
290 max = size( hst % var_avr_coefsum )
292 & indent_str(1:indent_len) // &
293 & ' @var_avr_coefsum=%*f', &
294 & d = hst % var_avr_coefsum, n = (/max/) )
295 else
297 & indent_str(1:indent_len) // &
298 & ' @var_avr_coefsum=<null>' )
299 end if
300
302 & indent_str(1:indent_len) // &
303 & ' @time_bnds=%*f, @time_bnds_output_count=%d', &
304 & i = (/hst % time_bnds_output_count/), &
305 & d = hst % time_bnds, &
306 & n = (/ size(hst % time_bnds) /) )
307
308 if ( associated( hst % var_avr_data ) ) then
310 & indent_str(1:indent_len) // &
311 & ' @var_avr_data=' )
312 max = size( hst % var_avr_data )
313 do i = 1, max
315 & indent_str(1:indent_len) // &
316 & ' #<GT_HISTORY_AVRDATA:: @length=%d', &
317 & i = (/hst % var_avr_data(i) % length/) )
318 call strputline( hst % var_avr_data(i) % a_DataAvr, unit = out_unit, &
319 & lbounds = lbound(hst % var_avr_data(i) % a_DataAvr), &
320 & ubounds = ubound(hst % var_avr_data(i) % a_DataAvr), &
321 & indent = indent_str(1:indent_len) // &
322 & ' @a_DataAvr=' )
323 end do
324 else
326 & indent_str(1:indent_len) // &
327 & ' @var_avr_data=<null>' )
328 end if
329
331 & indent_str(1:indent_len) // &
332 & '>' )
333 else
335 & indent_str(1:indent_len) // &
336 & '#<GT_HISTORY:: @initialized=%y>', &
337 & l = (/hst % initialized/) )
338 end if
339
340
341
342
343
344 call storeerror( stat, subname, err, cause_c )
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public dc_noerr
エラー等を保持
character(string) function, public joinchar(carray, expr)
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
integer, parameter, public token
単語やキーワードを保持する文字型変数の種別型パラメタ
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
integer, parameter, public stdout
標準出力の装置番号
integer, parameter, public dp
倍精度実数型変数
type(gt_history), target, save, public default