\hypertarget{historyautoallvarfix_8f90}{}\section{gtool/gtool\+\_\+historyauto/historyautoallvarfix.f90 File Reference}
\label{historyautoallvarfix_8f90}\index{gtool/gtool\+\_\+historyauto/historyautoallvarfix.\+f90@{gtool/gtool\+\_\+historyauto/historyautoallvarfix.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{historyautoallvarfix_8f90_ad862b9a0ef913e91a11fb4f08c26c5ca}{historyautoallvarfix}
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{historyautoallvarfix_8f90_ad862b9a0ef913e91a11fb4f08c26c5ca}\label{historyautoallvarfix_8f90_ad862b9a0ef913e91a11fb4f08c26c5ca}} 
\index{historyautoallvarfix.\+f90@{historyautoallvarfix.\+f90}!historyautoallvarfix@{historyautoallvarfix}}
\index{historyautoallvarfix@{historyautoallvarfix}!historyautoallvarfix.\+f90@{historyautoallvarfix.\+f90}}
\subsubsection{\texorpdfstring{historyautoallvarfix()}{historyautoallvarfix()}}
{\footnotesize\ttfamily subroutine historyautoallvarfix (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



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



References dc\+\_\+error\+::dc\+\_\+enotinit, dc\+\_\+error\+::dc\+\_\+noerr, dc\+\_\+types\+::dp, dc\+\_\+error\+::hst\+\_\+ebadvarname, dc\+\_\+error\+::storeerror(), dc\+\_\+types\+::string, and dc\+\_\+types\+::token.


\begin{DoxyCode}
11     \textcolor{comment}{!}
12     \textcolor{comment}{! このサブルーチンは以下の動作を行います. }
13     \textcolor{comment}{! }
14     \textcolor{comment}{! * NAMELIST から読み込んだ変数名に無効なものが存在したかどうかをチェック. }
15     \textcolor{comment}{! * HistoryAutoAddVariable で登録した変数名を印字. }
16     \textcolor{comment}{!}
17     \textcolor{comment}{! このサブルーチンを呼んだ後に HistoryAutoAddVariable を呼ぶと}
18     \textcolor{comment}{! エラーを生じます. }
19     \textcolor{comment}{!}
20     \textcolor{comment}{! This subroutine performs following acts. }
21     \textcolor{comment}{! }
22     \textcolor{comment}{! * Check that invalid variable names are loaded from NAMELIST or not. }
23     \textcolor{comment}{! * Print registered variable names by "HistoryAutoAddVariable". }
24     \textcolor{comment}{!}
25     \textcolor{comment}{! If "HistoryAutoAddVariable" is called after this subroutine is called, }
26     \textcolor{comment}{! an error is occurred. }
27     \textcolor{comment}{!}
28     \textcolor{keywordtype}{use }gtool\_historyauto\_internal\textcolor{keywordtype}{, only}: initialized, numdims, numvars, &
29       & flag\_allvarfixed, gthst\_vars, gthstnml, save\_mpi\_gather, sub\_sname
30     \textcolor{keywordtype}{use }\hyperlink{namespacegtool__history__nmlinfo__generic}{gtool\_history\_nmlinfo\_generic}\textcolor{keywordtype}{, only}: 
      \hyperlink{interfacegtool__history__nmlinfo__generic_1_1hstnmlinfoallnamevalid}{hstnmlinfoallnamevalid}
31     \textcolor{keywordtype}{use }\hyperlink{namespacegtool__history}{gtool\_history}\textcolor{keywordtype}{, only}: historyvarinfoinquire
32     \textcolor{keywordtype}{use }dc\_trace\textcolor{keywordtype}{, only}: beginsub, endsub
33     \textcolor{keywordtype}{use }\hyperlink{namespacedc__error}{dc\_error}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}, \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}, 
      \hyperlink{namespacedc__error_a30736dc67a0d547ad912a1373fcedcbb}{hst\_ebadvarname}, \hyperlink{namespacedc__error_a31f1081213c338a4f6a6e5acdfe4a8a8}{dc\_enotinit}
34     \textcolor{keywordtype}{use }dc\_message\textcolor{keywordtype}{, only}: messagenotify
35     \textcolor{keywordtype}{use }\hyperlink{namespacedc__date}{dc\_date}\textcolor{keywordtype}{, only}: \textcolor{keyword}{operator}(*), \textcolor{keyword}{operator}(+)
36     \textcolor{keywordtype}{use }dc\_string\textcolor{keywordtype}{, only}: joinchar
37     \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}
38 
39     \textcolor{keywordtype}{implicit none}
40     \textcolor{keywordtype}{logical}:: allvar\_invalid
41                               \textcolor{comment}{! 無効な変数名のチェックフラグ. }
42                               \textcolor{comment}{! Check flag of invalid variable names. }
43 
44     \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{parameter}:: names\_limit = 100
45     \textcolor{keywordtype}{character(names\_limit)}:: names\_invalid
46                               \textcolor{comment}{! 無効な変数名. }
47                               \textcolor{comment}{! Invalid variable names. }
48 
49     \textcolor{keywordtype}{character(STRING)}:: name, units, longname, var\_info\_str
50     \textcolor{keywordtype}{character(TOKEN)}, \textcolor{keywordtype}{pointer}:: dims(:) =>null()
51     \textcolor{keywordtype}{integer}:: msnot\_rank
52     \textcolor{keywordtype}{integer}:: stat, i
53     \textcolor{keywordtype}{character(STRING)}:: cause\_c
54     \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{parameter}:: subname = \textcolor{stringliteral}{"HistoryAutoAllVarFix"}
55   \textcolor{keywordflow}{continue}
56     \textcolor{keyword}{call }beginsub(subname)
57     stat = \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}
58     cause\_c = \textcolor{stringliteral}{""}
59 
60     \textcolor{comment}{! 初期設定チェック}
61     \textcolor{comment}{! Check initialization}
62     \textcolor{comment}{!}
63     \textcolor{keywordflow}{if} ( .not. initialized ) \textcolor{keywordflow}{then}
64       stat = \hyperlink{namespacedc__error_a31f1081213c338a4f6a6e5acdfe4a8a8}{dc\_enotinit}
65       cause\_c = \textcolor{stringliteral}{'gtool\_historyauto'}
66       \textcolor{keywordflow}{goto} 999
67 \textcolor{keywordflow}{    end if}
68 
69     \textcolor{comment}{! 既に確定後であれば何もせずに終了. }
70     \textcolor{comment}{! Nothing is done after fixed}
71     \textcolor{comment}{!}
72     \textcolor{keywordflow}{if} ( flag\_allvarfixed ) \textcolor{keywordflow}{goto} 999
73 
74 
75     \textcolor{comment}{! 無効な変数名のチェック (初回のみ)}
76     \textcolor{comment}{! Check invalid variable names (at only first time)}
77     \textcolor{comment}{!}
78     \textcolor{keyword}{call }\hyperlink{interfacegtool__history__nmlinfo__generic_1_1hstnmlinfoallnamevalid}{hstnmlinfoallnamevalid}( &
79       & gthstnml = gthstnml, &               \textcolor{comment}{! (inout)}
80       & invalid = allvar\_invalid, names = names\_invalid ) \textcolor{comment}{! (out)}
81 
82     \textcolor{keywordflow}{if} ( len\_trim(names\_invalid) > (names\_limit - 5)  ) \textcolor{keywordflow}{then}
83       names\_invalid = names\_invalid(1:names\_limit - 5) // \textcolor{stringliteral}{' ....'}
84 \textcolor{keywordflow}{    end if}
85 
86     \textcolor{keywordflow}{if} ( allvar\_invalid ) \textcolor{keywordflow}{then}
87       stat = \hyperlink{namespacedc__error_a30736dc67a0d547ad912a1373fcedcbb}{hst\_ebadvarname}
88       cause\_c = names\_invalid
89       \textcolor{keyword}{call }messagenotify( \textcolor{stringliteral}{'W'}, subname, &
90         & \textcolor{stringliteral}{'names "%c" from NAMELIST "gtool\_historyauto\_nml" are invalid.'}, &
91         & c1 = trim(names\_invalid) )
92       \textcolor{keywordflow}{goto} 999
93 \textcolor{keywordflow}{    end if}
94 
95     \textcolor{comment}{! 登録された変数の印字 (初回のみ)}
96     \textcolor{comment}{! Print registered variables (at only first time)}
97     \textcolor{comment}{!}
98     msnot\_rank = -1
99     \textcolor{keywordflow}{if} ( save\_mpi\_gather ) msnot\_rank = 0
100     \textcolor{keyword}{call }messagenotify( \textcolor{stringliteral}{'M'}, sub\_sname, \textcolor{stringliteral}{'-------------------------------------------'}, rank\_mpi = 
      msnot\_rank )
