<chapter id="ch02"><title>System Requirements and Installation</title>
<para>
      In the following sections we describe the hardware and software
      required to run Vis5D and detail how to install Vis5D on your
      system.
</para>
<sect1 id="ch02sec1">
<title>System Requirements</title>
<para>
Vis5d+ should, in principle, run on any system with X windows, OpenGL
libraries, and at least an 8-bit color display.  32MB of RAM is
recommended, and an ANSI C compiler is required to build the program.
It is known for certain to run on the following systems:
</para>
<para>
<orderedlist>
<listitem>
<para><emphasis>Silicon Graphics:</emphasis>
	      IRIX version 4.0.1 or higher;
	      Multiple processors are used when present; IrisGL is not
	      supported
	    </para>
</listitem>
<listitem>
<para><emphasis>IBM RS/6000:</emphasis>
	      Model 320H or higher;
	      AIX version 3 or later;
	      3-D graphics hardware is supported through OpenGL    
</para>
</listitem>
<listitem>
<para><emphasis>HP series 7000 or 9000 workstations:</emphasis>
	      HP-UX A.09.01 or later;
	      PEX optional
</para>
</listitem>

<listitem>
<para><emphasis>Sun SPARC:</emphasis>
SunOS 5.x or later
<important>
<title>IMPORTANT NOTE FOR SunOS 5 USERS</title>
<para>
The X shared memory extension may not work
correctly.  If Vis5D prints an error message to the effect of "Shared
memory error" then you'll have to append the following three lines to
	      the end of your 
              <filename>/etc/system</filename> file then reboot:
</para>
<para>
<programlisting>
set shmsys:shminfo_shmmax = 0x2000000
set shmsys:shminfo_shmmni = 0x1000
set shmsys:shminfo_shmseg = 0x100
</programlisting>
</para>

</important>
</para>
</listitem>

<listitem><para><emphasis>Compaq Alpha:</emphasis>
	      OSF/1 V1.3 or later;
	      Kubota Denali Graphics hardware supported with KWS V1.3.3 or
	      later and NPGL Run-time license
<important>
<title>IMPORTANT NOTE FOR OSF USERS</title>
<para>
      you need to run 'limit stacksize 32m' before you run Vis5D    
</para>
</important>
</para>
</listitem>
<listitem><para><emphasis>Linux:</emphasis>
x86, PowerPC, and Alpha Linux systems have been tested.  A 75MHz
Pentium CPU or faster is recommended.  gcc 2.95.2 on PowerPC has
a bug that causes problems; be sure to get a version with the latest
developer patches.
</para>
</listitem>
</orderedlist>
</para><para>
<note><para>
Note that on systems which don't have 3-D graphics hardware or OpenGL,
all 3-D rendering is done in software using Mesa (an OpenGL
work-alike).  3-D graphics hardware is recommended for high-end use.
If you do not have Mesa, you must download and install it as described
below.</para>
</note>
</para>
<para>
	If you would like to port Vis5D to a new graphics system or
workstation read the PORTING file which gives more information.  If
you succeed, please inform us so that we may add your work to the
distribution.  With the new autoconf-based installation procedure,
porting to new machines should be considerably easier than before (and
may often work with no modifications at all).
</para>
</sect1>
<sect1 id="ch02sec2">
<title>Installing Vis5D</title>
<para>
	Before installing Vis5D, you may want to download the
following:
</para>
<sect2 id="ch02sec2.1">
<title>Mesa</title>
<para>
	  Mesa is a free OpenGL replacement, and is <emphasis>required</emphasis> if your
system does not already have OpenGL, IrisGL, or PEX (an old 3d library
for X).  If you don't know whether you have Mesa or one of these other
libraries, you can skip this step for now; when you try to configure
Vis5D 
(in <link linkend="ch02sec2.3">section 2.2.3</link>)
, the configure script will stop and complain
if it can't find one of the libraries.  Then you can go back to this
step.
</para>
<para>
	  To install Mesa on your machine, go to the 
<ulink url="http://www.mesa3d.org/">
          Mesa home page
</ulink>
          and download it.
</para>
<para>
	  You'll get a file something like 
<filename>MesaLib-3.1.tar.gz</filename> Unpack it:
<programlisting>
<prompt>%</prompt> gunzip MesaLib-3.1.tar.gz
<prompt>%</prompt> tar -xf MesaLib-3.1.tar
</programlisting>
	  Then, cd to the MesaLib-3.1 directory and type:
<programlisting>
<prompt>%</prompt> ./configure
<prompt>%</prompt> make
</programlisting>
	This should configure and compile Mesa.  Finally, switch to root
	(superuser) and type:
