Much of this material has been taken, sometimes verbatim, from the following documents:
Items in this section are fairly general and fundamental in nature. They impact all three of the items listed above - maintainability, portability, and efficiency.
Try to use ANSI standard Fortran 90 exclusively. If you must,
you can use C or C++, but it must work with PARAMESH and be callable
from a Fortran 90 program.
Items in this section are fairly specific, and primarily impact the
readability, and thus the maintainability, of the final product.
It is recognized that rules for "good coding style" are somewhat
subjective.
y1 = (-b + Sqrt(b**2 - 4.*a*c))/(2.*a)is easier to read than this:
y1=(-b+Sqrt(b**2-4.*a*c))/(2.*a)or this:
y1 = ( - b + Sqrt ( b ** 2 - 4. * a * c ) ) / ( 2. * a )
dum1 = Sqrt((fr (i,j) - fr ( 1, j))**2 + &is easier to read than this:
(fth(i,j) - fth( 1, j))**2)
dum2 = Sqrt((fr (i,j) - fr (n1, j))**2 + &
(fth(i,j) - fth(n1, j))**2)
dum3 = Sqrt((fr (i,j) - fr ( i, 1))**2 + &
(fth(i,j) - fth( i, 1))**2)
dum4 = Sqrt((fr (i,j) - fr ( i,n2))**2 + &
(fth(i,j) - fth( i,n2))**2)
dum1 = Sqrt((fr(i,j) - fr(1,j))**2 + (fth(i,j) - &
fth(1,j))**2)
dum2 = Sqrt((fr(i,j) - fr(n1,j))**2 + (fth(i,j) - &
fth(n1,j))**2)
dum3 = Sqrt((fr(i,j) - fr(i,1))**2 + (fth(i,j) - &
fth(i,1))**2)
dum4 = Sqrt((fr(i,j) - fr(i,n2))**2 + (fth(i,j) - &
fth(i,n2))**2)
Subroutine sub (c)
Character*(*) c
If ( bccode == 13 ) then
[Lines and lines of code]
Do i = 1,nzones
If ( zondim(1,i) > 0 ) then
[More lines and lines of code]
End if ! If ( zondim(1,i) > 0 ) then
End do ! Do i = 1,nzones
End if ! If ( bccode == 13 ) then
!-----Fill the guardcells of all PARAMESH blocksis more meaningful than this:
Call amr_guardcell
!-----Call amr_guardcell
Call amr_guardcell
The following Fortran features are either formally declared as obsolete, or widely considered to be poor programming practice, and should not be used: