1\par 2\section{Prototypes and descriptions of methods in the {\tt 3Misc} directory} 4\label{section:Misc:proto} 5\par 6This section contains brief descriptions including prototypes 7of all methods in the {\tt Misc} directory. 8\par 9%======================================================================= 10\subsection{Theoretical nested dissection methods} 11\begin{enumerate} 12%----------------------------------------------------------------------- 13\item 14\begin{verbatim} 15void mkNDperm ( int n1, int n2, int n3, int newToOld[], int west, 16 int east, int south, int north, int bottom, int top ) ; 17\end{verbatim} 18\index{mkNDperm@{\tt mkNDperm()}} 19This method this vector fills a permutation vector with the 20nested dissection 21new-to-old ordering of the vertices for the subgrid defined by 22nodes whose coordinates lie in 23\begin{verbatim} 24[west, east] x [south, north] x [bottom, top]. 25\end{verbatim} 26The method calls itself recursively. 27To find the permutation for an {\tt n1 x n2 x n3} grid, call 28\begin{verbatim} 29mkNDperm(n1, n2, n3, newToOld, 0, n1-1, 0, n2-1, 0, n3-1) ; 30\end{verbatim} 31from a driver program. 32\par \noindent {\it Error checking:} 33If {\tt n1}, {\tt n2} or {\tt n3} are less than or equal to zero, 34or if {\tt newToOld} is {\tt NULL}, 35or if {\tt west}, {\tt south} or {\tt bottom} 36are less than or equal to zero, 37of if ${\tt east} \ge {\tt n1}$, 38of if ${\tt north} \ge {\tt n2}$, 39of if ${\tt top} \ge {\tt n3}$, 40an error message is printed and the program exits. 41%----------------------------------------------------------------------- 42\item 43\begin{verbatim} 44void mkNDperm2 ( int n1, int n2, int n3, int newToOld[], int west, 45 int east, int south, int north, int bottom, int top ) ; 46\end{verbatim} 47\index{mkNDperm2@{\tt mkNDperm2()}} 48This method this vector fills a permutation vector with the 49nested dissection 50new-to-old ordering of the vertices for the subgrid defined by 51nodes whose coordinates lie in 52\begin{verbatim} 53[west, east] x [south, north] x [bottom, top]. 54\end{verbatim} 55There is one important difference between this method and {\tt 56mkNDperm()} above; this method finds {\it double-wide} separators, 57necessary for an operator with more than nearest neighbor grid 58point coupling. 59The method calls itself recursively. 60To find the permutation for an {\tt n1 x n2 x n3} grid, call 61\begin{verbatim} 62mkNDperm(n1, n2, n3, newToOld, 0, n1-1, 0, n2-1, 0, n3-1) ; 63\end{verbatim} 64from a driver program. 65\par \noindent {\it Error checking:} 66If {\tt n1}, {\tt n2} or {\tt n3} are less than or equal to zero, 67or if {\tt newToOld} is {\tt NULL}, 68or if {\tt west}, {\tt south} or {\tt bottom} 69are less than or equal to zero, 70of if ${\tt east} \ge {\tt n1}$, 71of if ${\tt north} \ge {\tt n2}$, 72of if ${\tt top} \ge {\tt n3}$, 73an error message is printed and the program exits. 74%----------------------------------------------------------------------- 75\item 76\begin{verbatim} 77void localND2D ( int n1, int n2, int p1, int p2, 78 int dsizes1[], int dsizes2[], int oldToNew[] ) ; 79\end{verbatim} 80\index{localND2D@{\tt localND2D()}} 81This method finds a local nested dissection ordering 82\cite{bha93-localND} for an {\tt n1 x n2} 2-D grid. 83There are {\tt p1 x p2} domains in the grid. 84The {\tt dsizes1[]} and {\tt dsizes2[]} vectors are optional; 85they allow the user to explicitly input domain sizes. 86If {\tt dsizes1[]} and {\tt dsizes2[]} are not {\tt NULL}, 87the {\tt q = q1 + q2*p1}'th domain contains a 88{\tt dsizes1[q1] x dsizes2[q2]} subgrid of points. 89\par \noindent {\it Error checking:} 90If {\tt n1} or {\tt n2} are less than or equal to zero, 91or if {\tt p1} or {\tt p2} are less than or equal to zero, 92or if $2{\tt p1} - 1 > {\tt n1}$, 93or if $2{\tt p2} - 1 > {\tt n2}$, 94or if {\tt oldToNew} is {\tt NULL}, 95or if {\tt dsizes1[]} and {\tt dsizes2[]} are not {\tt NULL} 96but have invalid entries (all entries must be positive, 97entries in {\tt dsizes1[]} must sum to {\tt n1 - p1 + 1}, 98and 99entries in {\tt dsizes2[]} must sum to {\tt n2 - p2 + 1}, 100an error message is printed and the program exits. 101%----------------------------------------------------------------------- 102\item 103\begin{verbatim} 104void localND3D ( int n1, int n2, int n3, int p1, int p2, int p3, 105 int dsizes1[], int dsizes2[], int dsizes3[], 106 int oldToNew[] ) ; 107\end{verbatim} 108\index{localND3D@{\tt localND3D()}} 109This method finds a local nested dissection ordering 110\cite{bha93-localND} for an {\tt n1 x n2 x n3} 3-D grid. 111There are {\tt p1 x p2 x p3} domains in the grid. 112The {\tt q}'th domain contains a 113{\tt dsizes1[q] x dsizes2[q] x dsizes3[q]} 114subgrid of points. 115The {\tt dsizes1[]}, {\tt dsizes2[]} and {\tt dsizes3[]} vectors 116are optional; 117they allow the user to explicitly input domain sizes. 118If {\tt dsizes1[]}, {\tt dsizes2[]} and {\tt dsizes3[]} 119are not {\tt NULL}, 120the {\tt q = q1 + q2*p1+ q3*p1*p2}'th domain contains a 121{\tt dsizes1[q1] x dsizes2[q2] x disizes3[q3]} subgrid of points. 122\par \noindent {\it Error checking:} 123If {\tt n1}, {\tt n2} or {\tt n3} are less than or equal to zero, 124or if {\tt p1}, {\tt p2} or {\tt p3} are less than or equal to zero, 125or if $2{\tt p1} - 1 > {\tt n1}$, 126or if $2{\tt p2} - 1 > {\tt n2}$, 127or if $2{\tt p3} - 1 > {\tt n3}$, 128or if {\tt oldToNew} is {\tt NULL}, 129or if {\tt dsizes1[]}, {\tt disizes2[]} and {\tt dsizes3[]} 130are not {\tt NULL} 131but have invalid entries (all entries must be positive, 132entries in {\tt dsizes1[]} must sum to {\tt n1 - p1 + 1}, 133entries in {\tt dsizes2[]} must sum to {\tt n2 - p2 + 1}, 134and 135entries in {\tt dsizes3[]} must sum to {\tt n3 - p3 + 1}, 136an error message is printed and the program exits. 137%----------------------------------------------------------------------- 138\item 139\begin{verbatim} 140void fp2DGrid ( int n1, int n2, int ivec[], FILE *fp ) ; 141\end{verbatim} 142\index{fp2DGrid@{\tt fp2DGrid()}} 143This method writes the {\tt ivec[]} vector onto an {\tt n1 x n2} 144grid to file {\tt fp}. 145This is useful to visualize an ordering or a metric on a grid. 146\par \noindent {\it Error checking:} 147If {\tt n1} or {\tt n2} are less than or equal to zero, 148or if {\tt ivec} or {\tt fp} are {\tt NULL}, 149an error message is printed and the program exits. 150%----------------------------------------------------------------------- 151\item 152\begin{verbatim} 153void fp3DGrid ( int n1, int n2, int n3, int ivec[], FILE *fp ) ; 154\end{verbatim} 155\index{fp3DGrid@{\tt fp3DGrid()}} 156This method writes the {\tt ivec[]} vector onto an {\tt n1 x n2 x n3} 157grid to file {\tt fp}. 158This is useful to visualize an ordering or a metric on a grid. 159\par \noindent {\it Error checking:} 160If {\tt n1}, {\tt n2} or {\tt n3} are less than or equal to zero, 161or if {\tt ivec} or {\tt fp} are {\tt NULL}, 162an error message is printed and the program exits. 163%----------------------------------------------------------------------- 164\end{enumerate} 165\par 166%======================================================================= 167\subsection{Multiple minimum degree, Nested dissection 168 and multisection wrapper methods} 169\par 170There are three simple methods to find minimum degree, nested 171dissection and multisection orderings. 172In addition, there is one method that finds the better of two 173methods -- nested dissection and multisection. 174(Much of the work to find either nested dissection or multisection 175is identical, so this method takes little more time than either of 176the two separately.) 177\par 178To properly specify these methods there are many parameters 179--- these three wrapper methods insulate the user from all but one 180or two of the parameters. 181As a result, the quality of the ordering may not be as good as can 182be found by using non-default settings of the parameters. 183\par 184One wrapper method computes a minimum degree ordering --- the only 185input parameter is a random number seed. 186Two wrappers methods compute the nested dissection and multisection 187orderings --- in addition to a random number seed there is a upper 188bound on the subgraph size used during the graph partition. 189This is the most sensitive of the parameters. 190\par 191The user interested in more customized orderings should consult the 192chapters on the 193the {\tt GPart}, {\tt DSTree} and {\tt MSMD} objects 194that perform the three steps of the ordering process: 195perform an incomplete nested dissection of the graph, 196construct the map from vertices to stages in which they will be 197eliminated, and perform the multi-stage minimum degree ordering. 198The driver programs in the {\tt GPart} and {\tt MSMD} directories 199fully exercise the graph partition and ordering strategies by 200giving the user access to all input parameters. 201\par 202\begin{enumerate} 203%----------------------------------------------------------------------- 204\item 205\begin{verbatim} 206ETree * orderViaMMD ( Graph *graph, int seed, int msglvl, FILE *msgFile ) ; 207\end{verbatim} 208\index{orderViaMMD@{\tt orderViaMMD()}} 209This method returns a front tree {\tt ETree} object for a multiple 210minimum degree ordering of the graph {\tt graph}. 211The {\tt seed} parameter is a random number seed. 212The {\tt msglvl} and {\tt msgFile} parameters govern the 213diagnostics output. 214Use {\tt msglvl = 0} for no output, {\tt msglvl = 1} for timings 215and scalar statistics, and use {\tt msglvl > 1} with care, for it 216can generate huge amounts of output. 217\par \noindent {\it Error checking:} 218If {\tt graph} is {\tt NULL}, 219or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL}, 220an error message is printed and the program exits. 221%----------------------------------------------------------------------- 222\item 223\begin{verbatim} 224ETree * orderViaND ( Graph *graph, int maxdomainsize, int seed, 225 int msglvl, FILE *msgFile ) ; 226\end{verbatim} 227\index{orderViaND@{\tt orderViaND()}} 228This method returns a front tree {\tt ETree} object for a nested 229dissection ordering of the graph {\tt graph}. 230If a subgraph has more vertices than the {\tt maxdomainsize} parameter, 231it is split. 232The {\tt seed} parameter is a random number seed. 233The {\tt msglvl} and {\tt msgFile} parameters govern the 234diagnostics output. 235Use {\tt msglvl = 0} for no output, {\tt msglvl = 1} for timings 236and scalar statistics, and use {\tt msglvl > 1} with care, for it 237can generate huge amounts of output. 238\par \noindent {\it Error checking:} 239If {\tt graph} is {\tt NULL}, 240or if ${\tt maxdomainsize} \le 0$, 241or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL}, 242an error message is printed and the program exits. 243%----------------------------------------------------------------------- 244\item 245\begin{verbatim} 246ETree * orderViaMS ( Graph *graph, int maxdomainsize, int seed, 247 int msglvl, FILE *msgFile ) ; 248\end{verbatim} 249\index{orderViaMS@{\tt orderViaMS()}} 250This method returns a front tree {\tt ETree} object for a 251multisection ordering of the graph {\tt graph}. 252If a subgraph has more vertices than the {\tt maxdomainsize} parameter, 253it is split. 254The {\tt seed} parameter is a random number seed. 255The {\tt msglvl} and {\tt msgFile} parameters govern the 256diagnostics output. 257Use {\tt msglvl = 0} for no output, {\tt msglvl = 1} for timings 258and scalar statistics, and use {\tt msglvl > 1} with care, for it 259can generate huge amounts of output. 260\par \noindent {\it Error checking:} 261If {\tt graph} is {\tt NULL}, 262or if ${\tt maxdomainsize} \le 0$, 263or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL}, 264an error message is printed and the program exits. 265%----------------------------------------------------------------------- 266\item 267\begin{verbatim} 268ETree * orderViaBestOfNDandMS ( Graph *graph, int maxdomainsize, int maxzeros, 269 int maxsize, int seed, int msglvl, FILE *msgFile ) ; 270\end{verbatim} 271\index{orderViaBestOfNDandMS@{\tt orderViaBestOfNDandMS()}} 272This method returns a front tree {\tt ETree} object for a 273better of two orderings, a nested dissection 274and multisection ordering. 275If a subgraph has more vertices than the {\tt maxdomainsize} parameter, 276it is split. 277The {\tt seed} parameter is a random number seed. 278This method also transforms the front tree using the {\tt maxzeros} 279and {\tt maxsize} parameters. 280See the {\tt ETree\_transform()} method 281in Section~\ref{subsection:ETree:proto:transformation}. 282The {\tt msglvl} and {\tt msgFile} parameters govern the 283diagnostics output. 284Use {\tt msglvl = 0} for no output, {\tt msglvl = 1} for timings 285and scalar statistics, and use {\tt msglvl > 1} with care, for it 286can generate huge amounts of output. 287\par \noindent {\it Error checking:} 288If {\tt graph} is {\tt NULL}, 289or if ${\tt maxdomainsize} \le 0$, 290or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL}, 291an error message is printed and the program exits. 292%----------------------------------------------------------------------- 293\end{enumerate} 294\par 295%======================================================================= 296\subsection{Graph drawing method} 297\par 298\begin{enumerate} 299%----------------------------------------------------------------------- 300\item 301\begin{verbatim} 302void drawGraphEPS ( Graph *graph, Coords *coords, IV *tagsIV, 303 double bbox[4], double rect[4], double linewidth1, 304 double linewidth2, double radius, char *epsFileName, 305 int msglvl, FILE *msgFile ) ; 306\end{verbatim} 307\index{drawGraphEPS@{\tt drawGraphEPS()}} 308This method is used to create an EPS (Encapsulated Postscript) file 309that contains a picture of a graph in two dimensions. 310We use this to visualize separators and domain decompositions, 311mostly of regular grids and triangulations of a planar region. 312\par 313The {\tt graph} object defines the connectivity of the 314vertices. 315The {\tt coords} object defines the locations of the vertices. 316The {\tt tagsIV} object is used to define whether or not an edge 317is drawn between two vertices adjacent in the graph. 318When {\tt tagsIV} is not {\tt NULL}, 319if there is an edge {\tt (u,v)} in the graph and 320{\tt tags[u] = tags[v]}, then the edge with width {\tt linewidth1} 321is drawn. 322For edges {\tt (u,v)} in the graph and 323{\tt tags[u] != tags[v]}, then the edge with width {\tt linewidth2} 324is drawn, assuming ${\tt linewidth2} > 0$. 325If {\tt tagsIV} is {\tt NULL}, than all edges are drawn with 326width {\tt linewidth1}. 327Each vertex is draw with a filled circle with radius {\tt radius}. 328\par 329The graph and its {\tt Coords} object occupy a certain area in 2-D 330space. 331We try to plot the graph inside the area defined by the {\tt 332rect[]} array in such a manner that the relative scales are 333preserved (the graph is not stretched in either the $x$ or $y$ 334direction) and that the larger of the width and height of the graph 335fills the area defined by the {\tt rect[]} rectangle. 336{\it Note}: hacking postscript is {\it not} an area of expertise of 337either author. 338Some Postscript viewers give us messages that we are not obeying 339the format conventions (this we do not doubt), but we have never 340failed to view or print one of these files. 341\par \noindent {\it Error checking:} 342If the method is unable to open the file, 343an error message is printed and the program exits. 344%----------------------------------------------------------------------- 345\end{enumerate} 346\par 347%======================================================================= 348\subsection{Linear system construction} 349\par 350Our driver programs test linear systems where the matrices come 351from regular grids using nested dissection orderings. 352There are two methods that generate linear systems of this form 353along with the front tree and symbolic factorization. 354\par 355\begin{enumerate} 356%----------------------------------------------------------------------- 357\item 358\begin{verbatim} 359void mkNDlinsys ( int n1, int n2, int n3, int maxzeros, int maxsize, 360 int type, int symmetryflag, int nrhs, int seed, int msglvl, 361 FILE *msgFile, ETree **pfrontETree, IVL **psymbfacIVL, 362 InpMtx **pmtxA, DenseMtx **pmtxX, DenseMtx **pmtxB ) ; 363\end{verbatim} 364\index{mkNDlinsys@{\tt mkNDlinsys()}} 365This method creates a linear system $AX = B$ for a 366${\tt n1} \times {\tt n2} \times {\tt n3}$ grid. 367The entries in $A$ and $X$ are random numbers, 368$B$ is computed as the product of $A$ with $X$. 369$A$ can be real ({\tt type = 1}) or complex ({\tt type = 2}), 370and can be symmetric ({\tt symmetryflag = 0}), 371Hermitian ({\tt symmetryflag = 1}) or 372nonsymmetric ({\tt symmetryflag = 2}). 373The number of columns of $X$ is given by {\tt nrhs}. 374The linear system is ordered using theoretical nested dissection, 375and the front tree is transformed using the {\tt maxzeros} and {\tt 376maxsize} parameters. 377The addresses of the front tree, symbolic factorization, and three 378matrix objects are returned in the last five arguments of the 379calling sequence. 380\par \noindent {\it Error checking:} 381None presently. 382%----------------------------------------------------------------------- 383\item 384\begin{verbatim} 385void mkNDlinsysQR ( int n1, int n2, int n3, int type, int nrhs, int seed, 386 int msglvl, FILE *msgFile, ETree **pfrontETree, IVL **psymbfacIVL, 387 InpMtx **pmtxA, DenseMtx **pmtxX, DenseMtx **pmtxB ) ; 388\end{verbatim} 389\index{mkNDlinsysQR@{\tt mkNDlinsysQR()}} 390This method creates a linear system $AX = B$ for a 391natural factor formulation of a 392${\tt n1} \times {\tt n2} \times {\tt n3}$ grid. 393If {\tt n1}, {\tt n2} and {\tt n3} are all greater than 1, 394the grid is formed of linear hexahedral elements and 395the matrix $A$ has {\tt 8*n1*n2*n3} rows. 396If one of {\tt n1}, {\tt n2} and {\tt n3} is equal to 1, 397the grid is formed of linear quadrilateral elements and 398the matrix $A$ has {\tt 4*n1*n2*n3} rows. 399The entries in $A$ and $X$ are random numbers, 400$B$ is computed as the product of $A$ with $X$. 401$A$ can be real ({\tt type = 1}) or complex ({\tt type = 2}). 402The number of columns of $X$ is given by {\tt nrhs}. 403The linear system is ordered using theoretical nested dissection, 404and the front tree is transformed using the {\tt maxzeros} and {\tt 405maxsize} parameters. 406The addresses of the front tree, symbolic factorization, and three 407matrix objects are returned in the last five arguments of the 408calling sequence. 409\par \noindent {\it Error checking:} 410None presently. 411%----------------------------------------------------------------------- 412\end{enumerate} 413