Skip to content

add flag to not keep comments in foamDictionary and set default behavior to keep them

Functionality to add/problem to solve

foamDictionary when using -set or other flags removes all the comments. this makes almost unsable the tool as a lot of us have pieces of code commented that came from other cases and we want to keep. I would propose that the default behavior would be to keep the comments (as people could loose information) and add a flag to not keep them like -removeComments or something in that logic

Target audience

users in general

Proposal

detect the comments and place them in between the entries where it was before.

What does success look like, and how can we measure that?

if we use it for transportProperties for a dictionary that looks like this:

transportModel  Newtonian;
                //[g  m  s K kgmol A cd]
nu       1e-05; //[0  2 -1 0     0 0  0]
//comment

//comment2
/* block
        of
          comment
*/
Sct        0.7; //[0  0  0 0     0 0  0]

//comment3

that the resulting dictionary at least look like this (with each time that there is a // a new line is created and the /* */ block comments are kept as they were):

transportModel Newtonian;
//[g  m  s K kgmol A cd]
nu              1;//[0  2 -1 0     0 0  0]
//coment

//comment2

/* block
        of
          comment
*/

Sct             0.7;//[0  0  0 0     0 0  0]

//comment3

even if the final structure is not ideal this would be a great addition to using it.