Programming Guidelines for PARAMESH Software Development (NOTE: This document is heavily based upon the programming guidelines for the NPARC project.  The original document for NPARC can be found at http://www.grc.nasa.gov/WWW/winddocs/guidelines/pgmstds.html)

Introduction

This document describes the programming guidelines to be used by software developers wishing to contribute software to the PARAMESH, parallel, adaptive mesh refinement software.   We welcome people to contribute software and/or bug fixes to the PARAMESH AMR software.   Software to be added to PARAMESH can come in 2 forms:
Complete applications should not be added as part of PARAMESH.   PARAMESH is only meant to be a tool which supports parallel adaptive mesh applications and any software which supports this goal will be considered for acceptance into PARAMESH.  For instance, a solver for the poisson equation that works with PARAMESH would be acceptable, but an application that solves the equation of gas dynamics would not.

The PARAMESH software is slowly being evolved to be consistent with this document.  Any new software which is contributed should follow these guidlines.  If not, it will be rejected.  This document deals mainly with Fortran 90, since most new PARAMESH software will probably be written in that language. [Throughout this document, the term "Fortran" should be understood to mean Fortran 90.]  Since we expect C and C++ also to be used, a separate document dealing with them will be developed in the future.   In the meantime, this document can serve as a general guideline for developing code to be used with PARAMESH in those programming languages.

The guidlines in this document should be adhered to by ANY software which will be released as part of the PARAMESH package of
source code.  This includes software 'utilities' (stored in the paramesh/utilities directory) which add functionality to PARAMESH for different algorithms.   It also should be applied to any new code developed and added to the main source code for PARAMESH in the paramesh/source, paramesh/mpi_source, or paramesh/headers directories. 

The guidelines are intended to enhance the following aspects of the final product, listed in decreasing order of importance:

Much of this material has been taken, sometimes verbatim, from the following documents:



Instructions for Adding Software to the CVS repository


The CVS reposity for PARAMESH is maintained by SourceForge (www.sourforge.com).  To add software to the PARAMESH repository you first need an account on CVS.  Once you have gotten an account, contact Kevin Olson (olson@physics.drexel.edu) or Peter MacNeice (pmacneic@pop900.gsfc.nasa.gov) and we will set you up as a 'developer'.  This will give you access to the CVS repository of PARAMESH and you will be able to checkout a working copy of PARAMESH, make changes, and add those changes to the repository.  

To use CVS it is convenient to set the enviroment variables:

export CVSROOT=:ext:userid@paramesh.cvs.sourceforge.net:/cvsroot/paramesh
export CVS_RSH=/usr/bin/ssh

where ;userid' is your SourceForge login user id.

You can then co PARAMESH using the command:

cvs co paramesh

When adding software of making changes to the software the following preceedures should be followed.
  1. Before checking anything in send an e-mail to Kevin Olson or Peter MacNeice describing your changes and also copies ot the files with the changes you have made.  Describe how we can run you contributed test program.  We will review the changes and then let you know if you can check them in or if you need to make further changes.  Please don't check in until we give you the OK to do so.
  2. Once you get the OK, go ahead and check them in.
  3. Add a few descriptive lines in the ChangeLog file of your changes or additions and check in this file.
  4. <>If you are contributing a new PARAMESH utility (in the paramesh/utilities directory) then these following additional steps should be followed,

Program Development and Design

Items in this section are fairly general and fundamental in nature. They impact all three of the items listed above - maintainability, portability, and efficiency.

Language

Try to use ANSI standard Fortran 90 exclusively.  If you must, you can use C or C++, but it must work with PARAMESH and be callable from a Fortran 90 program.

Organization

Common Blocks

Data Types

Dynamic Memory


Coding Style (see mpi_source/mpi_amr_guardcell.F90 for a complete example)

Items in this section are fairly specific, and primarily impact the readability, and thus the maintainability, of the final product. It is recognized that rules for "good coding style" are somewhat subjective. 

Program Units

Statement Form

Statement Labels

Upper/Lower Case

Spacing

Variable Names

Arrays

Control Statements

Calls to other Libraries (such as MPI).

Comments

Obsolete/Forbidden Features

The following Fortran features are either formally declared as obsolete, or widely considered to be poor programming practice, and should not be used: