\hypertarget{namespacemom__safe__alloc}{}\section{mom\+\_\+safe\+\_\+alloc Module Reference}
\label{namespacemom__safe__alloc}\index{mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}}


\subsection{Detailed Description}
Convenience functions for safely allocating memory without accidentally reallocating pointer and causing memory leaks. \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
interface \hyperlink{interfacemom__safe__alloc_1_1safe__alloc__alloc}{safe\+\_\+alloc\+\_\+alloc}
\begin{DoxyCompactList}\small\item\em Allocate a 2-\/d or 3-\/d allocatable array. \end{DoxyCompactList}\item 
interface \hyperlink{interfacemom__safe__alloc_1_1safe__alloc__ptr}{safe\+\_\+alloc\+\_\+ptr}
\begin{DoxyCompactList}\small\item\em Allocate a pointer to a 1-\/d, 2-\/d or 3-\/d array. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{namespacemom__safe__alloc_a884f70b74863fa33d8956bcdc4bd331c}{safe\+\_\+alloc\+\_\+ptr\+\_\+1d} (ptr, i1, i2)
\begin{DoxyCompactList}\small\item\em Allocate a pointer to a 1-\/d array. \end{DoxyCompactList}\item 
subroutine \hyperlink{namespacemom__safe__alloc_a93463ba87cbcc6bd34a528e05bc5d449}{safe\+\_\+alloc\+\_\+ptr\+\_\+2d\+\_\+2arg} (ptr, ni, nj)
\begin{DoxyCompactList}\small\item\em Allocate a pointer to a 2-\/d array based on its dimension sizes. \end{DoxyCompactList}\item 
subroutine \hyperlink{namespacemom__safe__alloc_ab9e23cc5ed4635454b4412aa0eb8a4c4}{safe\+\_\+alloc\+\_\+ptr\+\_\+3d\+\_\+3arg} (ptr, ni, nj, nk)
\begin{DoxyCompactList}\small\item\em Allocate a pointer to a 3-\/d array based on its dimension sizes. \end{DoxyCompactList}\item 
subroutine \hyperlink{namespacemom__safe__alloc_ae52e9466348c49c0ac3c21e1c2eb4073}{safe\+\_\+alloc\+\_\+ptr\+\_\+2d} (ptr, is, ie, js, je)
\begin{DoxyCompactList}\small\item\em Allocate a pointer to a 2-\/d array based on its index starting and ending values. \end{DoxyCompactList}\item 
subroutine \hyperlink{namespacemom__safe__alloc_a70e67bdc39ad0edb1f40b0ba533d44d5}{safe\+\_\+alloc\+\_\+ptr\+\_\+3d} (ptr, is, ie, js, je, nk)
\begin{DoxyCompactList}\small\item\em Allocate a pointer to a 3-\/d array based on its index starting and ending values. \end{DoxyCompactList}\item 
subroutine \hyperlink{namespacemom__safe__alloc_a6168c61b47b5e57b72f1481625076421}{safe\+\_\+alloc\+\_\+ptr\+\_\+3d\+\_\+6arg} (ptr, is, ie, js, je, ks, ke)
\begin{DoxyCompactList}\small\item\em Allocate a pointer to a 3-\/d array based on its index starting and ending values. \end{DoxyCompactList}\item 
subroutine \hyperlink{namespacemom__safe__alloc_ac762814e20f163c01cd2753b6757dc72}{safe\+\_\+alloc\+\_\+allocatable\+\_\+2d} (ptr, is, ie, js, je)
\begin{DoxyCompactList}\small\item\em Allocate a 2-\/d allocatable array based on its index starting and ending values. \end{DoxyCompactList}\item 
subroutine \hyperlink{namespacemom__safe__alloc_a8997262e361b426a15c77813adcc0aca}{safe\+\_\+alloc\+\_\+allocatable\+\_\+3d} (ptr, is, ie, js, je, nk)
\begin{DoxyCompactList}\small\item\em Allocate a 3-\/d allocatable array based on its index starting and ending values and k-\/index size. \end{DoxyCompactList}\item 
subroutine \hyperlink{namespacemom__safe__alloc_abcf3c91a8747ada0dfc258a8283ea051}{safe\+\_\+alloc\+\_\+allocatable\+\_\+3d\+\_\+6arg} (ptr, is, ie, js, je, ks, ke)
\begin{DoxyCompactList}\small\item\em Allocate a 3-\/d allocatable array based on its 6 index starting and ending values. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__safe__alloc_ac762814e20f163c01cd2753b6757dc72}\label{namespacemom__safe__alloc_ac762814e20f163c01cd2753b6757dc72}} 
\index{mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}!safe\+\_\+alloc\+\_\+allocatable\+\_\+2d@{safe\+\_\+alloc\+\_\+allocatable\+\_\+2d}}
\index{safe\+\_\+alloc\+\_\+allocatable\+\_\+2d@{safe\+\_\+alloc\+\_\+allocatable\+\_\+2d}!mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}}
\subsubsection{\texorpdfstring{safe\+\_\+alloc\+\_\+allocatable\+\_\+2d()}{safe\_alloc\_allocatable\_2d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+safe\+\_\+alloc\+::safe\+\_\+alloc\+\_\+allocatable\+\_\+2d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:), allocatable}]{ptr,  }\item[{integer, intent(in)}]{is,  }\item[{integer, intent(in)}]{ie,  }\item[{integer, intent(in)}]{js,  }\item[{integer, intent(in)}]{je }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Allocate a 2-\/d allocatable array based on its index starting and ending values. 


