\hypertarget{historyautochkoutput_8f90}{}\section{gtool/gtool\+\_\+historyauto/historyautochkoutput.f90 File Reference}
\label{historyautochkoutput_8f90}\index{gtool/gtool\+\_\+historyauto/historyautochkoutput.\+f90@{gtool/gtool\+\_\+historyauto/historyautochkoutput.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
logical function \hyperlink{historyautochkoutput_8f90_ae7e3983eeb97a4500152a13accab21dc}{historyautochkoutput} (varname)
\item 
logical function \hyperlink{historyautochkoutput_8f90_a2e25ec51b076f970e0a44909ae853520}{historyautochkoutputtiming} (time, varname)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{historyautochkoutput_8f90_ae7e3983eeb97a4500152a13accab21dc}\label{historyautochkoutput_8f90_ae7e3983eeb97a4500152a13accab21dc}} 
\index{historyautochkoutput.\+f90@{historyautochkoutput.\+f90}!historyautochkoutput@{historyautochkoutput}}
\index{historyautochkoutput@{historyautochkoutput}!historyautochkoutput.\+f90@{historyautochkoutput.\+f90}}
\subsubsection{\texorpdfstring{historyautochkoutput()}{historyautochkoutput()}}
{\footnotesize\ttfamily logical function historyautochkoutput (\begin{DoxyParamCaption}\item[{character($\ast$), intent(in)}]{varname }\end{DoxyParamCaption})}



Definition at line 11 of file historyautochkoutput.\+f90.



References dc\+\_\+types\+::dp, dc\+\_\+types\+::string, and dc\+\_\+types\+::token.


\begin{DoxyCode}
11     \textcolor{comment}{!}
12     \textcolor{comment}{! 変数の出力設定の確認を行います. }
13     \textcolor{comment}{!}
14     \textcolor{comment}{! *varname* に指定された変数名が出力されるよう設定されている}
15     \textcolor{comment}{! 場合には *true* が, 出力されないよう設定されている場合は}
16     \textcolor{comment}{! *false* が返ります. }
17     \textcolor{comment}{! }
18     \textcolor{comment}{! *HistoryAutoCreate* による初期設定がなされていない場合や, }
19     \textcolor{comment}{! *varname* に指定された変数名が HistoryAutoAddVariable によって}
20     \textcolor{comment}{! 登録されていない場合, 返り値に *false* が返ります. }
21     \textcolor{comment}{!}
22     \textcolor{comment}{! Check output setting of a variable. }
23     \textcolor{comment}{!}
24     \textcolor{comment}{! If output setting of *varname* is valid, *true* is returned. }
25     \textcolor{comment}{! If output setting of *varname* is invalid, *false* is returned. }
26     \textcolor{comment}{!}
27     \textcolor{comment}{! If initialization with "HistoryAutoCreate" is not done yet, *false* is returned. }
28     \textcolor{comment}{! If *varname* is invalid, *false* is returned. }
29     \textcolor{comment}{!}
30     \textcolor{keywordtype}{use }gtool\_historyauto\_internal\textcolor{keywordtype}{, only}: initialized, numdims, numvars, &
31       & varname\_vars, output\_valid\_vars
32     \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_ac74a34430fcd3d0eb2344f19d536c086}{dp}, \hyperlink{namespacedc__types_adb76910ff05e3b9fe3436567f8f8dac6}{string}, \hyperlink{namespacedc__types_a6d28eb015ba84292a06f4ff25165b376}{token}
33 
34     \textcolor{keywordtype}{implicit none}
35     \textcolor{keywordtype}{logical}:: result
36     \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)}:: varname
37                               \textcolor{comment}{! 変数の名前. }
38                               \textcolor{comment}{! Variable name}
39 
40     \textcolor{keywordtype}{integer}:: i, vnum
41     \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{save}:: svnum = 1
42     \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{parameter}:: subname = \textcolor{stringliteral}{"HistoryAutoChkOutput"}
43   \textcolor{keywordflow}{continue}
44     \textcolor{comment}{! 初期設定チェック}
45     \textcolor{comment}{! Check initialization}
46     \textcolor{comment}{!}
47     \textcolor{keywordflow}{if} ( .not. initialized ) \textcolor{keywordflow}{then}
48       result = .false.
49       \textcolor{keywordflow}{goto} 999
50 \textcolor{keywordflow}{    end if}
51 
52     \textcolor{comment}{! 変数 ID のサーチ}
53     \textcolor{comment}{! Search variable ID}
54     \textcolor{comment}{!}
55     varsearch: \textcolor{keywordflow}{do}
56       \textcolor{keywordflow}{do} i = svnum, numvars
57         \textcolor{keywordflow}{if} ( trim( varname\_vars(i) ) == trim(varname) ) \textcolor{keywordflow}{then}
58           vnum = i
59           \textcolor{keywordflow}{exit} varsearch
60 \textcolor{keywordflow}{        end if}
61 \textcolor{keywordflow}{      end do}
62       \textcolor{keywordflow}{do} i = 1, svnum - 1
63         \textcolor{keywordflow}{if} ( trim( varname\_vars(i) ) == trim(varname) ) \textcolor{keywordflow}{then}
64           vnum = i
65           \textcolor{keywordflow}{exit} varsearch
66 \textcolor{keywordflow}{        end if}
67 \textcolor{keywordflow}{      end do}
68 
69       result = .false.
70       \textcolor{keywordflow}{goto} 999
71 \textcolor{keywordflow}{    end do} varsearch
72 
73     svnum = vnum
74 
75     \textcolor{comment}{! 出力設定の確認}
76     \textcolor{comment}{! Check output setting}
77     \textcolor{comment}{!}
78     result = output\_valid\_vars( vnum )
79 
80 999 \textcolor{keywordflow}{continue}
\end{DoxyCode}
\mbox{\Hypertarget{historyautochkoutput_8f90_a2e25ec51b076f970e0a44909ae853520}\label{historyautochkoutput_8f90_a2e25ec51b076f970e0a44909ae853520}} 
\index{historyautochkoutput.\+f90@{historyautochkoutput.\+f90}!historyautochkoutputtiming@{historyautochkoutputtiming}}
\index{historyautochkoutputtiming@{historyautochkoutputtiming}!historyautochkoutput.\+f90@{historyautochkoutput.\+f90}}
\subsubsection{\texorpdfstring{historyautochkoutputtiming()}{historyautochkoutputtiming()}}
{\footnotesize\ttfamily logical function historyautochkoutputtiming (\begin{DoxyParamCaption}\item[{real(dp), intent(in)}]{time,  }\item[{character($\ast$), intent(in)}]{varname }\end{DoxyParamCaption})}



