|
[Sponsors] |
Can we use "astyle" to transform our code to the OpenFOAM coding style? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 22, 2016, 09:14 |
Can we use "astyle" to transform our code to the OpenFOAM coding style?
|
#1 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34 |
Hi all,
The OpenFOAM coding style is nicely set out here: http://openfoam.org/dev/coding-style-guide/ To conform to this style, we can of course make changes to our text editor (or IDE) config files to help us when writing the code; alternatively, we could post-process the code files to the correct style after writing them using a tool such astyle (http://astyle.sourceforge.net), for example. The second approach is obviously helpful when people send you ugly code. Does anybody have any advice/thoughts/experience on using a post-processing tool to clean-up code? From a quick look through the astyle documentation, I have found that using the following command gets close, but it is not quite correct (e.g. operators + and - should be padded by spaces but * and / should not; also indentations seem to be 8 spaces in some places, ...): Code:
astyle --style=bsd --indent=spaces=4 --indent-classes --indent-col1-comments --break-blocks --pad-oper --pad-header --delete-empty-lines --align-pointer=type --align-reference=type --convert-tabs --max-code-length=80 --mode=c myOpenFOAMClass.C |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM v3.0+ ?? | SBusch | OpenFOAM | 22 | December 26, 2016 15:24 |
Why do code crash when OpenFOAM is combined with VTK? | Algis | OpenFOAM Programming & Development | 0 | February 2, 2016 12:43 |
OpenFOAM Foundation releases OpenFOAMŪ 3.0.0 | CFDFoundation | OpenFOAM Announcements from OpenFOAM Foundation | 1 | November 7, 2015 16:16 |
Coupling code aster with openfoam | som87 | OpenFOAM Running, Solving & CFD | 0 | December 11, 2012 10:58 |
Design Integration with CFD? | John C. Chien | Main CFD Forum | 19 | May 17, 2001 16:56 |