\begin{DoxyParams}[1]{Parameters}
 & {\em ptr} & An allocatable array to allocate\\
\hline
\mbox{\tt in}  & {\em is} & The start index to allocate for the 1st dimension\\
\hline
\mbox{\tt in}  & {\em ie} & The end index to allocate for the 1st dimension\\
\hline
\mbox{\tt in}  & {\em js} & The start index to allocate for the 2nd dimension\\
\hline
\mbox{\tt in}  & {\em je} & The end index to allocate for the 2nd dimension \\
\hline
\end{DoxyParams}


Definition at line 117 of file M\+O\+M\+\_\+safe\+\_\+alloc.\+F90.


\begin{DoxyCode}
117   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{allocatable} :: ptr\textcolor{comment}{ !< An allocatable array to allocate}
118   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: is\textcolor{comment}{ !< The start index to allocate for the 1st dimension}
119   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: ie\textcolor{comment}{ !< The end index to allocate for the 1st dimension}
120   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: js\textcolor{comment}{ !< The start index to allocate for the 2nd dimension}
121   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: je\textcolor{comment}{ !< The end index to allocate for the 2nd dimension}
122   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{allocated}(ptr)) \textcolor{keywordflow}{then}
123     \textcolor{keyword}{allocate}(ptr(is:ie,js:je))
124     ptr(:,:) = 0.0
125 \textcolor{keywordflow}{  endif}
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__safe__alloc_a8997262e361b426a15c77813adcc0aca}\label{namespacemom__safe__alloc_a8997262e361b426a15c77813adcc0aca}} 
\index{mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}!safe\+\_\+alloc\+\_\+allocatable\+\_\+3d@{safe\+\_\+alloc\+\_\+allocatable\+\_\+3d}}
\index{safe\+\_\+alloc\+\_\+allocatable\+\_\+3d@{safe\+\_\+alloc\+\_\+allocatable\+\_\+3d}!mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}}
\subsubsection{\texorpdfstring{safe\+\_\+alloc\+\_\+allocatable\+\_\+3d()}{safe\_alloc\_allocatable\_3d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+safe\+\_\+alloc\+::safe\+\_\+alloc\+\_\+allocatable\+\_\+3d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:), allocatable}]{ptr,  }\item[{integer, intent(in)}]{is,  }\item[{integer, intent(in)}]{ie,  }\item[{integer, intent(in)}]{js,  }\item[{integer, intent(in)}]{je,  }\item[{integer, intent(in)}]{nk }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Allocate a 3-\/d allocatable array based on its index starting and ending values and k-\/index size. 


\begin{DoxyParams}[1]{Parameters}
 & {\em ptr} & An allocatable array to allocate\\
\hline
\mbox{\tt in}  & {\em is} & The start index to allocate for the 1st dimension\\
\hline
\mbox{\tt in}  & {\em ie} & The end index to allocate for the 1st dimension\\
\hline
\mbox{\tt in}  & {\em js} & The start index to allocate for the 2nd dimension\\
\hline
\mbox{\tt in}  & {\em je} & The end index to allocate for the 2nd dimension\\
\hline
\mbox{\tt in}  & {\em nk} & The size to allocate for the 3rd dimension \\
\hline
\end{DoxyParams}


Definition at line 131 of file M\+O\+M\+\_\+safe\+\_\+alloc.\+F90.


\begin{DoxyCode}
131   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{allocatable} :: ptr\textcolor{comment}{ !< An allocatable array to allocate}
132   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: is\textcolor{comment}{ !< The start index to allocate for the 1st dimension}
133   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: ie\textcolor{comment}{ !< The end index to allocate for the 1st dimension}
134   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: js\textcolor{comment}{ !< The start index to allocate for the 2nd dimension}
135   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: je\textcolor{comment}{ !< The end index to allocate for the 2nd dimension}
136   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: nk\textcolor{comment}{ !< The size to allocate for the 3rd dimension}
137   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{allocated}(ptr)) \textcolor{keywordflow}{then}
138     \textcolor{keyword}{allocate}(ptr(is:ie,js:je,nk))
139     ptr(:,:,:) = 0.0
140 \textcolor{keywordflow}{  endif}
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__safe__alloc_abcf3c91a8747ada0dfc258a8283ea051}\label{namespacemom__safe__alloc_abcf3c91a8747ada0dfc258a8283ea051}} 
\index{mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}!safe\+\_\+alloc\+\_\+allocatable\+\_\+3d\+\_\+6arg@{safe\+\_\+alloc\+\_\+allocatable\+\_\+3d\+\_\+6arg}}
\index{safe\+\_\+alloc\+\_\+allocatable\+\_\+3d\+\_\+6arg@{safe\+\_\+alloc\+\_\+allocatable\+\_\+3d\+\_\+6arg}!mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}}
\subsubsection{\texorpdfstring{safe\+\_\+alloc\+\_\+allocatable\+\_\+3d\+\_\+6arg()}{safe\_alloc\_allocatable\_3d\_6arg()}}
{\footnotesize\ttfamily subroutine mom\+\_\+safe\+\_\+alloc\+::safe\+\_\+alloc\+\_\+allocatable\+\_\+3d\+\_\+6arg (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:), allocatable}]{ptr,  }\item[{integer, intent(in)}]{is,  }\item[{integer, intent(in)}]{ie,  }\item[{integer, intent(in)}]{js,  }\item[{integer, intent(in)}]{je,  }\item[{integer, intent(in)}]{ks,  }\item[{integer, intent(in)}]{ke }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Allocate a 3-\/d allocatable array based on its 6 index starting and ending values. 


\begin{DoxyParams}[1]{Parameters}
 & {\em ptr} & An allocatable array to allocate\\
\hline
\mbox{\tt in}  & {\em is} & The start index to allocate for the 1st dimension\\
\hline
\mbox{\tt in}  & {\em ie} & The end index to allocate for the 1st dimension\\
\hline
\mbox{\tt in}  & {\em js} & The start index to allocate for the 2nd dimension\\
\hline
\mbox{\tt in}  & {\em je} & The end index to allocate for the 2nd dimension\\
\hline
\mbox{\tt in}  & {\em ks} & The start index to allocate for the 3rd dimension\\
\hline
\mbox{\tt in}  & {\em ke} & The end index to allocate for the 3rd dimension \\
\hline
\end{DoxyParams}


Definition at line 145 of file M\+O\+M\+\_\+safe\+\_\+alloc.\+F90.


