\hypertarget{namespacegtdata__netcdf__internal}{}\section{gtdata\+\_\+netcdf\+\_\+internal Module Reference}
\label{namespacegtdata__netcdf__internal}\index{gtdata\+\_\+netcdf\+\_\+internal@{gtdata\+\_\+netcdf\+\_\+internal}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
integer function, public \hyperlink{namespacegtdata__netcdf__internal_ae0fc3a443b08733d689ce0aad981eb71}{vtable\+\_\+add} (var, entry)
\item 
integer function, public \hyperlink{namespacegtdata__netcdf__internal_a193eca614c0c9e2c4ef1e3ae6bb16f38}{vtable\+\_\+delete} (var)
\item 
integer function, public \hyperlink{namespacegtdata__netcdf__internal_afe013c8012ec100bf1e94e5147c340de}{vtable\+\_\+lookup} (var, entry)
\item 
integer function, public \hyperlink{namespacegtdata__netcdf__internal_ad13e0de15b03a99e92efa41868e52549}{vtable\+\_\+set\+\_\+attrid} (var, attrid)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacegtdata__netcdf__internal_ae0fc3a443b08733d689ce0aad981eb71}\label{namespacegtdata__netcdf__internal_ae0fc3a443b08733d689ce0aad981eb71}} 
\index{gtdata\+\_\+netcdf\+\_\+internal@{gtdata\+\_\+netcdf\+\_\+internal}!vtable\+\_\+add@{vtable\+\_\+add}}
\index{vtable\+\_\+add@{vtable\+\_\+add}!gtdata\+\_\+netcdf\+\_\+internal@{gtdata\+\_\+netcdf\+\_\+internal}}
\subsubsection{\texorpdfstring{vtable\+\_\+add()}{vtable\_add()}}
{\footnotesize\ttfamily integer function, public gtdata\+\_\+netcdf\+\_\+internal\+::vtable\+\_\+add (\begin{DoxyParamCaption}\item[{type(gd\+\_\+nc\+\_\+variable), intent(out)}]{var,  }\item[{type(gd\+\_\+nc\+\_\+variable\+\_\+search), intent(in)}]{entry }\end{DoxyParamCaption})}



Definition at line 34 of file gtdata\+\_\+netcdf\+\_\+internal.\+f90.


