| 20 | |
| 21 | |
| 22 | 1) For function/suroutine calls, there should only be five arguments per line. |
| 23 | {{{ |
| 24 | CALL subroutine(arg1, arg2, arg3, arg4, arg5, & |
| 25 | arg6, arg7, ... ) |
| 26 | }}} |
| 27 | |
| 28 | The reason is that subroutine arguments are not strictly checked, so when one is hunting |
| 29 | for bugs, it's nice to be able to quickly check that all the arguments are in the right place. |
| 30 | |
| 31 | 2) Related to point one, in the variable declaration of the subroutine, it's nice to have |
| 32 | all the variables which are passed to/from to be in the same order as they are listed. |
| 33 | {{{ |
| 34 | SUBROUTINE subroutine(arg1, arg2, arg3, arg4, arg5, & |
| 35 | arg6, arg7, ... ) |
| 36 | |
| 37 | ! |
| 38 | !! 0. Variable and parameter declaration |
| 39 | ! |
| 40 | |
| 41 | ! |
| 42 | !! 0.1 Input variables |
| 43 | ! |
| 44 | INTEGER(i_std), INTENT(in) :: arg1 !! Domain size (unitless) |
| 45 | REAL(r_std), INTENT (in) :: arg2 !! Time step (s) |
| 46 | REAL(r_std),DIMENSION (kjpindex), INTENT (in) :: arg3 !! Downwelling short wave flux |
| 47 | |
| 48 | ! |
| 49 | !! 0.2 Output variables |
| 50 | ! |
| 51 | INTEGER(i_std), INTENT(out) :: arg4 !! Domain size (unitless) |
| 52 | REAL(r_std), INTENT (out) :: arg5 !! Time step (s) |
| 53 | REAL(r_std),DIMENSION (kjpindex), INTENT (out) :: arg6 !! Downwellin |
| 54 | |
| 55 | !! 0.3 Modified variables |
| 56 | ! |
| 57 | INTEGER(i_std), INTENT(inout) :: arg7 !! Domain size (unitless) |
| 58 | |
| 59 | }}} |