\begin{DoxyCode}
145   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{allocatable} :: ptr\textcolor{comment}{ !< An allocatable array to allocate}
146   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: is\textcolor{comment}{ !< The start index to allocate for the 1st dimension}
147   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: ie\textcolor{comment}{ !< The end index to allocate for the 1st dimension}
148   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: js\textcolor{comment}{ !< The start index to allocate for the 2nd dimension}
149   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: je\textcolor{comment}{ !< The end index to allocate for the 2nd dimension}
150   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: ks\textcolor{comment}{ !< The start index to allocate for the 3rd dimension}
151   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: ke\textcolor{comment}{ !< The end index to allocate for the 3rd dimension}
152   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{allocated}(ptr)) \textcolor{keywordflow}{then}
153     \textcolor{keyword}{allocate}(ptr(is:ie,js:je,ks:ke))
154     ptr(:,:,:) = 0.0
155 \textcolor{keywordflow}{  endif}
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__safe__alloc_a884f70b74863fa33d8956bcdc4bd331c}\label{namespacemom__safe__alloc_a884f70b74863fa33d8956bcdc4bd331c}} 
\index{mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}!safe\+\_\+alloc\+\_\+ptr\+\_\+1d@{safe\+\_\+alloc\+\_\+ptr\+\_\+1d}}
\index{safe\+\_\+alloc\+\_\+ptr\+\_\+1d@{safe\+\_\+alloc\+\_\+ptr\+\_\+1d}!mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}}
\subsubsection{\texorpdfstring{safe\+\_\+alloc\+\_\+ptr\+\_\+1d()}{safe\_alloc\_ptr\_1d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+safe\+\_\+alloc\+::safe\+\_\+alloc\+\_\+ptr\+\_\+1d (\begin{DoxyParamCaption}\item[{real, dimension(\+:), pointer}]{ptr,  }\item[{integer, intent(in)}]{i1,  }\item[{integer, intent(in), optional}]{i2 }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Allocate a pointer to a 1-\/d array. 


\begin{DoxyParams}[1]{Parameters}
 & {\em ptr} & A pointer to allocate\\
\hline
\mbox{\tt in}  & {\em i1} & The size of the array, or its starting index if i2 is present\\
\hline
\mbox{\tt in}  & {\em i2} & The ending index of the array \\
\hline
\end{DoxyParams}


Definition at line 36 of file M\+O\+M\+\_\+safe\+\_\+alloc.\+F90.


\begin{DoxyCode}
36   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{pointer} :: ptr\textcolor{comment}{ !< A pointer to allocate}
37   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)} :: i1\textcolor{comment}{ !< The size of the array, or its starting index if i2 is present}
38   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{optional},  \textcolor{keywordtype}{intent(in)} :: i2\textcolor{comment}{ !< The ending index of the array}
39   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(ptr)) \textcolor{keywordflow}{then}
40     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(i2)) \textcolor{keywordflow}{then}
41       \textcolor{keyword}{allocate}(ptr(i1:i2))
42     \textcolor{keywordflow}{else}
43       \textcolor{keyword}{allocate}(ptr(i1))
44 \textcolor{keywordflow}{    endif}
45     ptr(:) = 0.0
46 \textcolor{keywordflow}{  endif}
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__safe__alloc_ae52e9466348c49c0ac3c21e1c2eb4073}\label{namespacemom__safe__alloc_ae52e9466348c49c0ac3c21e1c2eb4073}} 
\index{mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}!safe\+\_\+alloc\+\_\+ptr\+\_\+2d@{safe\+\_\+alloc\+\_\+ptr\+\_\+2d}}
\index{safe\+\_\+alloc\+\_\+ptr\+\_\+2d@{safe\+\_\+alloc\+\_\+ptr\+\_\+2d}!mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}}
\subsubsection{\texorpdfstring{safe\+\_\+alloc\+\_\+ptr\+\_\+2d()}{safe\_alloc\_ptr\_2d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+safe\+\_\+alloc\+::safe\+\_\+alloc\+\_\+ptr\+\_\+2d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:), pointer}]{ptr,  }\item[{integer, intent(in)}]{is,  }\item[{integer, intent(in)}]{ie,  }\item[{integer, intent(in)}]{js,  }\item[{integer, intent(in)}]{je }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Allocate a pointer to a 2-\/d array based on its index starting and ending values. 


