README file for TrXpl Module

Prepared by C.Ludescher-Furth -- ludescher@pppl.gov 09/28/00

****************
REVISION HISTORY
****************
      date          Description

  Sep. 28, 2000  -- Created 

----------------------------------------------------------------


Index:
   1. CONTENTS
   2. UNPACKING INSTRUCTIONS
   3. DESTINATIONS
   4. BUILDING INSTRUCTIONS
   5. TESTING INSTRUCTIONS
   6. DOCUMENTATION
   7. FINAL INSTALLATION


************
1. CONTENTS:
************
This directory should contain the following files:

README_Trxplib: This file.  Brief descriptions of the other files, and
                instructions for compiling, testing and installing the
                trxplib library libtrxplib.a and its test driver
                trxpl. 

Makefile:       NOTE, "GNU make" must be used
                (usually in /usr/gnu/bin or /usr/local/bin).
		Main Makefile to envoke Makefile(s) in subdirectories.  

-- in subdirectory share:
   Make.flags:        Include file for Makefile, to setup Flags, etc.
   Make.local.sample: Include file for Makefile, to setup non-conventional,
                      site specific locations.

-- in subdirectory trxplib:
   Copy of README
   Makefile
   Sources to build the library libtrxplib.a
	*.f90, *.F90
   Sources for programs:
   	trxpl.F

   Sample input/output files for test:
  	  

-- in subdirectory uflib:
   Makefile
   Sources to build internally used library libuflib.a.
	to read ufiles.

-- in subdirectory ufhdf:
   Makefile
   Sources to build internally used library libufhdf.a.
	to read ufiles of netCDF/ HDF formats.

-- in subdirectory fpreproc:
   Python scripts for fortran pre-processing.

-- in subdirectory include/fpreproc:
   *.h files for source pre-processing.


**************************
2. UNPACKING INSTRUCTIONS:
**************************
Note: Download the module(s) into an empty directory.
  
for tarfiles:
  > gunzip trxplib.tar.gz
  > tar xvf trxplib.tar

or, for zip archives:
  > unzip trxplib.zip


****************
3. DESTINATIONS:
****************
Or where do the files go?
(this refers to building and testing; see FINAL INSTALLATION for end result) 


When you extract the tar file you get sub directories:
./trxplib           --  sources and Makefile
./share             --  include file Make.flags, Make.local.sample
./include/fpreproc  --  *.h files for cpp
./fpreproc          --  scripts for pre-processing of fortran
./uflib             --  to read standard ufiles
./ufhdf             --  to read ufiles of netCDF / HDF format

The makefile will create more sub directories,