101     \textcolor{keyword}{call }messagenotify( \textcolor{stringliteral}{'M'}, sub\_sname, \textcolor{stringliteral}{'----- Registered variables for output -----'}, rank\_mpi = 
      msnot\_rank )
102     \textcolor{keyword}{call }messagenotify( \textcolor{stringliteral}{'M'}, sub\_sname, \textcolor{stringliteral}{'-------------------------------------------'}, rank\_mpi = 
      msnot\_rank )
103 
104     \textcolor{keywordflow}{do} i = 1, numvars
105       \textcolor{keyword}{call }historyvarinfoinquire( &
106         & varinfo = gthst\_vars(i), &    \textcolor{comment}{! (in)}
107         & name = name, &                \textcolor{comment}{! (out) optional}
108         & dims = dims, &                \textcolor{comment}{! (out) optional}
109         & longname = longname, &        \textcolor{comment}{! (out) optional}
110         & units = units )               \textcolor{comment}{! (out) optional}
111 
112       var\_info\_str = trim( longname ) // \textcolor{stringliteral}{' ['} // &
113         &            trim( units ) // \textcolor{stringliteral}{'] \{'} // &
114         &            trim( joinchar( dims, \textcolor{stringliteral}{','} ) ) // \textcolor{stringliteral}{'\}'}
115       \textcolor{keyword}{deallocate}( dims )
116 
117       \textcolor{keyword}{call }messagenotify( \textcolor{stringliteral}{'M'}, sub\_sname, \textcolor{stringliteral}{'  %c  (%c)'}, &
118         & c1 = trim(name), c2 = trim(var\_info\_str), rank\_mpi = msnot\_rank )
119 
120 \textcolor{keywordflow}{    end do}
121     \textcolor{keyword}{call }messagenotify( \textcolor{stringliteral}{'M'}, sub\_sname, \textcolor{stringliteral}{'-----'}, rank\_mpi = msnot\_rank )
122 
123     \textcolor{comment}{! フラグの設定}
124     \textcolor{comment}{! Set a flag}
125     \textcolor{comment}{!}
126     \textcolor{keywordflow}{if} ( .not. flag\_allvarfixed ) flag\_allvarfixed = .true.
127 
128 999 \textcolor{keywordflow}{continue}
129     \textcolor{keyword}{call }\hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}(stat, subname, cause\_c = cause\_c)
130     \textcolor{keyword}{call }endsub(subname, \textcolor{stringliteral}{'stat=%d'}, i = (/stat/) )
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{historyautoallvarfix_8f90_ad862b9a0ef913e91a11fb4f08c26c5ca_cgraph}
\end{center}
\end{figure}