\begin{DoxyParams}[1]{Parameters}
 & {\em ptr} & A pointer to allocate\\
\hline
\mbox{\tt in}  & {\em is} & The start index to allocate for the 1st dimension\\
\hline
\mbox{\tt in}  & {\em ie} & The end index to allocate for the 1st dimension\\
\hline
\mbox{\tt in}  & {\em js} & The start index to allocate for the 2nd dimension\\
\hline
\mbox{\tt in}  & {\em je} & The end index to allocate for the 2nd dimension \\
\hline
\end{DoxyParams}


Definition at line 74 of file M\+O\+M\+\_\+safe\+\_\+alloc.\+F90.


\begin{DoxyCode}
74   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{pointer} :: ptr\textcolor{comment}{ !< A pointer to allocate}
75   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: is\textcolor{comment}{ !< The start index to allocate for the 1st dimension}
76   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: ie\textcolor{comment}{ !< The end index to allocate for the 1st dimension}
77   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: js\textcolor{comment}{ !< The start index to allocate for the 2nd dimension}
78   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: je\textcolor{comment}{ !< The end index to allocate for the 2nd dimension}
79   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(ptr)) \textcolor{keywordflow}{then}
80     \textcolor{keyword}{allocate}(ptr(is:ie,js:je))
81     ptr(:,:) = 0.0
82 \textcolor{keywordflow}{  endif}
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__safe__alloc_a93463ba87cbcc6bd34a528e05bc5d449}\label{namespacemom__safe__alloc_a93463ba87cbcc6bd34a528e05bc5d449}} 
\index{mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}!safe\+\_\+alloc\+\_\+ptr\+\_\+2d\+\_\+2arg@{safe\+\_\+alloc\+\_\+ptr\+\_\+2d\+\_\+2arg}}
\index{safe\+\_\+alloc\+\_\+ptr\+\_\+2d\+\_\+2arg@{safe\+\_\+alloc\+\_\+ptr\+\_\+2d\+\_\+2arg}!mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}}
\subsubsection{\texorpdfstring{safe\+\_\+alloc\+\_\+ptr\+\_\+2d\+\_\+2arg()}{safe\_alloc\_ptr\_2d\_2arg()}}
{\footnotesize\ttfamily subroutine mom\+\_\+safe\+\_\+alloc\+::safe\+\_\+alloc\+\_\+ptr\+\_\+2d\+\_\+2arg (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:), pointer}]{ptr,  }\item[{integer, intent(in)}]{ni,  }\item[{integer, intent(in)}]{nj }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Allocate a pointer to a 2-\/d array based on its dimension sizes. 


\begin{DoxyParams}[1]{Parameters}
 & {\em ptr} & A pointer to allocate\\
\hline
\mbox{\tt in}  & {\em ni} & The size of the 1st dimension of the array\\
\hline
\mbox{\tt in}  & {\em nj} & The size of the 2nd dimension of the array \\
\hline
\end{DoxyParams}


Definition at line 51 of file M\+O\+M\+\_\+safe\+\_\+alloc.\+F90.


\begin{DoxyCode}
51   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{pointer} :: ptr\textcolor{comment}{ !< A pointer to allocate}
52   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: ni\textcolor{comment}{ !< The size of the 1st dimension of the array}
53   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: nj\textcolor{comment}{ !< The size of the 2nd dimension of the array}
54   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(ptr)) \textcolor{keywordflow}{then}
55     \textcolor{keyword}{allocate}(ptr(ni,nj))
56     ptr(:,:) = 0.0
57 \textcolor{keywordflow}{  endif}
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__safe__alloc_a70e67bdc39ad0edb1f40b0ba533d44d5}\label{namespacemom__safe__alloc_a70e67bdc39ad0edb1f40b0ba533d44d5}} 
\index{mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}!safe\+\_\+alloc\+\_\+ptr\+\_\+3d@{safe\+\_\+alloc\+\_\+ptr\+\_\+3d}}
\index{safe\+\_\+alloc\+\_\+ptr\+\_\+3d@{safe\+\_\+alloc\+\_\+ptr\+\_\+3d}!mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}}
\subsubsection{\texorpdfstring{safe\+\_\+alloc\+\_\+ptr\+\_\+3d()}{safe\_alloc\_ptr\_3d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+safe\+\_\+alloc\+::safe\+\_\+alloc\+\_\+ptr\+\_\+3d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:), pointer}]{ptr,  }\item[{integer, intent(in)}]{is,  }\item[{integer, intent(in)}]{ie,  }\item[{integer, intent(in)}]{js,  }\item[{integer, intent(in)}]{je,  }\item[{integer, intent(in)}]{nk }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Allocate a pointer to a 3-\/d array based on its index starting and ending values. 


\begin{DoxyParams}[1]{Parameters}
 & {\em ptr} & A pointer to allocate\\
\hline
\mbox{\tt in}  & {\em is} & The start index to allocate for the 1st dimension\\
\hline
\mbox{\tt in}  & {\em ie} & The end index to allocate for the 1st dimension\\
\hline
\mbox{\tt in}  & {\em js} & The start index to allocate for the 2nd dimension\\
\hline
\mbox{\tt in}  & {\em je} & The end index to allocate for the 2nd dimension\\
\hline
\mbox{\tt in}  & {\em nk} & The size to allocate for the 3rd dimension \\
\hline
\end{DoxyParams}


Definition at line 87 of file M\+O\+M\+\_\+safe\+\_\+alloc.\+F90.


\begin{DoxyCode}
87   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{pointer} :: ptr\textcolor{comment}{ !< A pointer to allocate}
88   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: is\textcolor{comment}{ !< The start index to allocate for the 1st dimension}
89   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: ie\textcolor{comment}{ !< The end index to allocate for the 1st dimension}
90   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: js\textcolor{comment}{ !< The start index to allocate for the 2nd dimension}
91   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: je\textcolor{comment}{ !< The end index to allocate for the 2nd dimension}
92   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: nk\textcolor{comment}{ !< The size to allocate for the 3rd dimension}
93   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(ptr)) \textcolor{keywordflow}{then}
94     \textcolor{keyword}{allocate}(ptr(is:ie,js:je,nk))
95     ptr(:,:,:) = 0.0
96 \textcolor{keywordflow}{  endif}
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__safe__alloc_ab9e23cc5ed4635454b4412aa0eb8a4c4}\label{namespacemom__safe__alloc_ab9e23cc5ed4635454b4412aa0eb8a4c4}} 
\index{mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}!safe\+\_\+alloc\+\_\+ptr\+\_\+3d\+\_\+3arg@{safe\+\_\+alloc\+\_\+ptr\+\_\+3d\+\_\+3arg}}
\index{safe\+\_\+alloc\+\_\+ptr\+\_\+3d\+\_\+3arg@{safe\+\_\+alloc\+\_\+ptr\+\_\+3d\+\_\+3arg}!mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}}
\subsubsection{\texorpdfstring{safe\+\_\+alloc\+\_\+ptr\+\_\+3d\+\_\+3arg()}{safe\_alloc\_ptr\_3d\_3arg()}}
{\footnotesize\ttfamily subroutine mom\+\_\+safe\+\_\+alloc\+::safe\+\_\+alloc\+\_\+ptr\+\_\+3d\+\_\+3arg (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:), pointer}]{ptr,  }\item[{integer, intent(in)}]{ni,  }\item[{integer, intent(in)}]{nj,  }\item[{integer, intent(in)}]{nk }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Allocate a pointer to a 3-\/d array based on its dimension sizes. 


\begin{DoxyParams}[1]{Parameters}
 & {\em ptr} & A pointer to allocate\\
\hline
\mbox{\tt in}  & {\em ni} & The size of the 1st dimension of the array\\
\hline
\mbox{\tt in}  & {\em nj} & The size of the 2nd dimension of the array\\
\hline
\mbox{\tt in}  & {\em nk} & The size of the 3rd dimension of the array \\
\hline
\end{DoxyParams}


