cpp
or a compatible pre-processor.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
.
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.