lib:     for the library, libtrxplib.a
mod:     for the f90 modules
obj/*:   for compiled objects and pre-processed sources
test:    for the test programs and the sample output files.

By default these directories are created in  
./<MACHINE>, which is determined by Make.flags.
e.g.: if you are running Linux, and the tar file resides in $HOME/foo,
      the directories would be in
      $HOME/foo/LINUX/...

You can overwrite the destination by defining OBJ, as an environment
variable (e.g. export OBJ=/dir1/dir2),
or with make (e.g. "make all OBJ=.").
If OBJ is defined, the destinations will be
$OBJ/lib and $OBJ/test.
If OBJ is defined as "." then, in the example above, the destination
would be $HOME/foo/lib.

The rationale behind <MACHINE> is to facilitate building for various platforms.

Note: If you define OBJ as option to gmake, you have to consistently do so;
      e.g: gmake clean OBJ=., gmake install OBJ=.

 
*************************
4. BUILDING INSTRUCTIONS:
*************************

Required Libraries:
===================
           libxplasma.a   -> NTCC module XPLASMA
           libtrread.a    -> NTCC module TRREAD   
           libpspline.a   -> NTCC module PSPLINE   
	   MDSplus
           lapack
	   blas
           netCDF
	   HDF



Check with your systems administrator where these libraries and modules are.


lapack, blas, HDF and netCDF
----------------------------
lapack, blas, HDF (-ldf -lz) and netCDF are assumed to be in /usr/local/lib,
if not, you can specify the location with LIBROOT,

e.g.: "gmake LIBROOT=/usr/contrib".

If netCDF is in a separate location, specify NETCDF_DIR
e.g.: "gmake NETCDF_DIR=/usr/local/my-netcdf LIBROOT=/my-libroot".

Alternatively you can modify Make.local.sample
and rename it to Make.local.

MDSplus
-------
MdsLib is assumed to be in /usr/local/mdslib/lib
if not, define MDSPLUS_DIR or modify MDSLIB in share/Make.local

If you don't have MDSplus, build the code with
"make NO_MDSPLUS=1" -or- define environment variable NO_MDSPLUS


xplasma, trread and pspline
---------------------------
If your site already has these libraries installed,
specify their location (library and modules) with PREFIX, 

e.g. "gmake PREFIX=/usr/ntcc"

At PPPL these libraries are in /usr/ntcc.

Note: If you don't have all required NTCC libraries, you may download them
      together into the same root directory. The Makefile will build them
      all in one  step.


Building libraries and proprams
-------------------------------- 
> gmake            -- to compile library and link all test programs

> gmake checklibs  -- tells you what the makefile will do
                      (without any action);
                      it says which libraries it will make and
                      which ones it already found and where.

> gmake clean      -- to remove objects
> gmake realclean  -- to remove objects and library

> gmake show_makeflags -- to see what flags, definitions Make will use


Compiling on Linux:
-------------------

By default the Makefile will select Fujitsu f95.

To select a different compiler define
FORTRAN_VARIANT to "Portland"  "NagWare"  "Fujitsu" "Intel" or "Absoft"

e.g.:
setenv FORTRAN_VARIANT Portland (csh)
FORTRAN_VARIANT=Portland; export  FORTRAN_VARIANT (sh)

Alternatively, FORTRAN_VARIANT can be passed directly to the gmake
command, as in:
gmake  FORTRAN_VARIANT=Portland

To use vastf90:
> gmake VAST90=y

To use NAG90: 
> gmake NAG90=y


Compiling on Alpha Linux:
-------------------------
The Makefile assumes the Compaq compiler and specifies the 
 " -assume no2underscores " option.

Therefore the calling user software must also be compiled with this
option, or you should edit share/Make.flags to remove the option.


Compiling on SUN:
-----------------
The Makefile specifies the -dalign option.
Therefore the calling user software must also be compiled with this
option, or you should edit share/Make.flags to remove the option.



************************
5. TESTING INSTRUCTIONS:
************************

directory $OBJ/test  -or-  <MACHINE>/test  will contain:

trxpl     :  Test driver for trxplib


To run test:
-----------
define environment variable TERMINAL_TYPE = XTERM
 (e.g. export TERMINAL_TYPE=XTERM)

cd <MACHINE>/test

./trxpl

For details see README or http://w3.pppl.gov/~pshare/help/trxplib.htm


************************
6. DOCUMENTATION:
************************

TrXplib Home Page:
http://w3.pppl.gov/NTCC/TrXplib

TrXplib HELP
http://w3.pppl.gov/~pshare/help/trxplib.htm

NTCC Home Page:
http://w3.pppl.gov/NTCC

NOTE:
The `trxpl' source, trxpl.for, can be used as an example of
programming with the trxplib library.

**********************
7. FINAL INSTALLATION:
**********************

Choose or create the root directory in which you wish to install the software.
A common location would be /usr/ntcc, but installation can occur in any
directory where you have appropriate permissions.

You define your choice of root directory via PREFIX.
The default for PREFIX is /usr/ntcc.

The assumptions are:

libraries in:       $PREFIX/lib        = $LIBDIR
f90 modules in:     $PREFIX/mod        = $MODDIR
utility in:         $PREFIX/bin        = $BINDIR
man pages in:       $PREFIX/man/man3   = $MANDIR/man3

To install the software, return to the top directory (the directory,
where you downloaded the tar files) and type

>  gmake install  
    to install into /usr/ntcc/...

>  gmake install PREFIX=/dir1/dir2/
    to install into /dir1/dir2/...

If you want things elsewhere, you can overwrite the default with
> gmake install LIBDIR=/xxx MODDIR=yyy BINDIR=zzz

NOTE:
-----
The library is installed as libtrxplib.a
Users should link with

-L<PREFIX>/lib -ltrxplib

Make sure users know what <PREFIX> is.

After you have installed the software, you can delete the entire tree
with
> cd ..
> rm -r foo
   assuming the previous example.

----------------------------------------------------------------------------

IF YOU HAVE ANY PROBLEMS, PLEASE CONTACT EITHER:


        Doug McCune, Princeton University
                dmccune@pppl.gov
        or

        Christiane Ludescher-Furth, Princeton University
                cludescher@pppl.gov
        or      
                ntcc_webmaster@pppl.gov




