Changes between Version 3 and Version 4 of Documentation/UserGuide/CodingGuidelines


Ignore:
Timestamp:
2020-05-29T17:30:26+02:00 (4 years ago)
Author:
aducharne
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/UserGuide/CodingGuidelines

    v3 v4  
    44Last revision: B. Guenet (2020/03/19) 
    55 
    6 Coding guidelines have been established to facilitate the development of the ORCHIDEE code. All developers should follow these guide lines when improving or adding new features to the code.  
     6Coding guidelines have been established to facilitate the development of the ORCHIDEE code. All developers should follow these guidelines when improving or adding new features to the code.  
    77 
    8 Moreover, any new suggestions to these coding guide lines, in order to improve the readability, the efficiency and the robustness of the code are welcome. You can make these suggestions to the ORCHIDEE project group. 
     8Moreover, any new suggestions to these coding guide lines, in order to improve the readability, the efficiency and the robustness of the code are welcome. You can make these suggestions to the ORCHIDEE project group (orchidee-projet at listes.ipsl.fr). 
    99 
    10 All details must be found here 
     10Detailed guidelines must be read in [attachment:ORCHIDEE_Coding_Guidelines_v1.0.pdf​ coding_guidelines.pdf] and [attachment:ORCHIDEE_Coding_Guidelines_v1.0.doc coding_guidelines.doc] 
    1111 
    12 See [attachment:ORCHIDEE_Coding_Guidelines_v1.0.pdf​ coding_guidelines.pdf] and [attachment:ORCHIDEE_Coding_Guidelines_v1.0.doc coding_guidelines.doc] 
    13  
    14 But the main take home message is: 
     12But the main "take home" messages are: 
    1513 
    1614* Comment your code as most as you can and make sure that it easy to understand for non specialist 
     
    2422* If you are using a SELECT CASE ... CASE ... END SELECT statement, it is recommended for the same reason that you include a “CASE default” statement at the end. 
    2523 
    26 * When defining a variable wrote in the comment the unit and be sure that it is coherent with the rest of the calculation 
     24* When defining a new variable, use a comment in the declaration part to give the unit and meaning of the variable, and make sure that the unit is coherent with the rest of the calculations 
    2725 
    2826* Although the maximum line length of FORTRAN 90 is 132 characters, try to keep your code to less than 100 characters per line - this preserves the formatting for those who work with small terminal windows on their computer and when producing a printout. 
     
    3230* Take care of your indexation when using a loop and identified the statement by a comment just after your ENDIF or ENDDO. 
    3331 
    34 * Be mindful of loop ordering for best memory access (performance). If the embedded loops are independent, then the first index should correspond to the most inner loop. This ensures that one accesses contiguous memory blocks during the loop, which makes it faster. 
     32* Be mindful of loop ordering for best memory access (performance). If the embedded loops are independent, then the first index should correspond to the most inner loop. This ensures that one accesses contiguous memory blocks during the loop, which makes it faster (example on page 17 of [attachment:ORCHIDEE_Coding_Guidelines_v1.0.pdf​ coding_guidelines.pdf]) 
    3533 
    36  * Test your modifications on several computers using different compilers. Activate compile debug options for testing the code. In ORCHIDEE/arch directory, you find compile debug options for different computers 
     34 * Test your modifications on several computers, as they use different fortran compilers. In the ORCHIDEE/arch directory, you find compile and debug options for different computers. Activate compile debug options for testing the code ([wiki:Documentation/UserGuide/flags howto]). 
    3735