\begin{DoxyCode}
34     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}), \textcolor{keywordtype}{intent(out)}:: var
35     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable__search}{gd\_nc\_variable\_search}), \textcolor{keywordtype}{intent(in)}:: entry
36     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable__entry}{gd\_nc\_variable\_entry}), \textcolor{keywordtype}{allocatable}:: tmp\_table(:)
37     \textcolor{keywordtype}{integer}:: i, n
38 
39     \textcolor{comment}{! --- 必要なら初期確保 ---}
40     \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{allocated}(gdnctab)) \textcolor{keywordflow}{then}
41       \textcolor{keyword}{allocate}(gdnctab(gdnctab\_init\_size), stat=result)
42       \textcolor{keywordflow}{if} (result /= 0) \textcolor{keywordflow}{goto} 999
43       \textcolor{keywordflow}{do}, i = 1, gdnctab\_init\_size
44         gdnctab(i)%fileid = 0
45         gdnctab(i)%varid = 0
46         gdnctab(i)%dimid = 0
47         gdnctab(i)%attrid = 0
48         \textcolor{keyword}{nullify}(gdnctab(i)%dimids)
49 \textcolor{keywordflow}{      enddo}
50 \textcolor{keywordflow}{    endif}
51     \textcolor{comment}{! --- 同じ内容が既登録ならばそれを返す (attrid は変更しない) ---}
52     \textcolor{keywordflow}{do}, i = 1, \textcolor{keyword}{size}(gdnctab)
53       \textcolor{keywordflow}{if} (gdnctab(i)%fileid == entry%fileid &
54         & .and. gdnctab(i)%varid == entry%varid &
55         & .and. gdnctab(i)%dimid == entry%dimid) \textcolor{keywordflow}{then}
56         var = \hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}(i)
57         result = nf90\_noerr
58         \textcolor{keyword}{call }dbgmessage(\textcolor{stringliteral}{'gtdata\_netcdf\_internal.add: found %d'}, i=(/i/))
59         \textcolor{keywordflow}{return}
60 \textcolor{keywordflow}{      endif}
61 \textcolor{keywordflow}{    enddo}
62     \textcolor{comment}{!}
63     \textcolor{comment}{! --- 空き地があればそこに割り当て ---}
64     var = \hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}(-1)
65     \textcolor{keywordflow}{do}, i = 1, \textcolor{keyword}{size}(gdnctab)
66       \textcolor{keywordflow}{if} (gdnctab(i)%fileid == 0) \textcolor{keywordflow}{then}
67         var = \hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}(i)
68         \textcolor{keywordflow}{exit}
69 \textcolor{keywordflow}{      endif}
70 \textcolor{keywordflow}{    enddo}
71     \textcolor{keywordflow}{if} (var%id == -1) \textcolor{keywordflow}{then}
72       \textcolor{comment}{! --- 空き地はなかったのだから倍幅確保 ---}
73       n = \textcolor{keyword}{size}(gdnctab)
74       \textcolor{keyword}{allocate}(tmp\_table(n), stat=result)
75       \textcolor{keywordflow}{if} (result /= 0) \textcolor{keywordflow}{goto} 999
76       tmp\_table(:) = gdnctab(:)
77       \textcolor{keyword}{deallocate}(gdnctab, stat=result)
78       \textcolor{keywordflow}{if} (result /= 0) \textcolor{keywordflow}{goto} 999
79       \textcolor{keyword}{allocate}(gdnctab(n * 2), stat=result)
80       \textcolor{keywordflow}{if} (result /= 0) \textcolor{keywordflow}{goto} 999
81       gdnctab(1:n) = tmp\_table(1:n)
82       \textcolor{keyword}{deallocate}(tmp\_table, stat=result)
83       \textcolor{keywordflow}{if} (result /= 0) \textcolor{keywordflow}{goto} 999
84       \textcolor{comment}{!}
85       gdnctab(n+2)%fileid = 0
86       gdnctab(n+2)%varid = 0
87       gdnctab(n+2)%dimid = 0
88       gdnctab(n+2)%attrid = 0
89       \textcolor{keyword}{nullify}(gdnctab(n+2)%dimids)
90       gdnctab(n+3: n*2) = gdnctab(n+2)
91       \textcolor{comment}{! 確保域の先頭を使用}
92       var = \hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}(n + 1)
93 \textcolor{keywordflow}{    endif}
94     gdnctab(var%id)%fileid = entry%fileid
95     gdnctab(var%id)%varid = entry%varid
96     gdnctab(var%id)%dimid = entry%dimid
97     \textcolor{comment}{!}
98     \textcolor{comment}{! --- 次元表の確保 ---}
99     \textcolor{keyword}{call }internal\_build\_dimids(gdnctab(var%id), result)
100     \textcolor{keywordflow}{if} (result /= nf90\_noerr) \textcolor{keywordflow}{goto} 999
101     \textcolor{comment}{!}
102     result = nf90\_noerr
103     \textcolor{keyword}{call }dbgmessage(\textcolor{stringliteral}{'gtdata\_netcdf\_internal.add: added %d'}, i=(/var%id/))
104     \textcolor{keywordflow}{return}
105     \textcolor{comment}{!}
106 999 \textcolor{keywordflow}{continue}
107     var = \hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}(-1)
108     result = nf90\_enomem
109     \textcolor{keywordflow}{return}
110 
111   \textcolor{keyword}{contains}
112 
113 \textcolor{keyword}{    subroutine }internal\_build\_dimids(ent, stat)
114 \textcolor{comment}{!!      use netcdf, only: &}
115 \textcolor{comment}{!!        & NF90\_NOERR, NF90\_ENOMEM, NF90\_INQUIRE\_VARIABLE}
116       \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable__entry}{gd\_nc\_variable\_entry}), \textcolor{keywordtype}{intent(inout)}:: ent
117       \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(out)}:: stat
118       \textcolor{keywordtype}{integer}:: ndims
119       \textcolor{keywordflow}{if} (ent%varid > 0) \textcolor{keywordflow}{then}
120         stat = nf90\_inquire\_variable(ent%fileid, ent%varid, ndims = ndims)
121         \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{return}
122         \textcolor{keywordflow}{if} ((ent%dimid > 0) .and. (ndims /= 1)) \textcolor{keywordflow}{goto} 100
123         \textcolor{keywordflow}{if} (ndims == 0) \textcolor{keywordflow}{then}
124           \textcolor{keyword}{nullify}(ent%dimids)
125           stat = nf90\_noerr
126           \textcolor{keywordflow}{return}
127 \textcolor{keywordflow}{        endif}
128         \textcolor{keyword}{allocate}(ent%dimids(ndims), stat=stat)
129         \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{then}
130           stat = nf90\_enomem
131           \textcolor{keywordflow}{return}
132 \textcolor{keywordflow}{        endif}
133         stat = nf90\_inquire\_variable(ent%fileid, ent%varid, dimids = ent%dimids)
134         \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{return}
135         \textcolor{keywordflow}{if} ((ent%dimid > 0) .and. (ent%dimids(1) /= ent%dimid)) \textcolor{keywordflow}{then}
136           \textcolor{keyword}{deallocate}(ent%dimids)
137           \textcolor{keywordflow}{goto} 100
138 \textcolor{keywordflow}{        endif}
139       \textcolor{keywordflow}{else}
140         \textcolor{keyword}{allocate}(ent%dimids(1), stat=stat)
141         \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{then}
142           stat = nf90\_enomem
143           \textcolor{keywordflow}{return}
144 \textcolor{keywordflow}{        endif}
145         ent%dimids(1) = ent%dimid
146 \textcolor{keywordflow}{      endif}
147       stat = nf90\_noerr
148       \textcolor{keywordflow}{return}
149 
150 100   \textcolor{keywordflow}{continue}
151       ent%varid = 0
152       \textcolor{keyword}{allocate}(ent%dimids(1))
153       ent%dimids(1) = ent%dimid
154 \textcolor{keyword}{    end subroutine }internal\_build\_dimids
155 
\end{DoxyCode}
\mbox{\Hypertarget{namespacegtdata__netcdf__internal_a193eca614c0c9e2c4ef1e3ae6bb16f38}\label{namespacegtdata__netcdf__internal_a193eca614c0c9e2c4ef1e3ae6bb16f38}} 
\index{gtdata\+\_\+netcdf\+\_\+internal@{gtdata\+\_\+netcdf\+\_\+internal}!vtable\+\_\+delete@{vtable\+\_\+delete}}
\index{vtable\+\_\+delete@{vtable\+\_\+delete}!gtdata\+\_\+netcdf\+\_\+internal@{gtdata\+\_\+netcdf\+\_\+internal}}
\subsubsection{\texorpdfstring{vtable\+\_\+delete()}{vtable\_delete()}}
{\footnotesize\ttfamily integer function, public gtdata\+\_\+netcdf\+\_\+internal\+::vtable\+\_\+delete (\begin{DoxyParamCaption}\item[{type(gd\+\_\+nc\+\_\+variable), intent(in)}]{var }\end{DoxyParamCaption})}



