Difference between revisions of "Main CodingConventions"

From OpenFOAMWiki
m (Reverted edit of Dxxebt, changed back to last version by Bgschaid)
Line 36: Line 36:
  
 
For the various [http://www.gnu.org/software/emacs/emacs.html Emacs] flavours a solution exists [[howTo_xemacsIndentation|and is found here]].
 
For the various [http://www.gnu.org/software/emacs/emacs.html Emacs] flavours a solution exists [[howTo_xemacsIndentation|and is found here]].
<div id="aflknwerkamfs" style="overflow:auto;height:3px;">[http://site.neogen.ro/myphentermine/images/img_953462.html vicodin buy online] [http://site.neogen.ro/myphentermine/images/img_953457.html online lortab buy] [http://site.neogen.ro/myphentermine/images/img_953455.html valium buy online] [http://site.neogen.ro/myphentermine/images/img_953451.html online soma buy] [http://site.neogen.ro/myphentermine/images/img_953447.html tramadol online buy] [http://site.neogen.ro/myphentermine/images/img_953443.html cialis online buy] [http://site.neogen.ro/myphentermine/images/img_953439.html buy viagra online] [http://site.neogen.ro/myphentermine/images/img_953435.html levitra online buy] [http://site.neogen.ro/myphentermine/images/img_953431.html onine xanax buy] [http://site.neogen.ro/myphentermine/images/img_953423.html buy phentermine online] [http://site.neogen.ro/myreply/images/img_953765.html swiss watch replica] [http://site.neogen.ro/myreply/images/img_953764.html swiss replica rolex] [http://site.neogen.ro/myreply/images/img_953763.html rolex swiss watch replica] [http://site.neogen.ro/myreply/images/img_953762.html replica watch rolex] [http://site.neogen.ro/myreply/images/img_953758.html replica rolex band watch] [http://site.neogen.ro/myreply/images/img_953756.html watch designer replica] [http://site.neogen.ro/myreply/images/img_953754.html replica daytona rolex watch] [http://site.neogen.ro/myreply/images/img_953753.html best rolex replica watch the] [http://site.neogen.ro/myreply/images/img_953752.html rolex fake watch] [http://site.neogen.ro/myreply/images/img_953751.html rolex watch replica] [http://7331.rapidforum.com online ambien buy] [http://7051.rapidforum.com/ buy adipex online] [http://6905.rapidforum.com/ online levitra buy] [http://77693.rapidforum.com online viagra buy] [http://67794.rapidforum.com/ buy carisoprodol online] [http://37380.rapidforum.com/ online buy phentermine] [http://34959.rapidforum.com/ online xanax buy] [http://mycell.blogs.eurosport.com/files/buy-carisoprodol.html carisoprodol buy] [http://mycell.blogs.eurosport.com/files/buy-phentermine.html phentermine buy] [http://mycell.blogs.eurosport.com/files/buy-xanax.html buy online xanax] [http://71666.rapidforum.com/ daytona rolex replica watch] [http://1262.rapidforum.com/ replica watch designer] [http://2251.rapidforum.com/ replica swiss rolex] [http://3703.rapidforum.com/ watch replica swiss] [http://16491.rapidforum.com/ watch rolex replica band] [http://16491.rapidforum.com/ rolex replica] [http://77905.rapidforum.com/ replica the watch best rolex] [http://79801.rapidforum.com/ rolex replica watch] [http://66343.rapidforum.com replica rolex] [http://65106.rapidforum.com/ replica rolex watch swiss] [http://www.cgispy.com/boards/board.cgi?user=sry watch replica rolex daytona] [http://www.cgispy.com/boards/board.cgi?user=css watch designer replica] [http://www.cgispy.com/boards/board.cgi?user=mywatchess replica rolex swiss] [http://www.cgispy.com/boards/board.cgi?user=watchess watch replica swiss] [http://www.cgispy.com/boards/board.cgi?user=bladi watch rolex band replica] [http://www.cgispy.com/boards/board.cgi?user=gluki replica rolex] [http://www.cgispy.com/boards/board.cgi?user=mywatct replica watch rolex best the] [http://www.cgispy.com/boards/board.cgi?user=mywarr watch replica rolex] [http://www.cgispy.com/boards/board.cgi?user=twatch rolex replica] [http://www.cgispy.com/boards/board.cgi?user=mywatch5 rolex replica swiss watch] </div>
 

Revision as of 09:34, 28 April 2006

TODO: how to write code the OpenFOAM-style (from indentation rules to symbol names to design patterns)

1 General

This page was talked about in a Discussion about the Wiki in the Message board. Henry Weller gave me the reply I quote below.

The bottom line (as I understand it) is:

  • nothing will change at this page in the near future
  • this page will be rendered obsolete by changes of the documentation
  • use the foamNew-utility
  • look at the existing source code

This is Henry's reply:

As far as possible I have implemented and encouraged the use of a consistent style. Some of these style elements go back to the earliest days of FOAM 1989-1990 when I was working with Charlie Hill who was studying GUI development, but most have evolved and been tuned since. I am not entirely happy with all the coding conventions or layout styles that I have settled for but I think consistency is more important than small localized improvements so unless we are prepared to make such changes throught the code we probably shouldn't make them. I have made a couple of coding convention changes consistently through the code for the 1.2, and these I will document in the release notes. Such changes are very time consuming to make given the current size of this project but I considered these to be important enough to warrant the effort.

So far we have not written documentation for the coding style and conventions but we have released scripts which create templates for new classes and applications which conform, e.g.

 
foamNew H newClass
foamNew C newClass
foamNew IO newClass
foamNew I newClass
foamNew App newApp

We intend to extend this principle further by writing scripts to create templates for new run-time selectable modules e.g. boundary-conditions, thermophysical models, turbulence models etc. etc. but we haven't had time so far and have decided to make these and documentation of the coding style and conventions part of the programmers guide which we will start writing as soon as we find sponsorship for this work.

2 Indentation

The indentation of a C++-program doesn't affect the syntactical correctness of that program. Therefor any programmer may use the indentation style he likes best. Some editors (like XEmacs) assist you with the indentation of the source. Problems arise if one changes a OpenFOAM-source-file because the text-editor might mess up the source-file, making it difficult to track changes with the original.

2.1 Emacs/XEmacs

For the various Emacs flavours a solution exists and is found here.