get_dependencies.py
===================

It is useful to be able to view the dependencies on modules in a fortran code
graphically.   This is especially helpful when trying to reorder code for a
cleaner flow, trying to remove issues leading to circular dependencies, or for
becoming familiar with the structure of a new code. 

get_dependencies.py is a script which analyses source code and outputs (in the
dot language---see http://www.graphviz.org) the dependencies on modules.  The
output contains the following information:

* modules depending on other modules.
* non-modules files depending on modules.

These are further split up into dependencies involving utilty or data modules
(which must be specified inside get_dependencies.py).  Graphs of the
dependencies can be produced using a suitable parser.

Usage
-----

Usage::

    get_dependencies.py [source files]

The user needs to do modify a few things before first use:
#. Give the names of your data and utility modules and the output directory in
   the appropriate place in get_dependencies.py.
#. Create the output directory.
#. Run get_dependencies on your source code.  I do::

       ~/src $ get_dependencies.py *.F{,90}

   as all our source files are either .F or .F90 files.

Producing graphs from the output requires a parser.  Run the desired parser
(i.e. one of those provided by graphviz) on the resultant dot files.  I find
dot works best for our graphs.  I run:: 

    ~/src/dependencies $ for f in *.dot; do dot -Tps $f -o `basename $f .dot`.ps; done

to produce all the graphs in one shot.

Licence
-------

Essentially you can do whatever you want with the code.
Formally it's subject to the MIT licence::

    Copyright (c) 2009 James Spencer.

    Permission is hereby granted, free of charge, to any person
    obtaining a copy of this software and associated documentation
    files (the "Software"), to deal in the Software without
    restriction, including without limitation the rights to use,
    copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following
    conditions:

    The above copyright notice and this permission notice shall be
    included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    OTHER DEALINGS IN THE SOFTWARE.
