gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
Functions/Subroutines
historyautochkoutput.f90 File Reference

Check output setting of a variable . More...

Go to the source code of this file.

Functions/Subroutines

logical function historyautochkoutput (varname)
 
logical function historyautochkoutputtiming (time, varname)
 

Detailed Description

Check output setting of a variable

.

Author
Yasuhiro MORIKAWA

Definition in file historyautochkoutput.f90.

Function/Subroutine Documentation

◆ historyautochkoutput()

logical function historyautochkoutput ( character(*), intent(in)  varname)

Check output setting of a variable

If output setting of varname is valid, .true. is returned. If output setting of varname is invalid, .false. is returned.

If initialization with HistoryAutoCreate is not done yet, .false. is returned. If varname is invalid, .false. is returned.

Parameters
[in]varname変数の名前. Variable name.
Returns
出力設定が有効であれば .true.

Definition at line 39 of file historyautochkoutput.f90.

42
43 implicit none
44 logical:: result
45 character(*), intent(in):: varname
46 ! 変数の名前.
47 ! Variable name
48
49 integer:: i, vnum
50 integer, save:: svnum = 1
51 continue
52 ! 初期設定チェック
53 ! Check initialization
54 !
55 if ( .not. initialized ) then
56 result = .false.
57 goto 999
58 end if
59
60 ! 変数 ID のサーチ
61 ! Search variable ID
62 !
63 varsearch: do
64 do i = svnum, numvars
65 if ( trim( varname_vars(i) ) == trim(varname) ) then
66 vnum = i
67 exit varsearch
68 end if
69 end do
70 do i = 1, svnum - 1
71 if ( trim( varname_vars(i) ) == trim(varname) ) then
72 vnum = i
73 exit varsearch
74 end if
75 end do
76
77 result = .false.
78 goto 999
79 end do varsearch
80
81 svnum = vnum
82
83 ! 出力設定の確認
84 ! Check output setting
85 !
86 result = output_valid_vars( vnum )
87
88999 continue
character(token), dimension(1:max_vars), save, public varname_vars
logical, dimension(1:max_vars), save, public output_valid_vars

References gtool_historyauto_internal::initialized, gtool_historyauto_internal::numvars, gtool_historyauto_internal::output_valid_vars, and gtool_historyauto_internal::varname_vars.

◆ historyautochkoutputtiming()

logical function historyautochkoutputtiming ( real(dp), intent(in)  time,
character(*), intent(in)  varname 
)

Check output timing of a variable

If varname is output on time, .true. is returned.

Please use this function as follows.

if ( HistoryAutoChkOutputTiming( time, var ) ) then
  <some operation ...>
end if

call HistoryAutoPut( time, var, data )

Following usage does not return correct values.

do i = 1, 10
  write(*,*) HistoryAutoChkOutputTiming( i * timestep, var )
end do

If initialization with HistoryAutoCreate is not done yet, .false. is returned. If varname is invalid, .false. is returned.

Parameters
[in]timeデータの時刻. Time of data.
[in]varname変数の名前. Variable name.
Returns
出力タイミングであれば .true.

Definition at line 149 of file historyautochkoutput.f90.

154 use dc_types, only: dp
155
156 implicit none
157 logical:: result
158 real(DP), intent(in):: time
159 ! データの時刻.
160 ! Time of data
161 character(*), intent(in):: varname
162 ! 変数の名前.
163 ! Variable name
164
165 real(DP), parameter:: zero_time = 0.0_dp
166 integer:: i, vnum
167 integer, save:: svnum = 1
168 continue
169
170 ! 初期設定チェック
171 ! Check initialization
172 !
173 if ( .not. initialized ) then
174 result = .false.
175 goto 999
176 end if
177
178 ! 変数 ID のサーチ
179 ! Search variable ID
180 !
181 varsearch: do
182 do i = svnum, numvars
183 if ( trim( varname_vars(i) ) == trim(varname) ) then
184 vnum = i
185 exit varsearch
186 end if
187 end do
188 do i = 1, svnum - 1
189 if ( trim( varname_vars(i) ) == trim(varname) ) then
190 vnum = i
191 exit varsearch
192 end if
193 end do
194
195 result = .false.
196 goto 999
197 end do varsearch
198
199 svnum = vnum
200
201 ! 出力設定の確認
202 ! Check output setting
203 !
204 result = output_valid_vars( vnum )
205
206 if ( .not. result ) goto 999
207
208 if ( origin_time_vars(vnum) > time ) then
209 result = .false.
210 goto 999
211 end if
212
213 if ( origin_time_vars(vnum) <= time &
214 & .and. ( terminus_time_vars(vnum) < zero_time &
215 & .or. terminus_time_vars(vnum) >= time ) &
216 & .and. .not. histaddvar_vars(vnum) ) then
217
218 result = .true.
219 goto 999
220 end if
221
222 if ( terminus_time_vars(vnum) > zero_time .and. terminus_time_vars(vnum) < time ) then
223 result = .false.
224 goto 999
225 end if
226
227 if ( newfile_inttime_vars(vnum) > zero_time ) then
228 if ( time - newfile_createtime_vars(vnum) >= newfile_inttime_vars(vnum) ) then
229 result = .true.
230 goto 999
231 end if
232 end if
233
234 if ( time - prev_outtime_vars(vnum) >= interval_time_vars(vnum) ) then
235 result = .true.
236 goto 999
237 end if
238
239 result = .false.
240
241999 continue
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public dp
Double Precision Real number
Definition dc_types.f90:92
real(dp), dimension(1:max_vars), save, public newfile_inttime_vars
real(dp), dimension(1:max_vars), save, public interval_time_vars
real(dp), dimension(1:max_vars), save, public newfile_createtime_vars
real(dp), dimension(1:max_vars), save, public terminus_time_vars
real(dp), dimension(1:max_vars), save, public prev_outtime_vars
real(dp), dimension(1:max_vars), save, public origin_time_vars
logical, dimension(1:max_vars), save, public histaddvar_vars

References dc_types::dp, gtool_historyauto_internal::histaddvar_vars, gtool_historyauto_internal::initialized, gtool_historyauto_internal::interval_time_vars, gtool_historyauto_internal::newfile_createtime_vars, gtool_historyauto_internal::newfile_inttime_vars, gtool_historyauto_internal::numvars, gtool_historyauto_internal::origin_time_vars, gtool_historyauto_internal::output_valid_vars, gtool_historyauto_internal::prev_outtime_vars, gtool_historyauto_internal::terminus_time_vars, gtool_historyauto_internal::varname_vars, and gtool_historyauto_internal::zero_time.