\hypertarget{gdmemvarattradd_8f90}{}\section{gtdata/gtdata\+\_\+memory/gdmemvarattradd.f90 File Reference}
\label{gdmemvarattradd_8f90}\index{gtdata/gtdata\+\_\+memory/gdmemvarattradd.\+f90@{gtdata/gtdata\+\_\+memory/gdmemvarattradd.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{gdmemvarattradd_8f90_aaae1b3c6a7a4dd7344a5d20cca984f0f}{gdmemvarattradd} (var, attrname, attrval)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{gdmemvarattradd_8f90_aaae1b3c6a7a4dd7344a5d20cca984f0f}\label{gdmemvarattradd_8f90_aaae1b3c6a7a4dd7344a5d20cca984f0f}} 
\index{gdmemvarattradd.\+f90@{gdmemvarattradd.\+f90}!gdmemvarattradd@{gdmemvarattradd}}
\index{gdmemvarattradd@{gdmemvarattradd}!gdmemvarattradd.\+f90@{gdmemvarattradd.\+f90}}
\subsubsection{\texorpdfstring{gdmemvarattradd()}{gdmemvarattradd()}}
{\footnotesize\ttfamily subroutine gdmemvarattradd (\begin{DoxyParamCaption}\item[{type(gd\+\_\+mem\+\_\+variable), intent(in)}]{var,  }\item[{character($\ast$), intent(in)}]{attrname,  }\item[{character($\ast$), intent(in)}]{attrval }\end{DoxyParamCaption})}



Definition at line 2 of file gdmemvarattradd.\+f90.


\begin{DoxyCode}
2   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__memory__types}{gtdata\_memory\_types}\textcolor{keywordtype}{, only}: \hyperlink{structgtdata__memory__types_1_1gd__mem__variable}{gd\_mem\_variable}, 
      \hyperlink{structgtdata__memory__types_1_1gd__mem__variable__entry}{gd\_mem\_variable\_entry}, \hyperlink{structgtdata__memory__types_1_1gd__mem__attr__chain}{gd\_mem\_attr\_chain}
3   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__memory__internal}{gtdata\_memory\_internal}\textcolor{keywordtype}{, only}: \hyperlink{interfacegtdata__memory__internal_1_1memtab__lookup}{memtab\_lookup}
4   \textcolor{keywordtype}{use }netcdf\textcolor{keywordtype}{, only}: nf90\_noerr, nf90\_enotatt
5   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__memory__types_1_1gd__mem__variable}{gd\_mem\_variable}), \textcolor{keywordtype}{intent(in)}:: var
6   \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)}:: attrname
7   \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)}:: attrval
8   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__memory__types_1_1gd__mem__variable__entry}{gd\_mem\_variable\_entry}), \textcolor{keywordtype}{pointer}:: ent
9   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__memory__types_1_1gd__mem__attr__chain}{gd\_mem\_attr\_chain}), \textcolor{keywordtype}{pointer}:: p
10   \textcolor{keywordtype}{integer}:: i, stat
11 
12   stat = \hyperlink{interfacegtdata__memory__internal_1_1memtab__lookup}{memtab\_lookup}(var, ent)
13   \textcolor{keywordflow}{if} (stat == nf90\_noerr) \textcolor{keywordflow}{then}
14     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(ent%current)) \textcolor{keywordflow}{then}
15       \textcolor{keywordflow}{if} (ent%current%name == attrname) \textcolor{keywordflow}{then}
16         p => ent%current
17         \textcolor{keywordflow}{goto} 100
18 \textcolor{keywordflow}{      endif}
19 \textcolor{keywordflow}{    endif}
20     p => ent%attr
21     \textcolor{keywordflow}{do}
22       \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(p)) \textcolor{keywordflow}{exit}
23       \textcolor{keywordflow}{if} (p%name == attrname) \textcolor{keywordflow}{goto} 100
24       p => p%next
25 \textcolor{keywordflow}{    enddo}
26     stat = nf90\_enotatt
27 \textcolor{keywordflow}{  endif}
28   \textcolor{keyword}{allocate}(p)
29   \textcolor{keyword}{nullify}(p%next)
30   \textcolor{keywordflow}{goto} 120
31 
32 100 \textcolor{keywordflow}{continue}
33   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(p%cbuf)) \textcolor{keywordflow}{then}
34     \textcolor{keyword}{deallocate}(p%cbuf)
35 \textcolor{keywordflow}{  endif}
36 
37 120 \textcolor{keywordflow}{continue}
38   \textcolor{keyword}{allocate}(p%cbuf(len(attrval)))
39   \textcolor{keywordflow}{do}, i = 1, len(attrval)
40     p%cbuf(i) = attrval(i:i)
41 \textcolor{keywordflow}{  enddo}
42   \textcolor{keywordflow}{return}
\end{DoxyCode}
