\hypertarget{gtvarcreatecopy_8f90}{}\section{gtdata/gtvarcreatecopy.f90 File Reference}
\label{gtvarcreatecopy_8f90}\index{gtdata/gtvarcreatecopy.\+f90@{gtdata/gtvarcreatecopy.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{gtvarcreatecopy_8f90_a0e91496e14616d74934d7d16a5c1b695}{gtvarcreatecopyc} (var, url, copyfrom, copyvalue, overwrite, err)
\item 
subroutine \hyperlink{gtvarcreatecopy_8f90_aea83607e3b2c767b141e9b0edd10b475}{gtvarcopydim} (to, from, target)
\item 
logical function \hyperlink{gtvarcreatecopy_8f90_a7e0e99bda877a6d9e1abe41150d6fa81}{lookupequivalent} (to, from, file)
\item 
subroutine \hyperlink{gtvarcreatecopy_8f90_aedbce7439a6d5e9f94c7bdf119576b65}{gtvarcopyvalue} (to, from)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{gtvarcreatecopy_8f90_aea83607e3b2c767b141e9b0edd10b475}\label{gtvarcreatecopy_8f90_aea83607e3b2c767b141e9b0edd10b475}} 
\index{gtvarcreatecopy.\+f90@{gtvarcreatecopy.\+f90}!gtvarcopydim@{gtvarcopydim}}
\index{gtvarcopydim@{gtvarcopydim}!gtvarcreatecopy.\+f90@{gtvarcreatecopy.\+f90}}
\subsubsection{\texorpdfstring{gtvarcopydim()}{gtvarcopydim()}}
{\footnotesize\ttfamily subroutine gtvarcreatecopyc\+::gtvarcopydim (\begin{DoxyParamCaption}\item[{type(\hyperlink{structgtdata__types_1_1gt__variable}{gt\+\_\+variable}), intent(out)}]{to,  }\item[{type(\hyperlink{structgtdata__types_1_1gt__variable}{gt\+\_\+variable}), intent(inout)}]{from,  }\item[{character(len = $\ast$), intent(in)}]{target }\end{DoxyParamCaption})}



Definition at line 127 of file gtvarcreatecopy.\+f90.



References dc\+\_\+trace\+::beginsub(), dc\+\_\+trace\+::endsub(), gtvarcopyvalue(), lookupequivalent(), dc\+\_\+types\+::string, and dc\+\_\+types\+::token.



Referenced by gtvarcreatecopyc().


\begin{DoxyCode}
127     \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__types}{gtdata\_types}
128     \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_a6d28eb015ba84292a06f4ff25165b376}{token}, \hyperlink{namespacedc__types_adb76910ff05e3b9fe3436567f8f8dac6}{string}
129     \textcolor{keywordtype}{use }\hyperlink{namespacedc__url}{dc\_url}\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__url_1_1urlsplit}{urlsplit}, \hyperlink{interfacedc__url_1_1urlmerge}{urlmerge}, \textcolor{keyword}{operator}(.onthesamefile.)
130     \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__generic}{gtdata\_generic}\textcolor{keywordtype}{, only}: \hyperlink{interfacegtdata__generic_1_1open}{open}, \hyperlink{interfacegtdata__generic_1_1inquire}{inquire}, \hyperlink{interfacegtdata__generic_1_1create}{create}, 
      \hyperlink{interfacegtdata__generic_1_1copy__attr}{copy\_attr}
