\hypertarget{gtvaradddim_8f90}{}\section{gtdata/gtvaradddim.f90 File Reference}
\label{gtvaradddim_8f90}\index{gtdata/gtvaradddim.\+f90@{gtdata/gtvaradddim.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{gtvaradddim_8f90_ab4cf8b294912ceca560487a119aa11bf}{gtvaradddim} (var, dimord, dimvar, err)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{gtvaradddim_8f90_ab4cf8b294912ceca560487a119aa11bf}\label{gtvaradddim_8f90_ab4cf8b294912ceca560487a119aa11bf}} 
\index{gtvaradddim.\+f90@{gtvaradddim.\+f90}!gtvaradddim@{gtvaradddim}}
\index{gtvaradddim@{gtvaradddim}!gtvaradddim.\+f90@{gtvaradddim.\+f90}}
\subsubsection{\texorpdfstring{gtvaradddim()}{gtvaradddim()}}
{\footnotesize\ttfamily subroutine gtvaradddim (\begin{DoxyParamCaption}\item[{type(gt\+\_\+variable), intent(in)}]{var,  }\item[{integer, intent(in)}]{dimord,  }\item[{type(gt\+\_\+variable), intent(in)}]{dimvar,  }\item[{logical, intent(out)}]{err }\end{DoxyParamCaption})}



Definition at line 14 of file gtvaradddim.\+f90.



References gtdata\+\_\+internal\+\_\+map\+::map\+\_\+lookup(), gtdata\+\_\+internal\+\_\+map\+::map\+\_\+resize(), gtdata\+\_\+internal\+\_\+map\+::map\+\_\+set(), and gtdata\+\_\+internal\+\_\+map\+::map\+\_\+set\+\_\+ndims().


\begin{DoxyCode}
14   \textcolor{comment}{!}
15   \textcolor{comment}{!== 次元の追加}
16   \textcolor{comment}{!}
17   \textcolor{comment}{! 変数 *var* の *dimord* 番目の位置に次元 *dimvar*}
18   \textcolor{comment}{! を追加します。*dimord* 番目以降の次元は 1 つ後ろにずれます。}
19   \textcolor{comment}{! もし *dimord* が *var* の有効次元数よりも大きい場合、}
20   \textcolor{comment}{! (有効次元数 + 1) が与えられたものと見なされます。}
21   \textcolor{comment}{!}
22   \textcolor{comment}{! エラーが生じた場合、メッセージを出力}
23   \textcolor{comment}{! してプログラムは強制終了します。*err* を与えてある場合には}
24   \textcolor{comment}{! の引数に .true. が返り、プログラムは終了しません。}
25   \textcolor{comment}{!}
26   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__types}{gtdata\_types}\textcolor{keywordtype}{, only}: gt\_variable
27   \textcolor{keywordtype}{use }gtdata\_generic\textcolor{keywordtype}{, only}: \hyperlink{interfacegtdata__netcdf__generic_1_1inquire}{inquire}
28   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__internal__map}{gtdata\_internal\_map}\textcolor{keywordtype}{, only}: \hyperlink{namespacegtdata__internal__map_a076911f777be03f10a2c024dac7efdad}{map\_lookup}, 
      \hyperlink{structgtdata__internal__map_1_1gt__dimmap}{gt\_dimmap}, \hyperlink{namespacegtdata__internal__map_a12dffe35d93120bca94db15c47818ae1}{map\_set\_ndims}, \hyperlink{namespacegtdata__internal__map_a2e6a789c1c8f4850421da11f10081cb7}{map\_set}, \hyperlink{namespacegtdata__internal__map_ae904583b5f08e47440b3d0dc46996b22}{map\_resize}
29   \textcolor{keywordtype}{use }dc\_trace\textcolor{keywordtype}{, only}: beginsub, endsub, dbgmessage
30   \textcolor{keywordtype}{implicit none}
31   \textcolor{keywordtype}{type}(gt\_variable), \textcolor{keywordtype}{intent(in)}:: var
32   \textcolor{keywordtype}{type}(gt\_variable), \textcolor{keywordtype}{intent(in)}:: dimvar
33   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}:: dimord
34   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)}:: err
35   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__internal__map_1_1gt__dimmap}{gt\_dimmap}), \textcolor{keywordtype}{pointer}:: map(:)
36   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__internal__map_1_1gt__dimmap}{gt\_dimmap}):: tmpmap
37   \textcolor{keywordtype}{integer}:: id, nd, ndimsp, stat, vid
38   \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{parameter}:: subname = \textcolor{stringliteral}{'GTVarAddDim'}
39 \textcolor{keywordflow}{continue}
40   err = .true.
41   \textcolor{keyword}{call }beginsub(subname)
42 
43   \textcolor{keywordflow}{if} (dimord < 1) \textcolor{keywordflow}{then}
44     \textcolor{keyword}{call }endsub(subname, \textcolor{stringliteral}{"negative dimord=%d invalid"}, i=(/dimord/))
45     \textcolor{keywordflow}{return}
46 \textcolor{keywordflow}{  endif}
47 
48   \textcolor{comment}{! dimvar をチェックしマップ設定を tmpmap に保存}
49   \textcolor{keyword}{call }\hyperlink{namespacegtdata__internal__map_a076911f777be03f10a2c024dac7efdad}{map\_lookup}(dimvar, vid=vid, ndims=nd)
50   \textcolor{keywordflow}{if} (vid < 0) \textcolor{keywordflow}{then}
51     \textcolor{keyword}{call }endsub(subname, \textcolor{stringliteral}{"dimvar invalid"})
52     \textcolor{keywordflow}{return}
53 \textcolor{keywordflow}{  endif}
54   \textcolor{keywordflow}{if} (nd <= 0) \textcolor{keywordflow}{then}
55     \textcolor{keyword}{call }endsub(subname, \textcolor{stringliteral}{"dimvar nondimensional"})
56     \textcolor{keywordflow}{return}
57   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (nd > 1) \textcolor{keywordflow}{then}
58     \textcolor{keyword}{call }endsub(subname, \textcolor{stringliteral}{"dimvar multidimensional"})
59     \textcolor{keywordflow}{return}
60 \textcolor{keywordflow}{  endif}
61   \textcolor{keyword}{allocate}(map(nd))
62   \textcolor{keyword}{call }\hyperlink{namespacegtdata__internal__map_a076911f777be03f10a2c024dac7efdad}{map\_lookup}(dimvar, map=map)
63   tmpmap = map(1)
64   \textcolor{keyword}{deallocate}(map)
65 
66   \textcolor{comment}{! dimord 番目 (ただし ndimsp + 1 を越えない) に挿入する隙間をあける}
67   \textcolor{keyword}{call }\hyperlink{namespacegtdata__internal__map_a076911f777be03f10a2c024dac7efdad}{map\_lookup}(var, ndims=ndimsp)
68   \textcolor{keywordflow}{if} (dimord > ndimsp + 1) \textcolor{keywordflow}{then}
69     id = ndimsp + 1
70   \textcolor{keywordflow}{else}
71     id = dimord
72 \textcolor{keywordflow}{  endif}
73   \textcolor{keyword}{allocate}(map(nd + 1))
74   \textcolor{keyword}{call }\hyperlink{namespacegtdata__internal__map_ae904583b5f08e47440b3d0dc46996b22}{map\_resize}(var, nd + 1)
75   \textcolor{keyword}{call }\hyperlink{namespacegtdata__internal__map_a076911f777be03f10a2c024dac7efdad}{map\_lookup}(var, map=map)
76   map(id+1: nd+1) = map(id: nd)
77 
78   \textcolor{comment}{! 新しい次元への参照を挿入}
79   map(id)%dimno = -1
80   \textcolor{keyword}{call }\hyperlink{interfacegtdata__netcdf__generic_1_1inquire}{inquire}(dimvar, url=map(id)%url)
81   map(id)%allcount = tmpmap%allcount
82   map(id)%offset = tmpmap%offset
83   map(id)%step = tmpmap%step
84   map(id)%start = tmpmap%start
85   map(id)%count = tmpmap%count
86   map(id)%stride = tmpmap%stride
87 
88   \textcolor{comment}{! 登録}
89   \textcolor{keyword}{call }\hyperlink{namespacegtdata__internal__map_a2e6a789c1c8f4850421da11f10081cb7}{map\_set}(var, map=map, stat=stat)
90   \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{goto} 999
91   \textcolor{keyword}{call }\hyperlink{namespacegtdata__internal__map_a12dffe35d93120bca94db15c47818ae1}{map\_set\_ndims}(var, ndims=ndimsp + 1, stat=stat)
92 
93 999 \textcolor{keywordflow}{continue}
94   err = (stat /= 0)
95   \textcolor{keyword}{call }endsub(subname)
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gtvaradddim_8f90_ab4cf8b294912ceca560487a119aa11bf_cgraph}
\end{center}
\end{figure}
