11
12
13
14
15
16
17
18
19
21 use gtool_history_internal,
only:
default
22 use gtool_history_generic, only: historyinquire
23 use gtdata_generic, only: putline, get_attr
24 use dc_trace, only: beginsub, endsub
25 use dc_string, only: putline, printf, split, strinclude, stoa, joinchar
29 implicit none
30 type(GT_HISTORY), intent(in), target, optional:: history
31 integer, intent(in), optional:: unit
32
33
34
35
36
37 character(*), intent(in), optional:: indent
38
39
40
41 logical, intent(out), optional:: err
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59 type(GT_HISTORY), pointer:: hst =>null()
60 integer:: i, max
61 integer:: stat
62 character(STRING):: cause_c
63 integer:: out_unit
64 integer:: indent_len
65 character(STRING):: indent_str
66
67 character(STRING):: file, title, source, institution
68 character(STRING):: conventions, gt_version
69 character(TOKEN), pointer:: dims(:) =>null()
70 integer, pointer:: dimsizes(:) =>null()
71 character(STRING), pointer:: longnames(:) =>null()
72 character(TOKEN), pointer:: units(:) =>null()
73 character(TOKEN), pointer:: xtypes(:) =>null()
74
75 real:: origin, interval, newest, oldest
76 character(*), parameter:: subname = 'HistoryPutLine'
77 continue
78 call beginsub( subname )
80 cause_c = ''
81
82
83
84
85
86 if ( present(unit) ) then
87 out_unit = unit
88 else
90 end if
91
92 indent_len = 0
93 indent_str = ''
94 if ( present(indent) ) then
95 if ( len(indent) /= 0 ) then
96 indent_len = len(indent)
97 indent_str(1:indent_len) = indent
98 end if
99 end if
100
101 if (present(history)) then
102 hst => history
103 else
105 endif
106
107
108
109
110
111 if ( hst % initialized ) then
112 call printf( out_unit, &
113 & indent_str(1:indent_len) // &
114 & '#<GT_HISTORY:: @initialized=%y', &
115 & l = (/hst % initialized/) )
116
117 call historyinquire( history = hst, &
118 & err = err, &
119 & file = file, title = title, &
120 & source = source, institution = institution, &
121 & dims = dims, dimsizes = dimsizes, &
122 & longnames = longnames, &
123 & units = units, xtypes = xtypes, &
124 & conventions = conventions, &
125 & gt_version = gt_version )
126
127 call printf( out_unit, &
128 & indent_str(1:indent_len) // &
129 & ' @file=%c @title=%c', &
130 & c1 = trim(file), c2 = trim(title) )
131
132 call printf( out_unit, &
133 & indent_str(1:indent_len) // &
134 & ' @source=%c @institution=%c', &
135 & c1 = trim(source), c2 = trim(institution) )
136
137 max = size( dims )
138 call printf( out_unit, &
139 & indent_str(1:indent_len) // &
140 & ' @dims=%c @dimsizes=%*d', &
141 & c1 = trim( joinchar(dims, ',') ), &
142 & i = dimsizes, n = (/max/) )
143 deallocate( dims, dimsizes )
144
145 call printf( out_unit, &
146 & indent_str(1:indent_len) // &
147 & ' @longnames=%c', &
148 & c1 = trim( joinchar(longnames, ',') ) )
149 deallocate( longnames )
150
151 call printf( out_unit, &
152 & indent_str(1:indent_len) // &
153 & ' @units=%c @xtypes=%c', &
154 & c1 = trim( joinchar(units, ',') ), &
155 & c2 = trim( joinchar(xtypes, ',') ) )
156 deallocate( units, xtypes )
157
158 call printf( out_unit, &
159 & indent_str(1:indent_len) // &
160 & ' @conventions=%c @gt_version=%c', &
161 & c1 = trim(conventions), c2 = trim(gt_version) )
162
163 call printf( out_unit, &
164 & indent_str(1:indent_len) // &
165 & ' @unlimited_index=%d', &
166 & i = (/hst % unlimited_index/) )
167
168 max = size( hst % dim_value_written )
169 call printf( out_unit, &
170 & indent_str(1:indent_len) // &
171 & ' @dim_value_written=%*y', &
172 & l = hst % dim_value_written, n = (/max/) )
173
174 origin = hst % origin
175 interval = hst % interval
176 newest = hst % newest
177 oldest = hst % oldest
178
179
180
181
182
183
184 call printf( out_unit, &
185 & indent_str(1:indent_len) // &
186 & ' @origin=%r @interval=%r @newest=%r @oldest=%r', &
187 & r = (/origin, interval, newest, oldest/) )
188
189 if ( associated( hst % growable_indices ) ) then
190 max = size( hst % growable_indices )
191 call printf( out_unit, &
192 & indent_str(1:indent_len) // &
193 & ' @growable_indices=%*d', &
194 & i = hst % growable_indices, n = (/max/) )
195 else
196 call printf( out_unit, &
197 & indent_str(1:indent_len) // &
198 & ' @growable_indices=<null>' )
199 end if
200
201 if ( associated( hst % count ) ) then
202 max = size( hst % count )
203 call printf( out_unit, &
204 & indent_str(1:indent_len) // &
205 & ' @count=%*d', &
206 & i = hst % count, n = (/max/) )
207 else
208 call printf( out_unit, &
209 & indent_str(1:indent_len) // &
210 & ' @count=<null>' )
211 end if
212
213 if ( associated( hst % dimvars ) ) then
214 call printf( out_unit, &
215 & indent_str(1:indent_len) // &
216 & ' @dimvars=' )
217 max = size( hst % dimvars )
218 do i = 1, max
219 call putline( hst % dimvars(i), out_unit, &
220 & indent_str(1:indent_len) // ' ', err )
221 end do
222 else
223 call printf( out_unit, &
224 & indent_str(1:indent_len) // &
225 & ' @dimvars=<null>' )
226 end if
227
228 if ( associated( hst % vars ) ) then
229 call printf( out_unit, &
230 & indent_str(1:indent_len) // &
231 & ' @vars=' )
232 max = size( hst % vars )
233 do i = 1, max
234 call putline( hst % vars(i), out_unit, &
235 & indent_str(1:indent_len) // ' ', err )
236 end do
237 else
238 call printf( out_unit, &
239 & indent_str(1:indent_len) // &
240 & ' @vars=<null>' )
241 end if
242
243 if ( associated( hst % var_avr_count ) ) then
244 max = size( hst % var_avr_count )
245 call printf( out_unit, &
246 & indent_str(1:indent_len) // &
247 & ' @var_avr_count=%*d', &
248 & i = hst % var_avr_count, n = (/max/) )
249 else
250 call printf( out_unit, &
251 & indent_str(1:indent_len) // &
252 & ' @var_avr_count=<null>' )
253 end if
254
255 if ( associated( hst % var_avr_firstput ) ) then
256 max = size( hst % var_avr_firstput )
257 call printf( out_unit, &
258 & indent_str(1:indent_len) // &
259 & ' @var_avr_firstput=%*b', &
260 & l = hst % var_avr_firstput, n = (/max/) )
261 else
262 call printf( out_unit, &
263 & indent_str(1:indent_len) // &
264 & ' @var_avr_firstput=<null>' )
265 end if
266
267 if ( associated( hst % var_avr_coefsum ) ) then
268 max = size( hst % var_avr_coefsum )
269 call printf( out_unit, &
270 & indent_str(1:indent_len) // &
271 & ' @var_avr_coefsum=%*f', &
272 & d = hst % var_avr_coefsum, n = (/max/) )
273 else
274 call printf( out_unit, &
275 & indent_str(1:indent_len) // &
276 & ' @var_avr_coefsum=<null>' )
277 end if
278
279 call printf( out_unit, &
280 & indent_str(1:indent_len) // &
281 & ' @time_bnds=%*f, @time_bnds_output_count=%d', &
282 & i = (/hst % time_bnds_output_count/), &
283 & d = hst % time_bnds, &
284 & n = (/ size(hst % time_bnds) /) )
285
286 if ( associated( hst % var_avr_data ) ) then
287 call printf( out_unit, &
288 & indent_str(1:indent_len) // &
289 & ' @var_avr_data=' )
290 max = size( hst % var_avr_data )
291 do i = 1, max
292 call printf( out_unit, &
293 & indent_str(1:indent_len) // &
294 & ' #<GT_HISTORY_AVRDATA:: @length=%d', &
295 & i = (/hst % var_avr_data(i) % length/) )
296 call putline( hst % var_avr_data(i) % a_DataAvr, unit = out_unit, &
297 & lbounds = lbound(hst % var_avr_data(i) % a_DataAvr), &
298 & ubounds = ubound(hst % var_avr_data(i) % a_DataAvr), &
299 & indent = indent_str(1:indent_len) // &
300 & ' @a_DataAvr=' )
301 end do
302 else
303 call printf( out_unit, &
304 & indent_str(1:indent_len) // &
305 & ' @var_avr_data=<null>' )
306 end if
307
308 call printf( out_unit, &
309 & indent_str(1:indent_len) // &
310 & '>' )
311 else
312 call printf( out_unit, &
313 & indent_str(1:indent_len) // &
314 & '#<GT_HISTORY:: @initialized=%y>', &
315 & l = (/hst % initialized/) )
316 end if
317
318
319
320
321
322999 continue
323 call storeerror( stat, subname, err, cause_c )
324 call endsub( subname )
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public dc_enotinit
integer, parameter, public dc_noerr
integer, parameter, public stdout
標準出力の装置番号
integer, parameter, public token
単語やキーワードを保持する文字型変数の種別型パラメタ
integer, parameter, public dp
倍精度実数型変数
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
type(gt_history), target, save default