131     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}), \textcolor{keywordtype}{intent(out)}:: to
132     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}), \textcolor{keywordtype}{intent(inout)}:: from
133     \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{intent(in)}:: target
134     \textcolor{keywordtype}{character(len = string)}:: url, file, dimname
135     \textcolor{keywordtype}{character(len = token)}:: xtype
136     \textcolor{keywordtype}{logical}:: growable, myerr
137     \textcolor{keywordtype}{integer}:: length
138   \textcolor{keywordflow}{continue}
139     \textcolor{keyword}{call }\hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}(\textcolor{stringliteral}{'gtvarcopydim'}, \textcolor{stringliteral}{'from=%d target=<%c>'}, &
140       & i=(/from%mapid/), c1=trim(\textcolor{keywordtype}{target}))
141     \textcolor{comment}{!----- 同じファイル上にコピーする場合は参照カウンタを1つ回すだけ -----}
142     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(var=from, url=url)
143     \textcolor{keywordflow}{if} (trim(url) .onthesamefile. trim(\textcolor{keywordtype}{target})) \textcolor{keywordflow}{then}
144       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1open}{open}(to, from, dimord=0)
145       \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(\textcolor{stringliteral}{'gtvarcopydim'}, \textcolor{stringliteral}{'dup-handle'})
146       \textcolor{keywordflow}{return}
147 \textcolor{keywordflow}{    endif}
148     \textcolor{comment}{!----- 異なるファイル上にコピーする場合, 既に次元変数 from が -----}
149     \textcolor{comment}{!----- target の次元変数として含まれるかチェック              -----}
150     \textcolor{keyword}{call }\hyperlink{interfacedc__url_1_1urlsplit}{urlsplit}(\textcolor{keywordtype}{target}, file=file)
151     \textcolor{keywordflow}{if} (\hyperlink{gtvarcreatecopy_8f90_a7e0e99bda877a6d9e1abe41150d6fa81}{lookupequivalent}(to, from, file)) \textcolor{keywordflow}{then}
152       \textcolor{comment}{!----- 含まれる場合はそれで終了 -----}
153       \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(\textcolor{stringliteral}{'gtvarcopydim'}, \textcolor{stringliteral}{'equivalent-exists'})
154       \textcolor{keywordflow}{return}
155     \textcolor{keywordflow}{else}
156       \textcolor{comment}{!----- 含まれない場合次元変数 from を target 上に作成 -----}
157       \textcolor{comment}{! 次元変数 from が無制限次元である場合には長さを 0 に}
158       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(var=from, growable=growable, allcount=length)
159       \textcolor{keywordflow}{if} (growable) length = 0
160       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(var=from, xtype=xtype, name=dimname)
161       \textcolor{comment}{!}
162       url = \hyperlink{interfacedc__url_1_1urlmerge}{urlmerge}(file, dimname)
163       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1create}{create}(to, trim(url), length, xtype, err=myerr)
164       \textcolor{keywordflow}{if} (myerr) \textcolor{keywordflow}{then}
165         \textcolor{comment}{! 指定名称でうまくいかない場合は自動生成名にする}
166         \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1create}{create}(to, trim(file), length, xtype)
167 \textcolor{keywordflow}{      endif}
168       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1copy__attr}{copy\_attr}(to, from, myerr)
169       \textcolor{keyword}{call }\hyperlink{gtvarcreatecopy_8f90_aedbce7439a6d5e9f94c7bdf119576b65}{gtvarcopyvalue}(to, from)
170       \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(\textcolor{stringliteral}{'gtvarcopydim'}, \textcolor{stringliteral}{'created'})
171       \textcolor{keywordflow}{return}
172 \textcolor{keywordflow}{    endif}
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gtvarcreatecopy_8f90_aea83607e3b2c767b141e9b0edd10b475_cgraph}
\end{center}
\end{figure}
Here is the caller graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=283pt]{gtvarcreatecopy_8f90_aea83607e3b2c767b141e9b0edd10b475_icgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{gtvarcreatecopy_8f90_aedbce7439a6d5e9f94c7bdf119576b65}\label{gtvarcreatecopy_8f90_aedbce7439a6d5e9f94c7bdf119576b65}} 
\index{gtvarcreatecopy.\+f90@{gtvarcreatecopy.\+f90}!gtvarcopyvalue@{gtvarcopyvalue}}
\index{gtvarcopyvalue@{gtvarcopyvalue}!gtvarcreatecopy.\+f90@{gtvarcreatecopy.\+f90}}
\subsubsection{\texorpdfstring{gtvarcopyvalue()}{gtvarcopyvalue()}}
{\footnotesize\ttfamily subroutine gtvarcreatecopyc\+::gtvarcopyvalue (\begin{DoxyParamCaption}\item[{type(\hyperlink{structgtdata__types_1_1gt__variable}{gt\+\_\+variable}), intent(inout)}]{to,  }\item[{type(\hyperlink{structgtdata__types_1_1gt__variable}{gt\+\_\+variable}), intent(inout)}]{from }\end{DoxyParamCaption})}



Definition at line 249 of file gtvarcreatecopy.\+f90.



References dc\+\_\+trace\+::beginsub(), dumperror(), dc\+\_\+trace\+::endsub(), gtvargetreal(), and gtvarputreal().



Referenced by gtvarcopydim(), and gtvarcreatecopyc().


\begin{DoxyCode}
249     \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__types}{gtdata\_types}\textcolor{keywordtype}{, only}: \hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}
250     \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__generic}{gtdata\_generic}\textcolor{keywordtype}{, only}: \hyperlink{gtvargetnum_8f90_ad255a6d133cc9c0f837db05499f4d7d1}{gtvargetreal}, 
      \hyperlink{gtvarputnum_8f90_a78aab646e5ea1306ebfbabb3f9371722}{gtvarputreal}, \hyperlink{interfacegtdata__generic_1_1inquire}{inquire}, \hyperlink{interfacegtdata__generic_1_1slice}{slice}, \hyperlink{interfacegtdata__generic_1_1slice__next}{slice\_next}
251     \textcolor{keywordtype}{use }\hyperlink{namespacedc__error}{dc\_error}\textcolor{keywordtype}{, only}: \hyperlink{dc__error_8f90_a805edc2691c008aded6c82bc8d28d99e}{dumperror}
252     \textcolor{keywordtype}{use }\hyperlink{namespacedc__string}{dc\_string}
253     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}), \textcolor{keywordtype}{intent(inout)}:: to
254     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}), \textcolor{keywordtype}{intent(inout)}:: from
255     \textcolor{keywordtype}{real}, \textcolor{keywordtype}{allocatable}:: rbuffer(:)
256     \textcolor{keywordtype}{logical}:: err
257     \textcolor{keywordtype}{integer}:: siz, stat
258     \textcolor{comment}{!}
259     \textcolor{keyword}{call }\hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}(\textcolor{stringliteral}{'gtvarcopyvalue'})
260     \textcolor{comment}{! 値のコピー}
261     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1slice}{slice}(from)
262     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1slice}{slice}(to, compatible=from)
263     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(from, size=siz)
264     \textcolor{keyword}{allocate} (rbuffer(siz))
265     \textcolor{keywordflow}{do}
266       \textcolor{keyword}{call }\hyperlink{gtvargetnum_8f90_ad255a6d133cc9c0f837db05499f4d7d1}{gtvargetreal}(from, rbuffer, siz, err)
267       \textcolor{keywordflow}{if} (err) \textcolor{keyword}{call }\hyperlink{dc__error_8f90_a805edc2691c008aded6c82bc8d28d99e}{dumperror}()
268       \textcolor{keyword}{call }\hyperlink{gtvarputnum_8f90_a78aab646e5ea1306ebfbabb3f9371722}{gtvarputreal}(to, rbuffer, siz, err)
269       \textcolor{keywordflow}{if} (err) \textcolor{keyword}{call }\hyperlink{dc__error_8f90_a805edc2691c008aded6c82bc8d28d99e}{dumperror}()
270       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1slice__next}{slice\_next}(from, stat=stat)
271       \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit}
272       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1slice__next}{slice\_next}(to, stat=stat)
273 \textcolor{keywordflow}{    enddo}
274     \textcolor{keyword}{deallocate} (rbuffer)
275     \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(\textcolor{stringliteral}{'gtvarcopyvalue'})
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gtvarcreatecopy_8f90_aedbce7439a6d5e9f94c7bdf119576b65_cgraph}
\end{center}
\end{figure}
Here is the caller graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gtvarcreatecopy_8f90_aedbce7439a6d5e9f94c7bdf119576b65_icgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{gtvarcreatecopy_8f90_a0e91496e14616d74934d7d16a5c1b695}\label{gtvarcreatecopy_8f90_a0e91496e14616d74934d7d16a5c1b695}} 
\index{gtvarcreatecopy.\+f90@{gtvarcreatecopy.\+f90}!gtvarcreatecopyc@{gtvarcreatecopyc}}
\index{gtvarcreatecopyc@{gtvarcreatecopyc}!gtvarcreatecopy.\+f90@{gtvarcreatecopy.\+f90}}
\subsubsection{\texorpdfstring{gtvarcreatecopyc()}{gtvarcreatecopyc()}}
{\footnotesize\ttfamily subroutine gtvarcreatecopyc (\begin{DoxyParamCaption}\item[{type(\hyperlink{structgtdata__types_1_1gt__variable}{gt\+\_\+variable}), intent(out)}]{var,  }\item[{character(len = $\ast$), intent(in)}]{url,  }\item[{type(\hyperlink{structgtdata__types_1_1gt__variable}{gt\+\_\+variable}), intent(inout)}]{copyfrom,  }\item[{logical, intent(in), optional}]{copyvalue,  }\item[{logical, intent(in), optional}]{overwrite,  }\item[{logical, intent(out), optional}]{err }\end{DoxyParamCaption})}



Definition at line 15 of file gtvarcreatecopy.\+f90.



References dc\+\_\+trace\+::beginsub(), dumperror(), dc\+\_\+trace\+::endsub(), dc\+\_\+url\+::gt\+\_\+atmark, dc\+\_\+error\+::gt\+\_\+enomem, gtvarcopydim(), gtvarcopyvalue(), dc\+\_\+error\+::storeerror(), dc\+\_\+types\+::string, and dc\+\_\+types\+::token.


\begin{DoxyCode}
15   \textcolor{comment}{!}
16   \textcolor{comment}{!== 変数のコピー}
17   \textcolor{comment}{!}
18   \textcolor{comment}{! 変数 *copyfrom* と同じ次元、属性を持った変数を *url* に作成します。}
19   \textcolor{comment}{! 必要ならば次元変数も複製されます。}
20   \textcolor{comment}{! *copyvalue* を <tt>.true.</tt> に指定すると値も複製されます。}
21   \textcolor{comment}{! 作成された変数の ID は var に返されます。}
22   \textcolor{comment}{!}
23   \textcolor{comment}{! 既存変数があるとき失敗しますが、}
24   \textcolor{comment}{! overwrite == .true. であれば上書きして続行します。}
25   \textcolor{comment}{! (まだ *overwrite* の動作は保障されていません)。}
26   \textcolor{comment}{!}
27   \textcolor{comment}{! 作成の際にエラーが生じた場合、メッセージを出力してプログラムは}
28   \textcolor{comment}{! 強制終了します。*err* を与えてある場合にはこの引数に .true.}
29   \textcolor{comment}{! が返り、プログラムは終了しません。}
30   \textcolor{comment}{!}
31   \textcolor{comment}{!--}
32   \textcolor{comment}{! なお、次元変数の複製は copyfrom と url が異なるファイルに}
33   \textcolor{comment}{! 載っている場合に行なわれる。これは netCDF/an を想定したものだが}
34   \textcolor{comment}{! ほかのファイル形式が追加されたときには変更を要するかもしれない。}
35   \textcolor{comment}{!++}
36   \textcolor{comment}{!}
37   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__types}{gtdata\_types}\textcolor{keywordtype}{, only}: \hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}
38   \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_adb76910ff05e3b9fe3436567f8f8dac6}{string}, \hyperlink{namespacedc__types_a6d28eb015ba84292a06f4ff25165b376}{token}
39   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__generic}{gtdata\_generic}\textcolor{keywordtype}{, only}: \hyperlink{interfacegtdata__generic_1_1open}{open}, \hyperlink{interfacegtdata__generic_1_1inquire}{inquire}, \hyperlink{interfacegtdata__generic_1_1close}{close}, 
      \hyperlink{interfacegtdata__generic_1_1create}{create}, \hyperlink{interfacegtdata__generic_1_1copy__attr}{copy\_attr}
