next up previous contents index
Next: 5.2 Indentation and spaces Up: 5. Programmer's guide Previous: 5. Programmer's guide   Contents   Index

5.1 General code organization

The directory structure is shown in Tab. 3.1. In the master directory for (for ``Fortran''), there are a number of sub directories for groups of files. Most of the files are located somewhere below for/hd. Exceptions are files with modules that might be used outside CO5OLD, like the UIO, EOS, or OPTA routines. A master group (as e.g., for/hd or for/uio) can have a number of sub-group directories (as e.g., for/hd/rhd and for/hd/mhd or just one (as e.g., for/uio/f90), that contain the actual Fortran files.

Although a few ancient subroutines still use the FORTRAN fixed format, for newer code parts, the Fortran free format is strongly recommended.

Subroutines, functions, type definitions, global data, etc. should be collected in modules. Typically, there is one module per file - with some exceptions.

Standard Fortran statements and commands (if, then, subroutine,...) is written in lower case. Preprocessor directives (e.g., #ifdef) are written in lower case. OpenMP declarations and compiler directives are written in upper case. Names of variables, subroutines, and modules can use CamelCase (and underscores).

Implicit type declarations should be avoided, although there is still the tendency to start integer variables with i, m, or n. Instead, all type declarations should be preceded by

  implicit none
which enforces an explicit type declaration of all variables.

All quantities are measured in cgs units.


next up previous contents index
Next: 5.2 Indentation and spaces Up: 5. Programmer's guide Previous: 5. Programmer's guide   Contents   Index