FORTRAN 90+: COMMENTS DEMONSTRATION
The use of comments is demonstrated in the Theory section using snippets of code, as well as in an example below. Links to actual codes that use comments are found in the Examples section or can be found by visiting the Numerical Methods section.
EXAMPLE Comments are in italic font.
PROGRAM IMPLICIT NONE INTEGER :: i, j, tick, ios, n ! tick = how many elements INTEGER, PARAMETER :: r4 = selected_real_kind(4,32) INTEGER, PARAMETER :: r8 = selected_real_kind(8,32) REAL(KIND=r4), DIMENSION(:,:), ALLOCATABLE :: mA, cA, f REAL(KIND=r4), DIMENSION(:), ALLOCATABLE :: mB, cB, sol REAL(KIND=r8), DIMENSION(:), ALLOCATABLE :: dsol !NOTE :: FILE FORMAT !The file should be placed into the program as an input, e.g. ! ./h5.e < fort1.20 !Meaning this is coming from a file named "fort1.20" ! !The format of the data within the input file should be as follows: ! N (Number of variables/equations) ! Row 1 Coefficients of Input Matrix and Element 1 of Output Vector ! Row 1 Coefficients of Input Matrix and Element 1 of Output Vector ! .... ! Row N Coefficients of Input Matrix and Element 1 of Output Vector ! !Read in file READ(5,*) n !First line displays size of matrix !Allocate A and B sizes ALLOCATE(mA(n,n), cA(n,n), mB(n), cB(n), f(n,n), sol(n), dsol(n)) <rest of code>