[Gmsh] Third coordinate Z not wanted

Geordie McBain gdmcbain at freeshell.org
Wed Feb 24 00:20:55 CET 2010


On Tue, Feb 23, 2010 at 7:14 PM,  <heolglaz at aol.com> wrote:
> Hi,
>
> I would like to use gmsh to perform simple 2D meshes. I use for the moment
> the option -2 in command line, but the dimension in the resulting mesh file
> is still 3. The solver code I use reads .mesh files but does not read the
> 3rd coordinate Z.
> Does anybody knows an option to specify that the 3rd coordinate must not be
> written in the .mesh file ? I searched along the reference manual and
> messages but did not find it out.

I came across this problem too, for the solver FreeFem++ before it
acquired the ability to read Gmsh's .msh format.  I thought about
modifying Gmsh to output two-dimensional MEDIT .mesh files, but I read
in the MEDIT documentation that that wasn't compliant, so I took the
path recommended by D. L. and used a simple script to strip the
spurious third coordinate; Sed would no doubt serve, but I used Gawk.
I attach it in the hope you'll find it useful.  Run as "gawk -f
3to2.awk yourmesh3.mesh > yourmesh2.mesh".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3to2.awk
Type: application/octet-stream
Size: 550 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20100224/5f7f0623/attachment.awk>