-
Notifications
You must be signed in to change notification settings - Fork 16
Coding style
mrachh edited this page Jul 22, 2021
·
1 revision
- All code should be sufficiently documented
- Max 80 characters per line in all files, .c, .cpp, .h, .py, .f90, .f etc. Anything wider makes remote login work difficult.
- Use
implicit noneorimplicit double precision (a-h,o-z) - Use spaces and not tabs in code. Preferably two spaces per level of indent
- For fortran codes, all variables in a subroutine should be either intent in, or intent out (no intent inout) and the declaration should be explicit
-
saveorentrystatements in fortran should not be used - The dimensions of input/output variables should be explicit and not deferred
- 5 lines between subroutines
- All fortran code should be subroutines or test programs. No modules and user defined data types
- Static variables should be less than 1kb in size
- goto statements should point to a later point in the subroutine only
- Integer variables to the extent possible should start with the letters (i-n)
- Real and complex variables to the extent possible should start with letters (a-h,o-z)
- Avoid using vector notation to the extent possible. The code runs at O(1k pts/per sec/core), there are a lot of operations that can be afforded for smaller tasks. Use Blas or simplified blas routines in lapack_wrap.f90 in case speed is critical