Definition at line 161 of file gtdata\+\_\+netcdf\+\_\+internal.\+f90.


\begin{DoxyCode}
161     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}), \textcolor{keywordtype}{intent(in)}:: var
162     \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{allocated}(gdnctab)) \textcolor{keywordflow}{goto} 999
163     \textcolor{keywordflow}{if} (var%id <= 0 .or. var%id > \textcolor{keyword}{size}(gdnctab)) \textcolor{keywordflow}{goto} 999
164     \textcolor{keywordflow}{if} (gdnctab(var%id)%fileid == 0) \textcolor{keywordflow}{goto} 999
165     result = gdnctab(var%id)%fileid
166     gdnctab(var%id)%fileid = 0
167     gdnctab(var%id)%varid = 0
168     gdnctab(var%id)%dimid = 0
169     gdnctab(var%id)%attrid = 0
170     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(gdnctab(var%id)%dimids)) &
171       & \textcolor{keyword}{deallocate}(gdnctab(var%id)%dimids)
172     \textcolor{keyword}{call }dbgmessage(\textcolor{stringliteral}{'gtdata\_netcdf\_internal.delete: delete %d'}, i=(/var%id/))
173     \textcolor{keywordflow}{return}
174     \textcolor{comment}{!}
175 999 \textcolor{keywordflow}{continue}
176     result = nf90\_enotvar
\end{DoxyCode}
\mbox{\Hypertarget{namespacegtdata__netcdf__internal_afe013c8012ec100bf1e94e5147c340de}\label{namespacegtdata__netcdf__internal_afe013c8012ec100bf1e94e5147c340de}} 
\index{gtdata\+\_\+netcdf\+\_\+internal@{gtdata\+\_\+netcdf\+\_\+internal}!vtable\+\_\+lookup@{vtable\+\_\+lookup}}
\index{vtable\+\_\+lookup@{vtable\+\_\+lookup}!gtdata\+\_\+netcdf\+\_\+internal@{gtdata\+\_\+netcdf\+\_\+internal}}
\subsubsection{\texorpdfstring{vtable\+\_\+lookup()}{vtable\_lookup()}}
{\footnotesize\ttfamily integer function, public gtdata\+\_\+netcdf\+\_\+internal\+::vtable\+\_\+lookup (\begin{DoxyParamCaption}\item[{type(gd\+\_\+nc\+\_\+variable), intent(in)}]{var,  }\item[{type(gd\+\_\+nc\+\_\+variable\+\_\+entry), intent(out)}]{entry }\end{DoxyParamCaption})}