<programlisting>
<prompt>%</prompt> make install
</programlisting>
	  If you don't have access to the root account on your
machine, and your system administrator is unwilling to install Mesa
for you (unlikely, since Mesa is very standard and widely-used), you
can instead install it to a location in your home directory, e.g.
<filename>~/Mesa</filename>.
To do this, you would use the following steps instead of the above:
<programlisting>
<prompt>%</prompt>./configure --prefix=$HOME/Mesa
<prompt>%</prompt> make
<prompt>%</prompt> make install
</programlisting>
	  The last step will copy the Mesa libraries and headers to
<filename>~/Mesa/lib</filename>, <filename>~/Mesa/include</filename>, 
etcetera.
</para>
<para>
	  When you run 'make install', it may print out some important
directions regarding shared libraries.  If you install in a
non-standard location, it will typically tell you add the 
<filename><option>prefix</option>/lib</filename> 
directory to some environment variable.  On Linux systems, you
may need to run <command>/sbin/ldconfig</command>, etcetera.
</para>
</sect2>
<sect2 id="ch02sec2.2">
<title>NetCDF (optional)</title>
<para>
	  NetCDF is a free library for reading scientific data that
can optionally be used by Vis5D.  If you do not have NetCDF, then
certain features of Vis5D will be disabled, notably irregular dataset
support.
</para>
<para>
	  To get NetCDF, go to the 
<ulink url="http://www.unidata.ucar.edu/packages/netcdf/">
          NetCDF home page
</ulink>
	  and download the NetCDF package.  As of this writing, the
current version is 
<ulink url="ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-3.4.tar.Z">
	3.4.
</ulink>
</para>
<para>
  Once you have downloaded it, unpack and compile the package with:
<programlisting>
<prompt>%</prompt> uncompress netcdf-3.4.tar.Z
<prompt>%</prompt> tar xf netcdf-3.4.tar
<prompt>%</prompt> cd netcdf-3.4/src
<prompt>%</prompt> ./configure
<prompt>%</prompt> make
</programlisting>
	  On Linux systems, you may instead have to use:
<programlisting>
<prompt>%</prompt> make CC="gcc -Df2cFortran"
</programlisting>
	  because NetCDF doesn't know how to deal with GNU g77.
</para>
<para>
Vis5D only needs the <filename>libnetcdf.a</filename> file, located in
<filename>libsrc/libnetcdf.a</filename>. 
If you have downloaded and unpacked Vis5D already,
you can copy this file to the Vis5D directory now; otherwise, just
leave it there and remember where it is.
</para>
</sect2>
<sect2 id="ch02sec2.3">
<title>Vis5d+</title>
<para>
Since you are reading this file, you have probably already
downloaded and unpacked Vis5d+.  Otherwise, go to the 
<ulink url="http://vis5d.sourceforge.net/">Vis5d+ home page</ulink>
and download the latest version.  It will be something like
<filename>vis5d+-1.0.1.tar.gz</filename>.  Unpack it with:
<programlisting>
<prompt>%</prompt> gunzip vis5d+-1.0.1.tar.gz
<prompt>%</prompt> tar xf vis5d+-1.0.1.tar
</programlisting>
	  Now, cd to the Vis5D directory (cd vis5d+-1.0.1 if you were
following the steps above).  At this point, you will run a "configure"
script to automatically configure Vis5D for your machine. The most
basic way to run <command>configure</command> is by:
<programlisting>
<prompt>%</prompt> ./configure
</programlisting>
	  but there are several optional arguments that you may want
to pass it:
</para>
<variablelist>
<title>Optional Arguments</title>
<varlistentry>
<term><parameter>--prefix=<option>dir</option></parameter></term>
<listitem>
<para>
	  By default, Vis5D will be set up to install (when you run
'make install' below) under 
<filename>/usr/local</filename> on your system.  That is, the
programs will be installed in <filename>/usr/local/bin</filename>, 
etcetera. This argument allows you to install to a different place.  
For example, if you don't have root access you may want to install 
to your home directory by using: 
</para>
<para>
<parameter>--prefix=<option>$HOME/Vis5D</option></parameter>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-netcdf=<option>lib</option></parameter></term>
<listitem>
<para>
	  This allows you to specify the location 
