Changes between Version 37 and Version 38 of HowTo/FortranStandards


Ignore:
Timestamp:
2013-06-25T14:09:46+02:00 (11 years ago)
Author:
mmcgrath
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowTo/FortranStandards

    v37 v38  
    265265 
    266266(1) Try to keep non-header lines to 80 characters or less, although this is not a hard limit. 
     267 
    267268(2) Put Fortran keywords and intrinsic functions in all uppercase letters. 
     269 
    268270(3) Do not use tab characters, as a mix of tab characters and spaces makes for terrible formatting portability.  As noted above, tab in emacs is fine, since it actually uses spaces. 
     271 
    269272(4) Five arguments per line as a soft guideline for subroutine and function calls/declaration (soft guideline meaning it's not the end of the world if sometimes four or six are used). 
     273 
    270274(5) Include IMPLICIT NONE in module declarations. 
     275 
    271276(6) Always use INTENT statements for arguments. 
     277 
    272278(7) Never use "magic numbers", i.e. hard-coded numbers that cannot be traced to a literature formula.  Externalization helps a lot with this. 
     279 
    273280(8) Be mindful of loop ordering for best memory access (performance).  In other words, 
    274281 
     
    284291 
    285292}}} 
     293 
    286294This ensures that one accesses continginuos memory blocks during the loop, which makes it faster.  I saw this in an optimization course back in 2004, as well, but it seems to not always be done in ORCHIDEE.  Have compilers just gotten better?  Some people have also suggested a guideline for the loops (i.e., loop over points first, then PFT, then nparts, etc.), since this also does not seem consistent. 
    287295