40   \textcolor{keywordtype}{use }\hyperlink{namespacedc__url}{dc\_url}\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__url_1_1urlsplit}{urlsplit}, \hyperlink{namespacedc__url_a3157f15c35d09732b55dfb0f4f52397d}{gt\_atmark}
41   \textcolor{keywordtype}{use }\hyperlink{namespacedc__trace}{dc\_trace}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}, \hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}
42   \textcolor{keywordtype}{use }\hyperlink{namespacedc__error}{dc\_error}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}, \hyperlink{namespacedc__error_a253c222db80053c2ddcac9a384424949}{gt\_enomem}
43   \textcolor{keywordtype}{implicit none}
44   \textcolor{keywordtype}{intrinsic} trim
45   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}),    \textcolor{keywordtype}{intent(out)}   :: var
46   \textcolor{keywordtype}{character(len = *)},   \textcolor{keywordtype}{intent(in)}    :: url
47   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}),    \textcolor{keywordtype}{intent(inout)} :: copyfrom
48   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{optional}      :: copyvalue
49   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{optional}      :: overwrite
50   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{optional}      :: err
51   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}),    \textcolor{keywordtype}{allocatable}   :: vdimsource(:)
52   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}),    \textcolor{keywordtype}{allocatable}   :: vdimdest(:)
53   \textcolor{keywordtype}{integer}                             :: i, nd, stat
54   \textcolor{keywordtype}{logical}                             :: myerr
55   \textcolor{keywordtype}{character(STRING)}                   :: vpart, upart, desturl
56   \textcolor{keywordtype}{character(TOKEN)}                    :: xtype
57   \textcolor{keywordtype}{character(len = *)},      \textcolor{keywordtype}{parameter}:: version = &
58     & \textcolor{stringliteral}{'$Name:  $'} // &
59     & \textcolor{stringliteral}{'$Id: gtvarcreatecopy.f90,v 1.1 2009-03-20 09:09:51 morikawa Exp $'}
60 continue
61   \textcolor{keyword}{call }\hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}(\textcolor{stringliteral}{'gtvarcreatecopy'}, \textcolor{stringliteral}{'url=%c copyfrom=%d'}, &
62     & c1=trim(url), i=(/copyfrom%mapid/), version=version)
63   stat = 0
64   myerr = .false.
65   \textcolor{comment}{!-----------------------------------------------------------------}
66   \textcolor{comment}{!  コピーする変数の次元をコピー先のファイルに作成}
67   \textcolor{comment}{!-----------------------------------------------------------------}
68   \textcolor{comment}{!----- コピー元 copyfrom の次元変数の取得 -----}
69   \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(copyfrom, alldims=nd)
70   \textcolor{keyword}{allocate}(vdimsource(nd), vdimdest(nd), stat=stat)
71   \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{goto} 999
72   desturl = url
73   \textcolor{comment}{!----- コピー元 copyfrom の各次元情報を vDimSource に取り出し, -----}
74   \textcolor{comment}{!----- それをコピー先 desturl へコピーしてその次元 ID を       -----}
75   \textcolor{comment}{!----- vDimDest に返してもらう.                                -----}
76   \textcolor{keywordflow}{do}, i = 1, nd
77     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1open}{open}(vdimsource(i), copyfrom, dimord=i, &
78       & count\_compact=.true., err=myerr)
79     \textcolor{keyword}{call }\hyperlink{gtvarcreatecopy_8f90_aea83607e3b2c767b141e9b0edd10b475}{gtvarcopydim}(to=vdimdest(i), from=vdimsource(i), &
80       & \textcolor{keywordtype}{target}=desturl)
81 \textcolor{keywordflow}{  end do}
82   \textcolor{comment}{!-----------------------------------------------------------------}
83   \textcolor{comment}{!  変数作成}
84   \textcolor{comment}{!-----------------------------------------------------------------}
85   \textcolor{comment}{!----- url に変数名が無い場合, コピー元の変数名を使用 -----}
86   \textcolor{keyword}{call }\hyperlink{interfacedc__url_1_1urlsplit}{urlsplit}(url, var=vpart)
87   \textcolor{keywordflow}{if} (vpart == \textcolor{stringliteral}{""}) \textcolor{keywordflow}{then}
88     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(copyfrom, url=upart)
89     \textcolor{keyword}{call }\hyperlink{interfacedc__url_1_1urlsplit}{urlsplit}(upart, var=vpart)
90     desturl = trim(desturl) // \hyperlink{namespacedc__url_a3157f15c35d09732b55dfb0f4f52397d}{gt\_atmark} // trim(vpart)
91 \textcolor{keywordflow}{  end if}
92   \textcolor{comment}{!----- 実際に変数作成 -----}
93   \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(copyfrom, xtype=xtype)
94   \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1create}{create}(var, trim(desturl), dims=vdimdest, xtype=xtype, &
95     &      overwrite=overwrite, err=myerr)
96   \textcolor{keywordflow}{if} (myerr) \textcolor{keywordflow}{goto} 990
97   \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1copy__attr}{copy\_attr}(to=var, from=copyfrom, err=myerr)
98   \textcolor{keywordflow}{if} (myerr) \textcolor{keywordflow}{goto} 990
99   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(copyvalue)) \textcolor{keywordflow}{then}
100     \textcolor{keywordflow}{if} (copyvalue) \textcolor{keywordflow}{then}
101       \textcolor{keyword}{call }\hyperlink{gtvarcreatecopy_8f90_aedbce7439a6d5e9f94c7bdf119576b65}{gtvarcopyvalue}(to=var, from=copyfrom)
102 \textcolor{keywordflow}{    endif}
103 \textcolor{keywordflow}{  endif}
104   \textcolor{keywordflow}{do}, i = 1, nd
105     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1close}{close}(vdimsource(i))
106     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1close}{close}(vdimdest(i))
107 \textcolor{keywordflow}{  end do}
108 990 \textcolor{keywordflow}{continue}
109   \textcolor{keyword}{deallocate}(vdimsource, vdimdest, stat=stat)
110 999 \textcolor{keywordflow}{continue}
111   \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{then}
112     \textcolor{keyword}{call }\hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}(\hyperlink{namespacedc__error_a253c222db80053c2ddcac9a384424949}{gt\_enomem}, \textcolor{stringliteral}{"GTVarCreateCopy"}, err)
113   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(err)) \textcolor{keywordflow}{then}
114     err = myerr
115   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (myerr) \textcolor{keywordflow}{then}
116     \textcolor{keyword}{call }\hyperlink{dc__error_8f90_a805edc2691c008aded6c82bc8d28d99e}{dumperror}
117 \textcolor{keywordflow}{  end if}
118   \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(\textcolor{stringliteral}{'gtvarcreatecopy'}, \textcolor{stringliteral}{'result=%d'}, i=(/var%mapid/))
119 \textcolor{keyword}{contains}
120 
121   \textcolor{comment}{! from と同じ内容の次元変数を URL target で示される変数の作成時に}
122   \textcolor{comment}{! 次元として使えるように to に複写。}
123   \textcolor{comment}{! なるべく再オープンで済まそうとする。}
124   \textcolor{comment}{! 複写する場合もなるべく次元名を合わせようとする。}
125   \textcolor{comment}{!}
126 \textcolor{keyword}{  subroutine }\hyperlink{gtvarcreatecopy_8f90_aea83607e3b2c767b141e9b0edd10b475}{gtvarcopydim}(to, from, target)
127     \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__types}{gtdata\_types}
128     \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_a6d28eb015ba84292a06f4ff25165b376}{token}, \hyperlink{namespacedc__types_adb76910ff05e3b9fe3436567f8f8dac6}{string}
129     \textcolor{keywordtype}{use }\hyperlink{namespacedc__url}{dc\_url}\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__url_1_1urlsplit}{urlsplit}, \hyperlink{interfacedc__url_1_1urlmerge}{urlmerge}, \textcolor{keyword}{operator}(.onthesamefile.)
130     \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__generic}{gtdata\_generic}\textcolor{keywordtype}{, only}: \hyperlink{interfacegtdata__generic_1_1open}{open}, \hyperlink{interfacegtdata__generic_1_1inquire}{inquire}, \hyperlink{interfacegtdata__generic_1_1create}{create}, 
      \hyperlink{interfacegtdata__generic_1_1copy__attr}{copy\_attr}
131     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}), \textcolor{keywordtype}{intent(out)}:: to
132     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}), \textcolor{keywordtype}{intent(inout)}:: from
133     \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{intent(in)}:: target
134     \textcolor{keywordtype}{character(len = string)}:: url, file, dimname
135     \textcolor{keywordtype}{character(len = token)}:: xtype
136     \textcolor{keywordtype}{logical}:: growable, myerr
137     \textcolor{keywordtype}{integer}:: length
138   \textcolor{keywordflow}{continue}
139     \textcolor{keyword}{call }\hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}(\textcolor{stringliteral}{'gtvarcopydim'}, \textcolor{stringliteral}{'from=%d target=<%c>'}, &
140       & i=(/from%mapid/), c1=trim(\textcolor{keywordtype}{target}))
141     \textcolor{comment}{!----- 同じファイル上にコピーする場合は参照カウンタを1つ回すだけ -----}
142     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(var=from, url=url)
143     \textcolor{keywordflow}{if} (trim(url) .onthesamefile. trim(\textcolor{keywordtype}{target})) \textcolor{keywordflow}{then}
144       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1open}{open}(to, from, dimord=0)
145       \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(\textcolor{stringliteral}{'gtvarcopydim'}, \textcolor{stringliteral}{'dup-handle'})
146       \textcolor{keywordflow}{return}
147 \textcolor{keywordflow}{    endif}
148     \textcolor{comment}{!----- 異なるファイル上にコピーする場合, 既に次元変数 from が -----}
149     \textcolor{comment}{!----- target の次元変数として含まれるかチェック              -----}
150     \textcolor{keyword}{call }\hyperlink{interfacedc__url_1_1urlsplit}{urlsplit}(\textcolor{keywordtype}{target}, file=file)
151     \textcolor{keywordflow}{if} (\hyperlink{gtvarcreatecopy_8f90_a7e0e99bda877a6d9e1abe41150d6fa81}{lookupequivalent}(to, from, file)) \textcolor{keywordflow}{then}
152       \textcolor{comment}{!----- 含まれる場合はそれで終了 -----}
153       \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(\textcolor{stringliteral}{'gtvarcopydim'}, \textcolor{stringliteral}{'equivalent-exists'})
154       \textcolor{keywordflow}{return}
155     \textcolor{keywordflow}{else}
156       \textcolor{comment}{!----- 含まれない場合次元変数 from を target 上に作成 -----}
157       \textcolor{comment}{! 次元変数 from が無制限次元である場合には長さを 0 に}
158       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(var=from, growable=growable, allcount=length)
159       \textcolor{keywordflow}{if} (growable) length = 0
160       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(var=from, xtype=xtype, name=dimname)
161       \textcolor{comment}{!}
162       url = \hyperlink{interfacedc__url_1_1urlmerge}{urlmerge}(file, dimname)
163       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1create}{create}(to, trim(url), length, xtype, err=myerr)
164       \textcolor{keywordflow}{if} (myerr) \textcolor{keywordflow}{then}
165         \textcolor{comment}{! 指定名称でうまくいかない場合は自動生成名にする}
166         \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1create}{create}(to, trim(file), length, xtype)
167 \textcolor{keywordflow}{      endif}
168       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1copy__attr}{copy\_attr}(to, from, myerr)
169       \textcolor{keyword}{call }\hyperlink{gtvarcreatecopy_8f90_aedbce7439a6d5e9f94c7bdf119576b65}{gtvarcopyvalue}(to, from)
170       \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(\textcolor{stringliteral}{'gtvarcopydim'}, \textcolor{stringliteral}{'created'})
171       \textcolor{keywordflow}{return}
172 \textcolor{keywordflow}{    endif}
173 \textcolor{keyword}{  end subroutine }\hyperlink{gtvarcreatecopy_8f90_aea83607e3b2c767b141e9b0edd10b475}{gtvarcopydim}
174 
175   \textcolor{comment}{!-----------------------------------------------------------------}
176   \textcolor{comment}{!  ・ 次元変数 from が既に file にあるのかを判定}
177   \textcolor{comment}{!       次元変数 from がコピー先の nc ファイル file に既に}
178   \textcolor{comment}{!       存在するなら .TRUE. しないなら .FALSE. を result に返す.}
179   \textcolor{comment}{!       result = .TRUE. が返る場合にはそれに該当する次元の ID を}
180   \textcolor{comment}{!       to に返す.}
181   \textcolor{comment}{!       - 判定条件は 1) from が無制限次元で, file も無制限次元を}
182   \textcolor{comment}{!         持つこと, または 2) 次元変数 from のサイズと一致する次元が}
183   \textcolor{comment}{!         file 内にあり, 且つその次元の単位名が from の単位名と一致}
184   \textcolor{comment}{!         すること.}
185   \textcolor{comment}{!         ※ もしかすると条件が足りないかも知れない.}
186   \textcolor{comment}{!-----------------------------------------------------------------}
187 \textcolor{keyword}{  logical }\textcolor{keyword}{function }\hyperlink{gtvarcreatecopy_8f90_a7e0e99bda877a6d9e1abe41150d6fa81}{lookupequivalent}(to, from, file) \textcolor{keyword}{result}(result)
188     \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_adb76910ff05e3b9fe3436567f8f8dac6}{string}
189     \textcolor{keywordtype}{use }\hyperlink{namespacedc__string}{dc\_string}\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__string_1_1tochar}{tochar}
190     \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__generic}{gtdata\_generic}\textcolor{keywordtype}{, only}: \hyperlink{interfacegtdata__generic_1_1inquire}{inquire}, \hyperlink{interfacegtdata__generic_1_1gtvarsearch}{gtvarsearch}, 
      \hyperlink{interfacegtdata__generic_1_1open}{open}, \hyperlink{interfacegtdata__generic_1_1get__attr}{get\_attr}
191     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}), \textcolor{keywordtype}{intent(out)}:: to
192     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}), \textcolor{keywordtype}{intent(in)}:: from
193     \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{intent(in)}:: file
194     \textcolor{keywordtype}{character(len = string)}:: url, units1, units2, reason
195     \textcolor{keywordtype}{logical}:: end, growable1, growable2
196     \textcolor{keywordtype}{integer}:: len1, len2
197     \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{parameter}:: subnam = \textcolor{stringliteral}{"lookupequivalent"}
198     \textcolor{keyword}{call }\hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}(subnam, \textcolor{stringliteral}{'from=%d file=<%c>'}, &
199       & i=(/from%mapid/), c1=trim(file))
200     result = .false.
201     \textcolor{comment}{!----- 次元変数 from のサイズと単位, 無制限次元かどうかを探査 -----}
202     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(from, allcount=len1, growable=growable1)
203     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1get__attr}{get\_attr}(from, \textcolor{stringliteral}{'units'}, units1, default=\textcolor{stringliteral}{''})
204     \textcolor{comment}{!----- コピー先 file の変数情報を探査 -----}
205     \textcolor{comment}{! とりあえずは次元だけでなく全ての変数について開く}
206     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1gtvarsearch}{gtvarsearch}(file)
207     \textcolor{keywordflow}{do}
208       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1gtvarsearch}{gtvarsearch}(url, end)
209       \textcolor{keywordflow}{if} (end) \textcolor{keywordflow}{exit}
210       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1open}{open}(to, url, writable=.true., err=end)
211       \textcolor{keywordflow}{if} (end) \textcolor{keywordflow}{exit}
212       \textcolor{comment}{! 次元変数のサイズと, 無制限次元かどうかを取得}
213       \textcolor{comment}{!   (次元変数でないもののサイズは, 依存する次元変数のサイズを}
214       \textcolor{comment}{!    掛け合わせたものとなるので, もしかすると誤動作するかも).}
215       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(to, allcount=len2, growable=growable2)
216       \textcolor{comment}{! 次元変数 from が無制限次元で, 且つ file 内の次元変数も}
217       \textcolor{comment}{! 無制限次元の場合は, 同じ次元変数と考える.}
218       \textcolor{keywordflow}{if} (.not. growable1 .or. .not. growable2) \textcolor{keywordflow}{then}
219         \textcolor{comment}{! 次元変数 from のサイズと file 内の次元変数のサイズが}
220         \textcolor{comment}{! 異なる場合はスキップ}
221         \textcolor{keywordflow}{if} (len1 /= len2) \textcolor{keywordflow}{then}
222           \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1close}{close}(to)
223           cycle
224 \textcolor{keywordflow}{        endif}
225         \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1get__attr}{get\_attr}(to, \textcolor{stringliteral}{'units'}, units2, default=\textcolor{stringliteral}{''})
226         \textcolor{comment}{! 本当は dc\_units で比較すべきだがとりあえず文字列比較}
227         \textcolor{keywordflow}{if} (units1 /= units2) \textcolor{keywordflow}{then}
228           \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1close}{close}(to)
229           cycle
230         \textcolor{keywordflow}{else}
231           reason = \textcolor{stringliteral}{'length of from is '} // trim(\hyperlink{interfacedc__string_1_1tochar}{tochar}(len1)) // &
232             &   \textcolor{stringliteral}{'. units of from is '} // \textcolor{stringliteral}{"["} //               &
233             &   trim(units1) // \textcolor{stringliteral}{"]"} //                        &
234             &   \textcolor{stringliteral}{'. And file has same length and units.'}
235 \textcolor{keywordflow}{        endif}
236       \textcolor{keywordflow}{else}
237         reason = \textcolor{stringliteral}{'from is UNLIMITED dimension, and file has it'}
238 \textcolor{keywordflow}{      endif}
239       result = .true.
240       \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(subnam, \textcolor{stringliteral}{'found (%c)'}, c1=trim(reason))
241       \textcolor{keywordflow}{return}
242 \textcolor{keywordflow}{    enddo}
243     \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(subnam, \textcolor{stringliteral}{'not found'})
244 \textcolor{keyword}{  end function }\hyperlink{gtvarcreatecopy_8f90_a7e0e99bda877a6d9e1abe41150d6fa81}{lookupequivalent}
245 
246   \textcolor{comment}{! すでに存在する変数について、値をコピーする。}
247   \textcolor{comment}{!}
248 \textcolor{keyword}{  subroutine }\hyperlink{gtvarcreatecopy_8f90_aedbce7439a6d5e9f94c7bdf119576b65}{gtvarcopyvalue}(to, from)
249     \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__types}{gtdata\_types}\textcolor{keywordtype}{, only}: \hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}
250     \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__generic}{gtdata\_generic}\textcolor{keywordtype}{, only}: \hyperlink{gtvargetnum_8f90_ad255a6d133cc9c0f837db05499f4d7d1}{gtvargetreal}, 
      \hyperlink{gtvarputnum_8f90_a78aab646e5ea1306ebfbabb3f9371722}{gtvarputreal}, \hyperlink{interfacegtdata__generic_1_1inquire}{inquire}, \hyperlink{interfacegtdata__generic_1_1slice}{slice}, \hyperlink{interfacegtdata__generic_1_1slice__next}{slice\_next}