(<filename>lib</filename>) of the <filename>libnetcdf.a</filename> file.
You don't need to do this if you copied <filename>libnetcdf.a</filename>
to the Vis5D directory or if you installed it to a standard system
location.  Contrariwise, 
<parameter>--without-netcdf</parameter> forces Vis5D to 
<emphasis>not</emphasis> use NetCDF even if it could find the library.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--enable-threads</parameter></term>
<listitem>
<para>
	  Turn on multi-threading mode in Vis5d (if a threads library
is found); should enhance responsiveness, even on single-CPU systems.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-memory=<option>MB</option></parameter></term>
<listitem>
<para>
Set the maximum amount of memory to use <option> MB </option> megabytes
(defaults to 32).  Vis5d normally uses a bounded amount of memory to
avoid swapping.  When the limit is reached, the least-recently viewed
graphics will be deallocated.  If <option> MB </option> 
is set to 0, there will be no memory limit and Vis5d will never 
deallocate graphics.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-mesa</parameter></term>
<listitem>
<para>
Force the use of Mesa even if a "real" OpenGL library is
available. This just means it looks for 
<filename>libMesaGL</filename> libraries, etcetera,
before <filename>libGL</filename> instead of afterwards.  
This option isn't useful with recent versions of Mesa, which install as 
<filename>libGL</filename>, etcetera.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-mcidas=<option>lib</option></parameter></term>
<listitem>
<para>
	  Specify the location of a McIDAS library file, an optional
(proprietary) library that Vis5D can use.  (Vis5D comes with an older
McIDAS library binary for IRIX, which will be used if it works with
your system.)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-fortran</parameter></term>
<listitem>
<para>
	  Don't compile any of the Fortran utility programs, etcetera,
even if there is a Fortran compiler on your system (it will normally
be used automatically).  You can use this if your Fortran compiler
gives you troubles when compiling Vis5D.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-shared</parameter></term>
<listitem><para></para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-static</parameter></term>
<listitem>
<para>
	  Disable creation of the shared (<filename>.so</filename>) and static (<filename>.a</filename>)
libaries, respectively.  Don't disable both, as the Vis5D program
requires a library to link to!
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
You can also set one or more environment variables before
running <command>configure</command>, to help it find libraries and otherwise control its
behavior.  (You can go back and do this if configure has trouble.) You
set an environment variable by the syntax <computeroutput>setenv variable value</computeroutput> (or
<computeroutput>export variable=value</computeroutput> if you are using <command>ksh</command>, <command>bash</command>, or the like). Most
of the time, you won't need to do this, but if you do, some possible
environment variables are:
</para>
<para>
<itemizedlist>
<listitem>
<para><symbol>CC:</symbol> the name of the C compiler</para>
</listitem>
<listitem>
<para><symbol>CPPFLAGS:</symbol> 
 <parameter>-I <option>dir</option></parameter> flags to tell the C
 compiler where to look for header files</para>
</listitem>
<listitem>
<para><symbol>CFLAGS:</symbol> C compiler flags</para>
</listitem>
<listitem>
<para><symbol>F77:</symbol> the name of the Fortran compiler</para>
</listitem>
<listitem>
<para><symbol>FFLAGS:</symbol> Fortran compiler flags</para>
</listitem>
<listitem>
<para><symbol>LDFLAGS:</symbol> linker flags 
(e.g. <parameter>-L <option>dir</option></parameter> to look
		for libraries in <filename>dir</filename>)</para>
</listitem>
</itemizedlist>
</para>
<para>
	  The most common use for these variables is when you have
libraries installed in nonstandard locations, in which case you will
use the <symbol>CPPFLAGS</symbol> and <symbol>LDFLAGS</symbol> environment variables.  For example,
consider the case above where you installed the Mesa library in
<filename>~/Mesa</filename>.  
You would then tell <command>configure</command> where to find the Mesa
libraries and header files with:
<programlisting>
<prompt>%</prompt> setenv CPPFLAGS "-I$HOME/Mesa/include"
<prompt>%</prompt> setenv LDFLAGS "-L$HOME/Mesa/lib"
</programlisting>
	  Be sure to scan the <command>configure</command> output for important warning
messages, which will be surrounded by asterisks (<computeroutput>*******</computeroutput>).  Once you
have run <command>configure</command> successfully, you can compile Vis5D by typing:
<programlisting>
<prompt>%</prompt> make
</programlisting>
	  If you want, you can run the program right away by typing:
<programlisting>
<prompt>%</prompt> src/vis5d hole.v5d -path src
</programlisting>
<filename>hole.v5d</filename> is a sample data file included with Vis5D.
The <parameter>-path</parameter><option> src </option>
argument is necessary to tell it where the map data files
are located; it will no longer be need after you do a 'make install'
(see below).  Click and drag in the display window to rotate it, and
click on buttons in the lower portion of the control window to plot
the data.
</para>
<para>
	  If this completes succesfully, you will then want to install
