\doxysection{Vcom class}
\label{a00048}\index{Vcom class@{Vcom class}}


Virtual (currently just MPI) communications layer.  


\doxysubsubsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ vcom.\+h}
\begin{DoxyCompactList}\small\item\em Class Vcom\+: virtual (currently just MPI) communications layer. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ s\+Vcom}
\begin{DoxyCompactList}\small\item\em Contains public data members for Vcom class. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef struct \textbf{ s\+Vcom} \textbf{ Vcom}
\begin{DoxyCompactList}\small\item\em Declaration of the Vcom class as the Vcom structure ~\newline
 \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \textbf{ Vcom\+\_\+init} (int $\ast$argc, char $\ast$$\ast$$\ast$argv)
\begin{DoxyCompactList}\small\item\em The Vmp initializer. \end{DoxyCompactList}\item 
int \textbf{ Vcom\+\_\+finalize} (void)
\begin{DoxyCompactList}\small\item\em The Vmp finalizer. \end{DoxyCompactList}\item 
\textbf{ Vcom} $\ast$ \textbf{ Vcom\+\_\+ctor} (int commtype)
\begin{DoxyCompactList}\small\item\em Construct the communications object. This routine sets up data members of class and initializes MPI. \end{DoxyCompactList}\item 
int \textbf{ Vcom\+\_\+ctor2} (\textbf{ Vcom} $\ast$thee, int commtype)
\begin{DoxyCompactList}\small\item\em Construct the communications object. This routine sets up data members of class and initializes MPI. This is broken into two parts to be callable from FORTRAN. \end{DoxyCompactList}\item 
void \textbf{ Vcom\+\_\+dtor} (\textbf{ Vcom} $\ast$$\ast$thee)
\begin{DoxyCompactList}\small\item\em Destroy the communications object. \end{DoxyCompactList}\item 
void \textbf{ Vcom\+\_\+dtor2} (\textbf{ Vcom} $\ast$thee)
\begin{DoxyCompactList}\small\item\em Destroy the communications object. This is broken into two parts to be callable from FORTRAN. \end{DoxyCompactList}\item 
int \textbf{ Vcom\+\_\+send} (\textbf{ Vcom} $\ast$thee, int des, void $\ast$buf, int len, int type, int block)
\begin{DoxyCompactList}\small\item\em Send a buffer. Returns 1 on success. \end{DoxyCompactList}\item 
int \textbf{ Vcom\+\_\+recv} (\textbf{ Vcom} $\ast$thee, int src, void $\ast$buf, int len, int type, int block)
\begin{DoxyCompactList}\small\item\em Receive a (character) buffer. ~\newline
 The blocking flag is present, but not used. All receives are assumed to be blocking. A non-\/blocking receive would be {\itshape very} ugly to implement (signals or something?). \end{DoxyCompactList}\item 