Definition at line 86 of file historyautochkoutput.\+f90.



References dc\+\_\+types\+::dp, dc\+\_\+types\+::string, and dc\+\_\+types\+::token.


\begin{DoxyCode}
86     \textcolor{comment}{!}
87     \textcolor{comment}{! 変数の出力設定の確認を行います. }
88     \textcolor{comment}{!}
89     \textcolor{comment}{! *varname* に指定された変数名が、*time* のタイミングで出力されるよう}
90     \textcolor{comment}{! 設定されている場合には *true* が, 出力されないよう設定されている場合は}
91     \textcolor{comment}{! *false* が返ります. }
92     \textcolor{comment}{!}
93     \textcolor{comment}{! なお, gtool\_historyauto は時間ステップ可変に対応しているため, }
94     \textcolor{comment}{! *time* のタイミングで出力されるかどうかについては, }
95     \textcolor{comment}{! その前回に出力された時間に依存します. 従って, とある時間の}
96     \textcolor{comment}{! 出力設定の確認は下記のように HistoryAutoPut の前で使用して下さい. }
97     \textcolor{comment}{!}
98     \textcolor{comment}{!   if ( HistoryAutoChkOutputTiming( time, var ) ) then}
99     \textcolor{comment}{!     <some operation ...>}
100     \textcolor{comment}{!   end if }
101     \textcolor{comment}{!}
102     \textcolor{comment}{!   call HistoryAutoPut( time, var, data )}
103     \textcolor{comment}{!}
104     \textcolor{comment}{! 以下のように使用した場合には, 期待するような返り値が}
105     \textcolor{comment}{! 得られないことにご留意下さい. }
106     \textcolor{comment}{! }
107     \textcolor{comment}{!   do i = 1, 10 }
108     \textcolor{comment}{!     write(*,*) HistoryAutoChkOutputTiming( i * timestep, var )}
109     \textcolor{comment}{!   end do}
110     \textcolor{comment}{!}
111     \textcolor{comment}{! *HistoryAutoCreate* による初期設定がなされていない場合や, }
112     \textcolor{comment}{! *varname* に指定された変数名が HistoryAutoAddVariable によって}
113     \textcolor{comment}{! 登録されていない場合, 返り値に *false* が返ります. }
114     \textcolor{comment}{!}
115     \textcolor{comment}{! Check output setting of a variable. }
116     \textcolor{comment}{!}
117     \textcolor{comment}{! If *varname* is output on *time*, *true* is returned. }
118     \textcolor{comment}{!}
119     \textcolor{comment}{! Please use this function as follows. }
120     \textcolor{comment}{! }
121     \textcolor{comment}{!   if ( HistoryAutoChkOutputTiming( time, var ) ) then}
122     \textcolor{comment}{!     <some operation ...>}
123     \textcolor{comment}{!   end if }
124     \textcolor{comment}{!}
125     \textcolor{comment}{!   call HistoryAutoPut( time, var, data )}
126     \textcolor{comment}{!}
127     \textcolor{comment}{! Following usage does not return correct values.}
128     \textcolor{comment}{! }
129     \textcolor{comment}{!   do i = 1, 10 }
130     \textcolor{comment}{!     write(*,*) HistoryAutoChkOutputTiming( i * timestep, var )}
131     \textcolor{comment}{!   end do}
132     \textcolor{comment}{!}
133     \textcolor{comment}{! If initialization with "HistoryAutoCreate" is not done yet, *false* is returned. }
134     \textcolor{comment}{! If *varname* is invalid, *false* is returned. }
135     \textcolor{comment}{!}
136     \textcolor{keywordtype}{use }gtool\_historyauto\_internal\textcolor{keywordtype}{, only}: initialized, numdims, numvars, &
137       & varname\_vars, output\_valid\_vars, origin\_time\_vars, histaddvar\_vars, &
138       & newfile\_inttime\_vars, newfile\_createtime\_vars, prev\_outtime\_vars, &
139       & interval\_time\_vars, terminus\_time\_vars
140     \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_ac74a34430fcd3d0eb2344f19d536c086}{dp}, \hyperlink{namespacedc__types_adb76910ff05e3b9fe3436567f8f8dac6}{string}, \hyperlink{namespacedc__types_a6d28eb015ba84292a06f4ff25165b376}{token}
141 
142     \textcolor{keywordtype}{implicit none}
143     \textcolor{keywordtype}{logical}:: result
144     \textcolor{keywordtype}{real(DP)}, \textcolor{keywordtype}{intent(in)}:: time
145                               \textcolor{comment}{! データの時刻. }
146                               \textcolor{comment}{! Time of data}
147     \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)}:: varname
148                               \textcolor{comment}{! 変数の名前. }
149                               \textcolor{comment}{! Variable name}
150 
151     \textcolor{keywordtype}{real(DP)}, \textcolor{keywordtype}{parameter}:: zero\_time = 0.0\_dp
152     \textcolor{keywordtype}{integer}:: i, vnum
153     \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{save}:: svnum = 1
154     \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{parameter}:: subname = \textcolor{stringliteral}{"HistoryAutoChkOutputTiming"}
155   \textcolor{keywordflow}{continue}
156 
157     \textcolor{comment}{! 初期設定チェック}
158     \textcolor{comment}{! Check initialization}
159     \textcolor{comment}{!}
160     \textcolor{keywordflow}{if} ( .not. initialized ) \textcolor{keywordflow}{then}
161       result = .false.
162       \textcolor{keywordflow}{goto} 999
163 \textcolor{keywordflow}{    end if}
164 
165     \textcolor{comment}{! 変数 ID のサーチ}
166     \textcolor{comment}{! Search variable ID}
167     \textcolor{comment}{!}
168     varsearch: \textcolor{keywordflow}{do}
169       \textcolor{keywordflow}{do} i = svnum, numvars
170         \textcolor{keywordflow}{if} ( trim( varname\_vars(i) ) == trim(varname) ) \textcolor{keywordflow}{then}
171           vnum = i
172           \textcolor{keywordflow}{exit} varsearch
173 \textcolor{keywordflow}{        end if}
174 \textcolor{keywordflow}{      end do}
175       \textcolor{keywordflow}{do} i = 1, svnum - 1
176         \textcolor{keywordflow}{if} ( trim( varname\_vars(i) ) == trim(varname) ) \textcolor{keywordflow}{then}
177           vnum = i
178           \textcolor{keywordflow}{exit} varsearch
179 \textcolor{keywordflow}{        end if}
180 \textcolor{keywordflow}{      end do}
181 
182       result = .false.
183       \textcolor{keywordflow}{goto} 999
184 \textcolor{keywordflow}{    end do} varsearch
185 
186     svnum = vnum
187 
188     \textcolor{comment}{! 出力設定の確認}
189     \textcolor{comment}{! Check output setting}
190     \textcolor{comment}{!}
191     result = output\_valid\_vars( vnum )
192 
193     \textcolor{keywordflow}{if} ( .not. result ) \textcolor{keywordflow}{goto} 999
194 
195     \textcolor{keywordflow}{if} ( origin\_time\_vars(vnum) > time ) \textcolor{keywordflow}{then}
196       result = .false. 
197       \textcolor{keywordflow}{goto} 999
198 \textcolor{keywordflow}{    end if}
199 
200     \textcolor{keywordflow}{if} (             origin\_time\_vars(vnum) <= time &
201       &  .and.       (      terminus\_time\_vars(vnum) < zero\_time &
202       &                .or. terminus\_time\_vars(vnum) >= time      ) &
203       &  .and. .not. histaddvar\_vars(vnum)            ) \textcolor{keywordflow}{then}
204 
205       result = .true.
206       \textcolor{keywordflow}{goto} 999
207 \textcolor{keywordflow}{    end if}
208 
209     \textcolor{keywordflow}{if} ( terminus\_time\_vars(vnum) > zero\_time .and. terminus\_time\_vars(vnum) < time ) \textcolor{keywordflow}{then}
210       result = .false.
211       \textcolor{keywordflow}{goto} 999
212 \textcolor{keywordflow}{    end if}
213 
214     \textcolor{keywordflow}{if} ( newfile\_inttime\_vars(vnum) > zero\_time ) \textcolor{keywordflow}{then}
215       \textcolor{keywordflow}{if} ( time - newfile\_createtime\_vars(vnum) >= newfile\_inttime\_vars(vnum) ) \textcolor{keywordflow}{then}
216         result = .true.
217         \textcolor{keywordflow}{goto} 999
218 \textcolor{keywordflow}{      end if}
219 \textcolor{keywordflow}{    end if}
220 
221     \textcolor{keywordflow}{if} ( time - prev\_outtime\_vars(vnum) >= interval\_time\_vars(vnum) ) \textcolor{keywordflow}{then}
222       result = .true.
223       \textcolor{keywordflow}{goto} 999
224 \textcolor{keywordflow}{    end if}
225 
226     result = .false.
227 
228 999 \textcolor{keywordflow}{continue}
\end{DoxyCode}