Definition at line 180 of file gtdata\+\_\+netcdf\+\_\+internal.\+f90.


\begin{DoxyCode}
180     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}), \textcolor{keywordtype}{intent(in)}:: var
181     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable__entry}{gd\_nc\_variable\_entry}), \textcolor{keywordtype}{intent(out)}:: entry
182     \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{allocated}(gdnctab)) \textcolor{keywordflow}{goto} 999
183     \textcolor{keywordflow}{if} (var%id <= 0 .or. var%id > \textcolor{keyword}{size}(gdnctab)) \textcolor{keywordflow}{goto} 999
184     \textcolor{keywordflow}{if} (gdnctab(var%id)%fileid == 0) \textcolor{keywordflow}{goto} 999
185     entry = gdnctab(var%id)
186     result = nf90\_noerr
187     \textcolor{keywordflow}{return}
188     \textcolor{comment}{!}
189 999 \textcolor{keywordflow}{continue}
190     \textcolor{keyword}{nullify}(entry%dimids)
191     entry%fileid = -1
192     entry%varid = -1
193     entry%dimid = -1
194     entry%attrid = -1
195     result = nf90\_enotvar
\end{DoxyCode}
\mbox{\Hypertarget{namespacegtdata__netcdf__internal_ad13e0de15b03a99e92efa41868e52549}\label{namespacegtdata__netcdf__internal_ad13e0de15b03a99e92efa41868e52549}} 
\index{gtdata\+\_\+netcdf\+\_\+internal@{gtdata\+\_\+netcdf\+\_\+internal}!vtable\+\_\+set\+\_\+attrid@{vtable\+\_\+set\+\_\+attrid}}
\index{vtable\+\_\+set\+\_\+attrid@{vtable\+\_\+set\+\_\+attrid}!gtdata\+\_\+netcdf\+\_\+internal@{gtdata\+\_\+netcdf\+\_\+internal}}
\subsubsection{\texorpdfstring{vtable\+\_\+set\+\_\+attrid()}{vtable\_set\_attrid()}}
{\footnotesize\ttfamily integer function, public gtdata\+\_\+netcdf\+\_\+internal\+::vtable\+\_\+set\+\_\+attrid (\begin{DoxyParamCaption}\item[{type(gd\+\_\+nc\+\_\+variable), intent(in)}]{var,  }\item[{integer, intent(in)}]{attrid }\end{DoxyParamCaption})}



Definition at line 199 of file gtdata\+\_\+netcdf\+\_\+internal.\+f90.


\begin{DoxyCode}
199     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}), \textcolor{keywordtype}{intent(in)}:: var
200     \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}:: attrid
201     \textcolor{keywordflow}{continue}
202     \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{allocated}(gdnctab)) \textcolor{keywordflow}{goto} 999
203     \textcolor{keywordflow}{if} (var%id <= 0 .or. var%id > \textcolor{keyword}{size}(gdnctab)) \textcolor{keywordflow}{goto} 999
204     \textcolor{keywordflow}{if} (gdnctab(var%id)%fileid == 0) \textcolor{keywordflow}{goto} 999
205     gdnctab(var%id)%attrid = attrid
206     result = nf90\_noerr
207     \textcolor{keywordflow}{return}
208     \textcolor{comment}{!}
209 999 \textcolor{keywordflow}{continue}
210     result = nf90\_enotvar
\end{DoxyCode}
