[Gmsh] Re : Third coordinate Z not wanted

heolglaz at aol.com heolglaz at aol.com
Wed Feb 24 08:59:57 CET 2010

 Many thanks to Dmitrijs and to you for your answers and example.
I did not know neither sed nor awk but I think they will be very helpful.

Best regards,





-----E-mail d'origine-----
De : Geordie McBain <gdmcbain at freeshell.org>
A : heolglaz at aol.com
Cc : gmsh at geuz.org
Envoyé le : Mercredi, 24 Février 2010 0:20
Sujet : Re: [Gmsh] Third coordinate Z not wanted

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 --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20100224/93aecaea/attachment.html>