\chapter{Source Code}\label{app:source}

The code for the PAN modeler follows.

\section{man Page}

\begin{verbatim}
NAME
        panmodel - model PAN system

SYNOPSIS
        panmodel [-v slice] [-n size] [-x] -a alpha

DESCRIPTION
        panmodel takes a geometry description on standard
        input and reports its output on standard error.  It
        will graphically display its progress if the -x flag 
        is used.

        The geometry description is a list of points and which
        component they are part of.  One point is specified per
        line as:

        x y z component

        x, y, and z are integer coordinates from 1 to
 size. The 
        component value is one of the following, depending on
        which component the point is part of:

        1       Body
        2       Ground
        3       Transmit body electrode
        4       Transmit ground electrode
        5       Receive body electrode
        6       Receive ground electrode

        If a single point is listed as part of multiple components, 
        the component listed last is used.

   OPTIONS
        -v slice
                Graphically view a two dimensional slice of the model
                at x = slice during the 3D SOR portion of the 
                calculation. This option is required when using the
                -x option.  Currently slices in x are the only ones
                supported.
        -n size
                Specify a grid size.  Currently only cubic grids are 
                supported.  Default is 50.
        -x
                Enable X windows viewing of the 3D SOR process.  Requires
                the -v option accompany it.
        -a alpha
                Set the value for alpha.  Values above 2 are unstable.

BUGS
        The X support is mediocre.  It may not work under some conditions,
        and its colormap handling is poor.

        Doesn't provide reasonable defaults for alpha or slice.

        Fails ungracefully if input geometry is incompatible with specified
        size.
\end{verbatim}

\section{main.c: Pan Simulator}

\tgrindfile{code/main.c.tex}

\section{sor.c: Successive Over-Relaxation Solver}

\tgrindfile{code/sor.c.tex}

\section{gaussj.c: Gauss Jordan Maxtrix Solver}

\tgrindfile{code/gaussj.c.tex}

\section{xgraphics.c: Graphics routines}

\tgrindfile{code/xgraphics.c.tex}

\section{main.h: Main Header File}

\tgrindfile{code/main.h.tex}

\section{sor.h: Header file for sor.c}

\tgrindfile{code/sor.h.tex}

\section{xgraphics.h: Header file for xgraphics.c}

\tgrindfile{code/xgraphics.h.tex}

\clearpage
\newpage