251     \textcolor{keywordtype}{use }\hyperlink{namespacedc__error}{dc\_error}\textcolor{keywordtype}{, only}: \hyperlink{dc__error_8f90_a805edc2691c008aded6c82bc8d28d99e}{dumperror}
252     \textcolor{keywordtype}{use }\hyperlink{namespacedc__string}{dc\_string}
253     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}), \textcolor{keywordtype}{intent(inout)}:: to
254     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}), \textcolor{keywordtype}{intent(inout)}:: from
255     \textcolor{keywordtype}{real}, \textcolor{keywordtype}{allocatable}:: rbuffer(:)
256     \textcolor{keywordtype}{logical}:: err
257     \textcolor{keywordtype}{integer}:: siz, stat
258     \textcolor{comment}{!}
259     \textcolor{keyword}{call }\hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}(\textcolor{stringliteral}{'gtvarcopyvalue'})
260     \textcolor{comment}{! 値のコピー}
261     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1slice}{slice}(from)
262     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1slice}{slice}(to, compatible=from)
263     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(from, size=siz)
264     \textcolor{keyword}{allocate} (rbuffer(siz))
265     \textcolor{keywordflow}{do}
266       \textcolor{keyword}{call }\hyperlink{gtvargetnum_8f90_ad255a6d133cc9c0f837db05499f4d7d1}{gtvargetreal}(from, rbuffer, siz, err)
267       \textcolor{keywordflow}{if} (err) \textcolor{keyword}{call }\hyperlink{dc__error_8f90_a805edc2691c008aded6c82bc8d28d99e}{dumperror}()
268       \textcolor{keyword}{call }\hyperlink{gtvarputnum_8f90_a78aab646e5ea1306ebfbabb3f9371722}{gtvarputreal}(to, rbuffer, siz, err)
269       \textcolor{keywordflow}{if} (err) \textcolor{keyword}{call }\hyperlink{dc__error_8f90_a805edc2691c008aded6c82bc8d28d99e}{dumperror}()
270       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1slice__next}{slice\_next}(from, stat=stat)
271       \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit}
272       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1slice__next}{slice\_next}(to, stat=stat)
273 \textcolor{keywordflow}{    enddo}
274     \textcolor{keyword}{deallocate} (rbuffer)
275     \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(\textcolor{stringliteral}{'gtvarcopyvalue'})
276 \textcolor{keyword}{  end subroutine }\hyperlink{gtvarcreatecopy_8f90_aedbce7439a6d5e9f94c7bdf119576b65}{gtvarcopyvalue}
277 
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gtvarcreatecopy_8f90_a0e91496e14616d74934d7d16a5c1b695_cgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{gtvarcreatecopy_8f90_a7e0e99bda877a6d9e1abe41150d6fa81}\label{gtvarcreatecopy_8f90_a7e0e99bda877a6d9e1abe41150d6fa81}} 
\index{gtvarcreatecopy.\+f90@{gtvarcreatecopy.\+f90}!lookupequivalent@{lookupequivalent}}
\index{lookupequivalent@{lookupequivalent}!gtvarcreatecopy.\+f90@{gtvarcreatecopy.\+f90}}
\subsubsection{\texorpdfstring{lookupequivalent()}{lookupequivalent()}}
{\footnotesize\ttfamily logical function gtvarcreatecopyc\+::lookupequivalent (\begin{DoxyParamCaption}\item[{type(\hyperlink{structgtdata__types_1_1gt__variable}{gt\+\_\+variable}), intent(out)}]{to,  }\item[{type(\hyperlink{structgtdata__types_1_1gt__variable}{gt\+\_\+variable}), intent(in)}]{from,  }\item[{character(len = $\ast$), intent(in)}]{file }\end{DoxyParamCaption})}



