Coding Style

The code is mainly Fortran 90, with a few parts still clearly showing their Fortran 77 heritage. There should not be any usage of compiler-dependent features or Fortran features from Fortran 95 or later. The code needs to be processed with cpp or a compatible pre-processor.

Object Oriented Fortran

Extensive use is made of Fortran 90 derived types and pointers for dynamic memory allocation of arrays inside derived types. Derived types are named my_type_t and are generally defined in modules named pmc_mod_my_type within files named my_type.f90. Each derived type has allocation and deallocation functions my_type_allocate() and my_type_deallocate(), where appropriate. Almost all subroutines and function in each my_type.f90 file have names of the form my_type_*() and take an object of type my_type as the first argument on which to operate.

Module names are always the same as the name of the containing file, but prefixed with pmc_. Thus the module pmc_condensation is contained in the file condensation.f90.

Memory Management

The memory allocation policy is that all functions must be called with an already allocated structure. That is, if a subroutine defines a variable of type my_type_t, then it must call my_type_allocate() or my_type_allocate_size() on it before passing it to any other subroutines or functions. The defining subroutine is also responsible for calling my_type_deallocate() on every variable it defines.

Similarly, any subroutine that declares a pointer variable must allocate it and any data it points to before passing it to other subroutines or functions. If no specific length is known for an array pointer then it should be allocated to zero size. Any subsequent subroutines are free to deallocate and reallocate if they need to change the size.

This means that every subroutine (except for alloc and free) should contain matching allocate()/deallocate() and my_type_allocate()/my_type_deallocate() calls.


Generated on Mon Jun 15 15:56:22 2009 for PartMC by  doxygen 1.5.6