Definition at line 62 of file M\+O\+M\+\_\+safe\+\_\+alloc.\+F90.


\begin{DoxyCode}
62   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{pointer} :: ptr\textcolor{comment}{ !< A pointer to allocate}
63   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: ni\textcolor{comment}{ !< The size of the 1st dimension of the array}
64   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: nj\textcolor{comment}{ !< The size of the 2nd dimension of the array}
65   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: nk\textcolor{comment}{ !< The size of the 3rd dimension of the array}
66   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(ptr)) \textcolor{keywordflow}{then}
67     \textcolor{keyword}{allocate}(ptr(ni,nj,nk))
68     ptr(:,:,:) = 0.0
69 \textcolor{keywordflow}{  endif}
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__safe__alloc_a6168c61b47b5e57b72f1481625076421}\label{namespacemom__safe__alloc_a6168c61b47b5e57b72f1481625076421}} 
\index{mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}!safe\+\_\+alloc\+\_\+ptr\+\_\+3d\+\_\+6arg@{safe\+\_\+alloc\+\_\+ptr\+\_\+3d\+\_\+6arg}}
\index{safe\+\_\+alloc\+\_\+ptr\+\_\+3d\+\_\+6arg@{safe\+\_\+alloc\+\_\+ptr\+\_\+3d\+\_\+6arg}!mom\+\_\+safe\+\_\+alloc@{mom\+\_\+safe\+\_\+alloc}}
\subsubsection{\texorpdfstring{safe\+\_\+alloc\+\_\+ptr\+\_\+3d\+\_\+6arg()}{safe\_alloc\_ptr\_3d\_6arg()}}
{\footnotesize\ttfamily subroutine mom\+\_\+safe\+\_\+alloc\+::safe\+\_\+alloc\+\_\+ptr\+\_\+3d\+\_\+6arg (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:), pointer}]{ptr,  }\item[{integer, intent(in)}]{is,  }\item[{integer, intent(in)}]{ie,  }\item[{integer, intent(in)}]{js,  }\item[{integer, intent(in)}]{je,  }\item[{integer, intent(in)}]{ks,  }\item[{integer, intent(in)}]{ke }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Allocate a pointer to a 3-\/d array based on its index starting and ending values. 


\begin{DoxyParams}[1]{Parameters}
 & {\em ptr} & A pointer to allocate\\
\hline
\mbox{\tt in}  & {\em is} & The start index to allocate for the 1st dimension\\
\hline
\mbox{\tt in}  & {\em ie} & The end index to allocate for the 1st dimension\\
\hline
\mbox{\tt in}  & {\em js} & The start index to allocate for the 2nd dimension\\
\hline
\mbox{\tt in}  & {\em je} & The end index to allocate for the 2nd dimension\\
\hline
\mbox{\tt in}  & {\em ks} & The start index to allocate for the 3rd dimension\\
\hline
\mbox{\tt in}  & {\em ke} & The end index to allocate for the 3rd dimension \\
\hline
\end{DoxyParams}


Definition at line 101 of file M\+O\+M\+\_\+safe\+\_\+alloc.\+F90.


\begin{DoxyCode}
101   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{pointer} :: ptr\textcolor{comment}{ !< A pointer to allocate}
102   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: is\textcolor{comment}{ !< The start index to allocate for the 1st dimension}
103   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: ie\textcolor{comment}{ !< The end index to allocate for the 1st dimension}
104   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: js\textcolor{comment}{ !< The start index to allocate for the 2nd dimension}
105   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: je\textcolor{comment}{ !< The end index to allocate for the 2nd dimension}
106   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: ks\textcolor{comment}{ !< The start index to allocate for the 3rd dimension}
107   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: ke\textcolor{comment}{ !< The end index to allocate for the 3rd dimension}
108   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(ptr)) \textcolor{keywordflow}{then}
109     \textcolor{keyword}{allocate}(ptr(is:ie,js:je,ks:ke))
110     ptr(:,:,:) = 0.0
111 \textcolor{keywordflow}{  endif}
\end{DoxyCode}