Definition at line 188 of file gtvarcreatecopy.\+f90.



References dc\+\_\+trace\+::beginsub(), dc\+\_\+trace\+::endsub(), and dc\+\_\+types\+::string.



Referenced by gtvarcopydim().


\begin{DoxyCode}
188     \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_adb76910ff05e3b9fe3436567f8f8dac6}{string}
189     \textcolor{keywordtype}{use }\hyperlink{namespacedc__string}{dc\_string}\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__string_1_1tochar}{tochar}
190     \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__generic}{gtdata\_generic}\textcolor{keywordtype}{, only}: \hyperlink{interfacegtdata__generic_1_1inquire}{inquire}, \hyperlink{interfacegtdata__generic_1_1gtvarsearch}{gtvarsearch}, 
      \hyperlink{interfacegtdata__generic_1_1open}{open}, \hyperlink{interfacegtdata__generic_1_1get__attr}{get\_attr}
191     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}), \textcolor{keywordtype}{intent(out)}:: to
192     \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}), \textcolor{keywordtype}{intent(in)}:: from
193     \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{intent(in)}:: file
194     \textcolor{keywordtype}{character(len = string)}:: url, units1, units2, reason
195     \textcolor{keywordtype}{logical}:: end, growable1, growable2
196     \textcolor{keywordtype}{integer}:: len1, len2
197     \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{parameter}:: subnam = \textcolor{stringliteral}{"lookupequivalent"}
198     \textcolor{keyword}{call }\hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}(subnam, \textcolor{stringliteral}{'from=%d file=<%c>'}, &
199       & i=(/from%mapid/), c1=trim(file))
200     result = .false.
201     \textcolor{comment}{!----- 次元変数 from のサイズと単位, 無制限次元かどうかを探査 -----}
202     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(from, allcount=len1, growable=growable1)
203     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1get__attr}{get\_attr}(from, \textcolor{stringliteral}{'units'}, units1, default=\textcolor{stringliteral}{''})
204     \textcolor{comment}{!----- コピー先 file の変数情報を探査 -----}
205     \textcolor{comment}{! とりあえずは次元だけでなく全ての変数について開く}
206     \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1gtvarsearch}{gtvarsearch}(file)
207     \textcolor{keywordflow}{do}
208       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1gtvarsearch}{gtvarsearch}(url, end)
209       \textcolor{keywordflow}{if} (end) \textcolor{keywordflow}{exit}
210       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1open}{open}(to, url, writable=.true., err=end)
211       \textcolor{keywordflow}{if} (end) \textcolor{keywordflow}{exit}
212       \textcolor{comment}{! 次元変数のサイズと, 無制限次元かどうかを取得}
213       \textcolor{comment}{!   (次元変数でないもののサイズは, 依存する次元変数のサイズを}
214       \textcolor{comment}{!    掛け合わせたものとなるので, もしかすると誤動作するかも).}
215       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(to, allcount=len2, growable=growable2)
216       \textcolor{comment}{! 次元変数 from が無制限次元で, 且つ file 内の次元変数も}
217       \textcolor{comment}{! 無制限次元の場合は, 同じ次元変数と考える.}
218       \textcolor{keywordflow}{if} (.not. growable1 .or. .not. growable2) \textcolor{keywordflow}{then}
219         \textcolor{comment}{! 次元変数 from のサイズと file 内の次元変数のサイズが}
220         \textcolor{comment}{! 異なる場合はスキップ}
221         \textcolor{keywordflow}{if} (len1 /= len2) \textcolor{keywordflow}{then}
222           \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1close}{close}(to)
223           cycle
224 \textcolor{keywordflow}{        endif}
225         \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1get__attr}{get\_attr}(to, \textcolor{stringliteral}{'units'}, units2, default=\textcolor{stringliteral}{''})
226         \textcolor{comment}{! 本当は dc\_units で比較すべきだがとりあえず文字列比較}
227         \textcolor{keywordflow}{if} (units1 /= units2) \textcolor{keywordflow}{then}
228           \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1close}{close}(to)
229           cycle
230         \textcolor{keywordflow}{else}
231           reason = \textcolor{stringliteral}{'length of from is '} // trim(\hyperlink{interfacedc__string_1_1tochar}{tochar}(len1)) // &
232             &   \textcolor{stringliteral}{'. units of from is '} // \textcolor{stringliteral}{"["} //               &
233             &   trim(units1) // \textcolor{stringliteral}{"]"} //                        &
234             &   \textcolor{stringliteral}{'. And file has same length and units.'}
235 \textcolor{keywordflow}{        endif}
236       \textcolor{keywordflow}{else}
237         reason = \textcolor{stringliteral}{'from is UNLIMITED dimension, and file has it'}
238 \textcolor{keywordflow}{      endif}
239       result = .true.
240       \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(subnam, \textcolor{stringliteral}{'found (%c)'}, c1=trim(reason))
241       \textcolor{keywordflow}{return}
242 \textcolor{keywordflow}{    enddo}
243     \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(subnam, \textcolor{stringliteral}{'not found'})
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gtvarcreatecopy_8f90_a7e0e99bda877a6d9e1abe41150d6fa81_cgraph}
\end{center}
\end{figure}
Here is the caller graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gtvarcreatecopy_8f90_a7e0e99bda877a6d9e1abe41150d6fa81_icgraph}
\end{center}
\end{figure}
