[Gmsh] mesh generation command from socket connection?

Christophe Geuzaine cgeuzaine at ulg.ac.be
Thu May 1 08:57:41 CEST 2008

Gerd Meiser wrote:
>> Gerd Meiser wrote:
>>> Dear Gmsh users!
>>> Finally I found out how to use the utils/solvers/c++/interactive.cpp 
>>> example to control gmsh through sockets.
>>> However, I am only able to add points, lines and surfaces, but I don't 
>>> know the command to actually generate the mesh and save it to a file. 
>>> Sounds silly, but I couldn't find it in the reference manual.
>>> Would you please tell me the command? (I hope there is one)
>> Hi Gerd - there is none... It might seem a bit weird, but it's because 
>> in "batch" mode usually you mesh by specifying a special command line 
>> argument (e.g. "-3" for 3-D mesh). It's something we should add in a 
>> future release.
> So the socket interface can only be used for something like macros in an interactive Gmsh session? It is not intended to use the Gmsh functionality from other programs?

It is... I've added a simple meshing command in the script language:
with tomorrow's nightly build you should be able to use "Mesh 1;", "Mesh
2;" and "Mesh 3;" to mesh in 1-D, 2-D and 3-D.

But then again, if you just want to generate meshes from an exterior
program without interacting with Gmsh, the simplest way is to just run
Gmsh using a system call (e.g. system("gmsh mymodel.step -3") on
Unix)... Then read the mesh from disk and you're done. Using sockets
will not give you anything more.

>> What do you plan to use the socket interface for? (Maybe using Gmsh 
>> directly as a library would better fit your application?)
> Probably this is exactly what I need. I want to use Gmsh as a mesh generator within a VTK application. Can I find documentation and examples how to use Gmsh as library anywhere?

cf. utils/misc/driver.cpp. Beware that the API is not frozen, so it
still changes quite frequently.

> Thank you
> G. Meiser
>       ____________________________________________________________________________________
> Be a better friend, newshound, and 
> know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science