[Gmsh] Comments in .msh files

Christophe Geuzaine cgeuzaine at ulg.ac.be
Mon Jan 5 18:16:28 CET 2009


Robert Funnell wrote:
> On Sun, 28 Dec 2008, Christophe Geuzaine wrote:
> 
>> Robert Funnell wrote:
>>> In Section 1.8 of the manual dated 2008 Nov 21 it says 'All Gmsh ASCII text 
>>> input files support both C and C++ style comments' but a message dated 2008 
>>> Nov 19 says 'you cannot add comments in .msh files! (I've added a note in 
>>> the doc to make this clear.)'. Is that added note in the documentation 
>>> somewhere that I haven't found?
>>>
>> Indeed, I forgot to commit the change. We don't support C/C++ style
>> comments in .msh files for performance reasons. However, you can simply
>> add a section with a dummy header (after the format section), and it
>> will be ignored by Gmsh.
> (...)
>> You can add comments in a mesh file (@file{.msh}) by adding a section
>> with an unrecognized label (e.g., @code{$Comments}/@code{$EndComments})
>> after the @code{$MeshFormat}/@code{$EndMeshFormat} section: see @ref{MSH
>> ASCII file format}.
> (...)
> 
> Perfect! Merci beaucoup.
> 
> On a related note, I have not found any explicit explanation of what a 
> .geo file is in the manual. Would it make sense to add a brief section 
> to Chapter 9, explaining that it is a script file containing Gmsh 
> commands and comments? This would clarify things for beginners. 
> Perhaps Section 1.8 could be moved into such a new section.

Agreed. I've reorganized some the manual to make these things clearer: 
can you have a look? http://geuz.org/gmsh/beta/gmsh.pdf

(In short: you actually don't even have to put the scripts in ".geo" 
files: when Gmsh encounters a file that it doesn't recognize, it simply 
tries to parse it, whatever its extension. You can just launch "gmsh 
aa.txt" and Gmsh will try to parse the contents of "aa.txt".)

> 
> Still on the subject of the file formats, I am confused about the 
> relationship between the statement just before Section 6.1, 
> recommending the use of .pos files, and the statement in Section 9.4.2 
> that .pos files have been superseded by .msh files. The new .pos 
> format does not seem to be explicitly defined anywhere.

Right, I think this should be clearer in the new version of the manual.

Historically there have been three kinds of ".pos" files: "parsed", 
"ASCII" and "binary".

- "parsed" .pos files are still used and will continue to be used. These
files are parsed by the same parser as the geometry/script files. Many
people use the ".pos" extension for these file, although they don't have
to. You can simply put a parsed post-processing view in a text file, a
.geo file, whatever. The "format" is defined in section 6.1: it consists
of a single scripting construct called "View". You can embed Views in 
any script file: see e.g. tutorial/t4.geo.

- "ASCII" and "binary" .pos files are the ones that have been
deprecated. They are described in the "legacy" file format section. You 
should not use these formats in new codes. Instead, simply use the .msh
file.

Hope this helps,

Christophe



> 
> - Robert
> 
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh
> 
> 


-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine