Default emacs f90:
f90-if-indent 3 f90-type-indent 3 f90-program-indent 2 f90-continuation-indent 5
QuaLiKiz indentation is currently a mess. Probably we want to move it to 5 spaces for continuation lines and 2 spaces for the rest soon(tm). Advanced emacs: https://gist.github.com/aradi/68a4ff8430a735de13f13393213f0ea8
As per Fortran standard, keep the line length at 132 characters or lower. This will be enforced at a later date. Continue lines when needed like this:
way too long line & continued
General fortran tips
https://www.fortran90.org/src/best-practices.html Optimize for readability first, and speed later! Probably your code is not the bottleneck (unless it is, then contact Karel)
If it increases readability, try to separate out equations that have terms that need to be reused as much as possible. e.g. not
e01 = tpernorme(irad,ix)* EXP(-Ee/(Tex(irad)*qe*1d3)) e11 = -tpernorme(irad,ix)* EXP(-Ee/(Tex(irad)*qe*1d3)) * qe/(Tex(irad)*qe*1d3)*phi(irad,ix)
exp_E_T = EXP(-Ee/(Tex(irad)*qe*1d3)) e01 = tpernorme(irad,ix)* exp_E_T e11 = -tpernorme(irad,ix)* exp_E_T * qe/(Tex(irad)*qe*1d3)*phi(irad,ix)
The speed difference is almost nothing [reference needed]
Note that branches prefixed with a name (e.g.
name/branchname, for example
karel/implementing_stuff) are to be considered personal branches, and can be removed, rebased and ruined without notice.
- master branch will never have history overwritten
- open merge requests, review and discuss before adding changes to the master branch
General git advice
- Before any
pushoperations, you should
git stashall your local work first.
- Use the newest git client you can find (newer versions are more user friendly)
- Add an ssh key for gitlab access
git statusis very useful, use it often!
meldare useful GUIs that make life easier
--forcea push. (If you really need to overwrite a personal branch, use
- Write nice log messages
- Set up your name and email address as follows:
git config --global user.name "Your Name" git config --global user.email "[email protected]"
- [https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup More on first time setup]
If you want to update directly a shared branch like develop or master, you can avoid generating extra merge clutter in the history (if someone else has in the meantime updated develop on gitlab) by using pull with rebase. This replays your local commits on top of the remote ones, resulting in a linear commit history.
git pull --rebase
Useful git settings
(If you understand what they do)
git config --global push.followTags true git config --global core.editor emacs git config --global merge.tool meld # push current branch by default (not the default in older git clients) git config --global push.default simple # rebase on pull by default (svn update like behaviour) git config --global pull.rebase preserve
If you find yourself force pushing often, [https://stackoverflow.com/questions/30542491/push-force-with-lease-by-default make an alias instead for --force-with-lease].