Vis5D:
<programlisting>
<prompt>%</prompt> make install
</programlisting>
	  (You may need to switch to root first, or do <computeroutput>su -c "make
install"</computeroutput>, if you are installing in system locations.)
</para>
<para>
	  Note that the <computeroutput>make install</computeroutput> output may contain important
instructions regarding shared libraries (if you want to link to the
Vis5D libraries in your programs).  e.g. on Linux you'll need to run
<command>/etc/ldconfig</command> and possibly edit <filename>/etc/ld.so.conf</filename>.
</para>
<para>
	  Once this is done, the <command>vis5d</command> program, utilities, data, and
libraries are installed under <filename>/usr/local</filename>, or wherever you specified
with the <parameter>--prefix</parameter> argument to <command>configure</command> (as described
above).  You should now be able to run it by simply typing <command>vis5d</command> (if
you installed in a system directory) or by typing 
<option>prefix</option><filename>/bin/vis5d</filename>
(otherwise, where <option>prefix</option> was the argument to
<parameter>--prefix</parameter>), in either case followed by the name of a
data file.
</para>
<para>
	  One sample data file, 
<filename>hole.v5d</filename>, is included with Vis5D, and
more may be downloaded from the 
<ulink url="ftp://www.ssec.wisc.edu/pub/">
Vis5D ftp site
</ulink>.
</para>
<para>
	  If you want to uninstall Vis5d at any time, you can do:
<programlisting>
<prompt>%</prompt> make uninstall
</programlisting>
	  which removes the files installed by <computeroutput>make install</computeroutput>.
</para>
</sect2>
<sect2 id="ch02sec2.4">
<title>Manifest</title>
<para>
The files installed by Vis5D include:
</para>
<para>
<table>
<title>Programs (in <filename><option>prefix</option>/bin</filename>):</title>
<tgroup cols="2">
<tbody>
<row>
<entry>vis5d</entry>
<entry>this is the vis5d visualization program</entry>
</row>
<row>
     <entry>v5dappend</entry><entry>utility to join v5d files
		  together</entry>
</row>
<row>
     <entry>v5dinfo</entry><entry>utility to see summary of a v5d
	      file</entry>
</row>
<row>
     <entry>v5dstats</entry><entry>utility to see statistics of a v5d
	      file</entry>
</row>
<row>
     <entry>v5dedit</entry><entry>utility to edit the header of a v5d
	      file</entry>
</row>
<row>
     <entry>v5dimport</entry><entry>utility to convert, resample, and
	      reduce v5d files</entry>
</row>
<row>
     <entry>comp_to_v5d </entry><entry>utility to convert (a) comp5d
	      file(s) to v5d format</entry>
</row>
<row>
     <entry>listfonts</entry><entry>utility to list fonts (only on SGI
	      systems for IRIS GL)</entry>
</row>
<row>
     <entry>topoinfo</entry><entry>utility to see info about a .topo
	      file</entry>
</row>
<row>
     <entry>fromxwd</entry><entry>utility to convert .xwd files to SGI
	      .rgb format</entry>
</row>
<row>
     <entry>gr3d_to_v5d</entry><entry>utility to convert a McIDAS GR3D
	      file to v5d format</entry>
</row>
<row>
     <entry>gg3d</entry><entry>McIDAS grid utility</entry>
</row>
<row>
     <entry>igg3d</entry><entry>McIDAS grid utility</entry>
</row>
<row>
     <entry>igu3d</entry><entry>McIDAS grid utility</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table>     
<title>Libraries (in <filename><option>prefix</option>/lib</filename>):</title>
<tgroup cols="2">
<tbody>
<row>
     <entry><filename>libv5d</filename></entry>
     <entry>.v5d file I/O API</entry>
</row>
<row>
     <entry><filename>libvis5d</filename></entry>
     <entry>the rest of the Vis5D API</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
(Programs using the full Vis5D API should link with 
<parameter>-lvis5d -lv5d</parameter>, 
while programs just doing file I/O can link with just 
<parameter>-lv5d</parameter>.)
</para>
<para>
<table>
<title>Headers (in <filename><option>prefix</option>/include/vis5d</filename>):</title>
<tgroup cols="2">
<tbody>
<row>
     <entry><filename>v5d.h,binio.h</filename> </entry>
     <entry>the file I/O API definitions</entry>
</row>
<row>
     <entry><filename>v5df.h</filename></entry>
     <entry>file I/O API for Fortran</entry>
</row>
<row>
     <entry><filename>api.h</filename></entry>
     <entry>rest of the Vis5D API</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table>
<title>Data (in <filename><option>prefix</option>/share/vis5d+</filename>):</title>
<tgroup cols=2>
<tbody>
<row>
     <entry><filename>OUTLSUPW</filename></entry>
     <entry>World continental map lines file</entry>
</row>
<row>
     <entry><filename>OUTLUSAM</filename></entry>
     <entry>Medium resolution map of US with state boundaries</entry>
</row>
<row>
     <entry><filename>EARTH.TOPO</filename></entry>
     <entry>Earth topography file</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table>
<title>Uninstalled files and subdirectories:</title>
<tgroup cols=2>
<tbody>
<row>
     <entry><filename>README</filename></entry>
     <entry>short description of the program</entry>
</row>
<row>
     <entry><filename>COPYING</filename></entry>
     <entry>the GNU general public license</entry>
</row>
<row>
     <entry><filename>COPYRIGHT</filename></entry>
     <entry>copyright notice</entry>
</row>
<row>
     <entry><filename>PORTING</filename></entry>
     <entry>an ASCII document with notes on porting Vis5D</entry>
</row>
<row>
     <entry><filename>hole.v5d</filename></entry>
     <entry>sample dataset (dielectric function
            and z-comp. of a magnetic field guided in a 
            dielectric slab with holes)</entry>
</row>
<row>
     <entry>doc/</entry>
     <entry>this manual, in PDF and HTML formats</entry>
</row>
<row>
     <entry>scripts/</entry>
     <entry>example scripts</entry>
</row>
<row>
     <entry>src/</entry>
     <entry>source code for <command>vis5d</command> and <command>v5dimport</command></entry>
</row>
<row>
     <entry>util/</entry>
     <entry>source code for the Vis5D utilities</entry>
</row>
<row>
     <entry>lui5/</entry>
     <entry>source code for LUI user interface library</entry>
</row>
<row>
     <entry>userfuncs/</entry>
     <entry>directory of user-written analysis functions</entry>
</row>
<row>
     <entry>contrib/</entry>
     <entry>software contributed by Vis5D users</entry>
</row>
<row>
     <entry>convert/</entry>
     <entry>source code for sample data	conversion programs</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
You can also download from the  
<ulink url="http://www.ssec.wisc.edu/~billh/vis5d.html"> 
Vis5D web site  
</ulink>
<ulink url=
"ftp://www.ssec.wisc.edu/pub/vis5d-5.2/vis5d-userdata.tar.Z"> 
sample code  </ulink> for user supplied data formats, including:
</para>
<para>
         <filename>LAMPS.v5d</filename>: Sample LAMPS data set
</para>
<para>
         <filename>SCHL.v5d</filename>: Sample data set; 
         Bob Schlesinger's thunderstorm model
</para>
</sect2>
<sect2 id="ch02sec2.5">
<title>Customizing</title>
<para>
	  After installation and testing you may want to customize the
	  vis5d program by editing the <filename>src/vis5d.h</filename>
          file:
</para>
<para>
<orderedlist>
<listitem>
<para>
		The visualization program vis5d assumes your system
has 32 megabytes of memory.  Although you can override this when you
invoke vis5d, it may be convenient to change the default if your
system has more than 32MB. This value is now controlled by the
<parameter>--with-memory=<option>MB</option></parameter> 
option to the <command>configure</command> script (see above).
</para>
</listitem>
<listitem>     
<para>
		There are two ways to specify a different topography
and/or map file. One way is to edit <filename>src/vis5d.h</filename>
and change the values for TOPOFILE and/or MAPFILE.  
For example, if you move the map and
topography files to /usr/local/data, you would specify
<filename>/usr/local/data/EARTH.TOPO</filename> and 
<filename>/usr/local/data/OUTLUSAM</filename>
respectively. The other way is press the
'DISPLAY' button on the main contral panel,
then press the  'Options' button found above each display menu.  
The 'toponame' and/or 'mapname' fields can be changed accordingly.
</para>
<para>
 By default, these files are looked for in
<filename>/usr/local/share/vis5d+</filename>, or whereever 
Vis5D was installed.  You can change this by either the 
<option>-path</option> argument to Vis5D or the VIS5D_PATH environment 
variable.
</para>
</listitem>
</orderedlist>
</para>
<para>
When you are finished changing the <filename>src/vis5d.h</filename>
file, you must recompile. the programs.
</para>
</sect2>
</sect1>
</chapter>