int \textbf{ Vcom\+\_\+get\+Count} (\textbf{ Vcom} $\ast$thee, int src, int $\ast$length, int type)
\begin{DoxyCompactList}\small\item\em Perform a blocking probe to get the length (in number of items of specified type) of an incoming message and place it in the ~\newline
 argument \`{}\`{}length"{}. \end{DoxyCompactList}\item 
int \textbf{ Vcom\+\_\+reduce} (\textbf{ Vcom} $\ast$thee, void $\ast$sendbuf, void $\ast$recvbuf, int length, int type, int op)
\begin{DoxyCompactList}\small\item\em Perform a reduction of the data across all processors. This is equivalent (and in the case of MPI is identical to) MPI\+\_\+\+Allreduce. Basically, the specified operations are appleed to each member of ~\newline
 the sendbuf across all processors and the results are written to recvbuf. \end{DoxyCompactList}\item 
int \textbf{ Vcom\+\_\+size} (\textbf{ Vcom} $\ast$thee)
\begin{DoxyCompactList}\small\item\em Get the number of PEs in communicator. \end{DoxyCompactList}\item 
int \textbf{ Vcom\+\_\+resize} (\textbf{ Vcom} $\ast$thee, int newsize)
\begin{DoxyCompactList}\small\item\em Resize (shrink) the communications group to include only newsize number of processors. ~\newline
 Obsolete processes are given rank of -\/1 and size of 0. \end{DoxyCompactList}\item 
int \textbf{ Vcom\+\_\+rank} (\textbf{ Vcom} $\ast$thee)
\begin{DoxyCompactList}\small\item\em Get the ID of the local PE ~\newline
 \end{DoxyCompactList}\item 
int \textbf{ Vcom\+\_\+barr} (\textbf{ Vcom} $\ast$thee)
\begin{DoxyCompactList}\small\item\em Synchronization barrier. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Virtual (currently just MPI) communications layer. 



\doxysubsection{Typedef Documentation}
\index{Vcom class@{Vcom class}!Vcom@{Vcom}}
\index{Vcom@{Vcom}!Vcom class@{Vcom class}}
\doxysubsubsection{Vcom}
{\footnotesize\ttfamily \label{a00048_ga820c01ebd185aba8388ae8ed1147bd28} 
typedef struct \textbf{ s\+Vcom} \textbf{ Vcom}}



Declaration of the Vcom class as the Vcom structure ~\newline
 

\begin{DoxyAuthor}{Author}
Michael Holst 
\end{DoxyAuthor}
\begin{DoxyReturn}{Returns}
None 
\end{DoxyReturn}


\doxysubsection{Function Documentation}
\index{Vcom class@{Vcom class}!Vcom\_barr@{Vcom\_barr}}
\index{Vcom\_barr@{Vcom\_barr}!Vcom class@{Vcom class}}
\doxysubsubsection{Vcom\_barr()}
{\footnotesize\ttfamily \label{a00048_ga93383b73062cd592a6752565fb1a6cdf} 
int Vcom\+\_\+barr (\begin{DoxyParamCaption}\item[{\textbf{ Vcom} $\ast$}]{thee}{}\end{DoxyParamCaption})}



Synchronization barrier. 

\begin{DoxyAuthor}{Author}
Michael Holst 
\end{DoxyAuthor}
\begin{DoxyNote}{Note}
Class Vcom\+: Non-\/\+Inlineable methods (vcom.\+c) 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
1 if successful. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em thee} & Pointer to the communications object \\
\hline
\end{DoxyParams}
\index{Vcom class@{Vcom class}!Vcom\_ctor@{Vcom\_ctor}}
\index{Vcom\_ctor@{Vcom\_ctor}!Vcom class@{Vcom class}}
\doxysubsubsection{Vcom\_ctor()}
{\footnotesize\ttfamily \label{a00048_ga40356083b37881afa383fc4d9601ea91} 
\textbf{ Vcom} $\ast$ Vcom\+\_\+ctor (\begin{DoxyParamCaption}\item[{int}]{commtype}{}\end{DoxyParamCaption})}



Construct the communications object. This routine sets up data members of class and initializes MPI. 

\begin{DoxyAuthor}{Author}
Michael Holst 
\end{DoxyAuthor}
\begin{DoxyNote}{Note}
Class Vcom\+: Non-\/\+Inlineable methods (vcom.\+c) 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Pointer to the new allocated communications object. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em commtype} & type of communications object \\
\hline
\end{DoxyParams}
\index{Vcom class@{Vcom class}!Vcom\_ctor2@{Vcom\_ctor2}}
\index{Vcom\_ctor2@{Vcom\_ctor2}!Vcom class@{Vcom class}}
\doxysubsubsection{Vcom\_ctor2()}
{\footnotesize\ttfamily \label{a00048_ga2c81bdd58a94b739bc1b240afb5e2203} 
int Vcom\+\_\+ctor2 (\begin{DoxyParamCaption}\item[{\textbf{ Vcom} $\ast$}]{thee}{, }\item[{int}]{commtype}{}\end{DoxyParamCaption})}



Construct the communications object. This routine sets up data members of class and initializes MPI. This is broken into two parts to be callable from FORTRAN. 

\begin{DoxyAuthor}{Authors}
Nathan Baker and Michael Holst 
\end{DoxyAuthor}
\begin{DoxyNote}{Note}
Class Vcom\+: Non-\/\+Inlineable methods (vcom.\+c) 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Success enumeration 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em thee} & Pointer to the new allocated communications object. \\
\hline
{\em commtype} & type of communications object \\
\hline
\end{DoxyParams}
\index{Vcom class@{Vcom class}!Vcom\_dtor@{Vcom\_dtor}}
\index{Vcom\_dtor@{Vcom\_dtor}!Vcom class@{Vcom class}}
\doxysubsubsection{Vcom\_dtor()}
{\footnotesize\ttfamily \label{a00048_ga9b51803f417c4ce15ed961f643bb1cf0} 
void Vcom\+\_\+dtor (\begin{DoxyParamCaption}\item[{\textbf{ Vcom} $\ast$$\ast$}]{thee}{}\end{DoxyParamCaption})}



Destroy the communications object. 

\begin{DoxyAuthor}{Authors}
Nathan Baker and Michael Holst 
\end{DoxyAuthor}
\begin{DoxyNote}{Note}
Class Vcom\+: Non-\/\+Inlineable methods (vcom.\+c) 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em thee} & Pointer to the communications object. \\
\hline
\end{DoxyParams}
\index{Vcom class@{Vcom class}!Vcom\_dtor2@{Vcom\_dtor2}}
\index{Vcom\_dtor2@{Vcom\_dtor2}!Vcom class@{Vcom class}}
\doxysubsubsection{Vcom\_dtor2()}
{\footnotesize\ttfamily \label{a00048_gafd89d6360a1fa93e6a5ccd6441511003} 
void Vcom\+\_\+dtor2 (\begin{DoxyParamCaption}\item[{\textbf{ Vcom} $\ast$}]{thee}{}\end{DoxyParamCaption})}



Destroy the communications object. This is broken into two parts to be callable from FORTRAN. 

\begin{DoxyAuthor}{Authors}
Nathan Baker and Michael Holst 
\end{DoxyAuthor}
\begin{DoxyNote}{Note}
Class Vcom\+: Non-\/\+Inlineable methods (vcom.\+c) 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em thee} & Pointer to the communications object. \\
\hline
\end{DoxyParams}
\index{Vcom class@{Vcom class}!Vcom\_finalize@{Vcom\_finalize}}
\index{Vcom\_finalize@{Vcom\_finalize}!Vcom class@{Vcom class}}
\doxysubsubsection{Vcom\_finalize()}
{\footnotesize\ttfamily \label{a00048_ga87b053d37ce352967167af68a8a3c0d8} 
int Vcom\+\_\+finalize (\begin{DoxyParamCaption}\item[{void}]{}{}\end{DoxyParamCaption})}



The Vmp finalizer. 

\begin{DoxyAuthor}{Author}
Michael Holst 
\end{DoxyAuthor}
\begin{DoxyNote}{Note}
Class Vcom\+: Non-\/\+Inlineable methods (vcom.\+c) 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Success enumeration 
\end{DoxyReturn}
\index{Vcom class@{Vcom class}!Vcom\_getCount@{Vcom\_getCount}}
\index{Vcom\_getCount@{Vcom\_getCount}!Vcom class@{Vcom class}}
\doxysubsubsection{Vcom\_getCount()}
{\footnotesize\ttfamily \label{a00048_gaf5d0ecbc5915dfa9b48224f7a70c9916} 
int Vcom\+\_\+get\+Count (\begin{DoxyParamCaption}\item[{\textbf{ Vcom} $\ast$}]{thee}{, }\item[{int}]{src}{, }\item[{int $\ast$}]{length}{, }\item[{int}]{type}{}\end{DoxyParamCaption})}



Perform a blocking probe to get the length (in number of items of specified type) of an incoming message and place it in the ~\newline
 argument \`{}\`{}length"{}. 

\begin{DoxyAuthor}{Author}
Nathan Baker 
\end{DoxyAuthor}
\begin{DoxyNote}{Note}
Class Vcom\+: Non-\/\+Inlineable methods (vcom.\+c) 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Success enumeration 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em thee} & Pointer to the communications object. \\
\hline
{\em src} & rank of receiving processor \\
\hline
{\em length} & Pointer to perform a blocking probe \\
\hline
{\em type} & type of items in message. ~\newline
 0 =$>$ MPI\+\_\+\+BYTE, 1 =$>$ MPI\+\_\+\+INT, 2 =$>$ MPI\+\_\+\+DOUBLE, 3 =$>$ MPI\+\_\+\+CHAR \\
\hline
\end{DoxyParams}
\index{Vcom class@{Vcom class}!Vcom\_init@{Vcom\_init}}
\index{Vcom\_init@{Vcom\_init}!Vcom class@{Vcom class}}
\doxysubsubsection{Vcom\_init()}
{\footnotesize\ttfamily \label{a00048_ga6846ecfd2733b3de784a995927aaaba2} 
int Vcom\+\_\+init (\begin{DoxyParamCaption}\item[{int $\ast$}]{argc}{, }\item[{char $\ast$$\ast$$\ast$}]{argv}{}\end{DoxyParamCaption})}



The Vmp initializer. 

\begin{DoxyAuthor}{Author}
Michael Holst 
\end{DoxyAuthor}
\begin{DoxyNote}{Note}
Class Vcom\+: Non-\/\+Inlineable methods (vcom.\+c) 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Success enumeration 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em argc} & number of the command line arguments \\
\hline
{\em argv} & the command line arguments \\
\hline
\end{DoxyParams}
\index{Vcom class@{Vcom class}!Vcom\_rank@{Vcom\_rank}}
\index{Vcom\_rank@{Vcom\_rank}!Vcom class@{Vcom class}}
\doxysubsubsection{Vcom\_rank()}
{\footnotesize\ttfamily \label{a00048_ga0b74c7becd865db338bc67a31ecb9c5c} 
int Vcom\+\_\+rank (\begin{DoxyParamCaption}\item[{\textbf{ Vcom} $\ast$}]{thee}{}\end{DoxyParamCaption})}



Get the ID of the local PE ~\newline
 

\begin{DoxyAuthor}{Authors}
Nathan Baker and Michael Holst 
\end{DoxyAuthor}
\begin{DoxyNote}{Note}
Class Vcom\+: Non-\/\+Inlineable methods (vcom.\+c) 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Get the ID of the local PE 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em thee} & Pointer to the communications object \\
\hline
\end{DoxyParams}
\index{Vcom class@{Vcom class}!Vcom\_recv@{Vcom\_recv}}
\index{Vcom\_recv@{Vcom\_recv}!Vcom class@{Vcom class}}
\doxysubsubsection{Vcom\_recv()}
{\footnotesize\ttfamily \label{a00048_ga9d0c8f9c3dcd65a9f461d8bfc7817e66} 
int Vcom\+\_\+recv (\begin{DoxyParamCaption}\item[{\textbf{ Vcom} $\ast$}]{thee}{, }\item[{int}]{src}{, }\item[{void $\ast$}]{buf}{, }\item[{int}]{len}{, }\item[{int}]{type}{, }\item[{int}]{block}{}\end{DoxyParamCaption})}



Receive a (character) buffer. ~\newline
 The blocking flag is present, but not used. All receives are assumed to be blocking. A non-\/blocking receive would be {\itshape very} ugly to implement (signals or something?). 

\begin{DoxyAuthor}{Authors}
Nathan Baker and Michael Holst ~\newline
 
\end{DoxyAuthor}
\begin{DoxyNote}{Note}
Class Vcom\+: Non-\/\+Inlineable methods (vcom.\+c) 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
1 if successful 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em thee} & Pointer to the communications object. \\
\hline
{\em src} & rank of receiving processor \\
\hline
{\em buf} & pointer to buffer of previously allocated memory \\
\hline
{\em len} & number of items (of declared type) in buffer \\
\hline
{\em type} & type of items in message. ~\newline
 ~\newline
 0 =$>$ MPI\+\_\+\+BYTE, 1 =$>$ MPI\+\_\+\+INT, 2 =$>$ MPI\+\_\+\+DOUBLE, 3 =$>$ MPI\+\_\+\+CHAR \\
\hline
{\em block} & toggles blocking on (=1) and off (=0) \\
\hline
\end{DoxyParams}
\index{Vcom class@{Vcom class}!Vcom\_reduce@{Vcom\_reduce}}
\index{Vcom\_reduce@{Vcom\_reduce}!Vcom class@{Vcom class}}
\doxysubsubsection{Vcom\_reduce()}
{\footnotesize\ttfamily \label{a00048_ga3ca5e19921a4eb7b38554bda4df1fa19} 
int Vcom\+\_\+reduce (\begin{DoxyParamCaption}\item[{\textbf{ Vcom} $\ast$}]{thee}{, }\item[{void $\ast$}]{sendbuf}{, }\item[{void $\ast$}]{recvbuf}{, }\item[{int}]{length}{, }\item[{int}]{type}{, }\item[{int}]{op}{}\end{DoxyParamCaption})}



Perform a reduction of the data across all processors. This is equivalent (and in the case of MPI is identical to) MPI\+\_\+\+Allreduce. Basically, the specified operations are appleed to each member of ~\newline
 the sendbuf across all processors and the results are written to recvbuf. 

\begin{DoxyAuthor}{Author}
Nathan Baker 
\end{DoxyAuthor}
\begin{DoxyNote}{Note}
Class Vcom\+: Non-\/\+Inlineable methods (vcom.\+c) 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Success enumeration 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em thee} & Pointer to the communications object \\
\hline
{\em sendbuf} & buffer containing {\ttfamily length} items of the specified type to be operated on \\
\hline
{\em recvbuf} & buffer containing {\ttfamily length} items of the specified type after operation \\
\hline
{\em length} & number of items \\
\hline
{\em type} & type of items in message ~\newline
 0 =$>$ MPI\+\_\+\+BYTE, 1 =$>$ MPI\+\_\+\+INT, 2 =$>$ MPI\+\_\+\+DOUBLE, 3 =$>$ MPI\+\_\+\+CHAR \\
\hline
{\em op} & operation to perform ~\newline
 0 =$>$ MPI\+\_\+\+SUM, 1 =$>$ MPI\+\_\+\+PROD, 2 =$>$ MPI\+\_\+\+MIN, 3 =$>$ MPI\+\_\+\+MAX \\
\hline
\end{DoxyParams}
\index{Vcom class@{Vcom class}!Vcom\_resize@{Vcom\_resize}}
\index{Vcom\_resize@{Vcom\_resize}!Vcom class@{Vcom class}}
\doxysubsubsection{Vcom\_resize()}
{\footnotesize\ttfamily \label{a00048_ga184e2fcc4f26351475b5448fbe506ea1} 
int Vcom\+\_\+resize (\begin{DoxyParamCaption}\item[{\textbf{ Vcom} $\ast$}]{thee}{, }\item[{int}]{newsize}{}\end{DoxyParamCaption})}



Resize (shrink) the communications group to include only newsize number of processors. ~\newline
 Obsolete processes are given rank of -\/1 and size of 0. 

\begin{DoxyAuthor}{Author}
Nathan Baker 
\end{DoxyAuthor}
\begin{DoxyNote}{Note}
Class Vcom\+: Non-\/\+Inlineable methods (vcom.\+c) 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
1 if successful 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em thee} & Pointer to the communications object \\
\hline
{\em newsize} & number of processors \\
\hline
\end{DoxyParams}
\index{Vcom class@{Vcom class}!Vcom\_send@{Vcom\_send}}
\index{Vcom\_send@{Vcom\_send}!Vcom class@{Vcom class}}
\doxysubsubsection{Vcom\_send()}
{\footnotesize\ttfamily \label{a00048_gaf8bfc9f3adb8a9ab879fb727a7131d6b} 
int Vcom\+\_\+send (\begin{DoxyParamCaption}\item[{\textbf{ Vcom} $\ast$}]{thee}{, }\item[{int}]{des}{, }\item[{void $\ast$}]{buf}{, }\item[{int}]{len}{, }\item[{int}]{type}{, }\item[{int}]{block}{}\end{DoxyParamCaption})}



Send a buffer. Returns 1 on success. 

\begin{DoxyAuthor}{Authors}
Nathan Baker and Michael Holst 
\end{DoxyAuthor}
\begin{DoxyNote}{Note}
Class Vcom\+: Non-\/\+Inlineable methods (vcom.\+c) 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
1 if successful 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em thee} & Pointer to the communications object. \\
\hline
{\em des} & rank of receiving processor \\
\hline
{\em buf} & buffer containing message \\
\hline
{\em len} & number of items (of declared type) in buffer \\
\hline
{\em type} & type of items in message. ~\newline
 0 =$>$ MPI\+\_\+\+BYTE, 1 =$>$ MPI\+\_\+\+INT, 2 =$>$ MPI\+\_\+\+DOUBLE, 3 =$>$ MPI\+\_\+\+CHAR \\
\hline
{\em block} & toggles blocking on (=1) and off (=0) \\
\hline
\end{DoxyParams}
\index{Vcom class@{Vcom class}!Vcom\_size@{Vcom\_size}}
\index{Vcom\_size@{Vcom\_size}!Vcom class@{Vcom class}}
\doxysubsubsection{Vcom\_size()}
{\footnotesize\ttfamily \label{a00048_ga2d0360979d6715b199291cc25879fd7b} 
int Vcom\+\_\+size (\begin{DoxyParamCaption}\item[{\textbf{ Vcom} $\ast$}]{thee}{}\end{DoxyParamCaption})}



Get the number of PEs in communicator. 

\begin{DoxyAuthor}{Authors}
Nathan Baker Michael Holst 
\end{DoxyAuthor}
\begin{DoxyNote}{Note}
Class Vcom\+: Non-\/\+Inlineable methods (vcom.\+c) 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Number of PEs or -\/1 if error 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em thee} & Pointer to the communications object \\
\hline
\end{DoxyParams}
