[Gmsh] python and gmsh

Daniel Wheeler daniel.wheeler at nist.gov
Tue Mar 20 18:58:39 CET 2007

On Mar 20, 2007, at 2:59 PM, Magnus Hagdorn wrote:

> On Tue, 2007-03-20 at 14:51 +0000, Daniel Wheeler wrote:
>> Hi,
>> I was wondering if anyone had thought about exposing some of the gmsh
>> functionality
>> to python. We develop a finite volume code in python
>> <http://www.ctcms.nist.gov/fipy> and
>> use gmsh externally to create meshes and then read them in. It would
>> be desirable to have closer
>> coupling with gmsh from within python, especially for adaptive  
>> meshing
>> and multigrid solutions.
>> I am not sure if this is even a good idea or a project worth
>> undertaking, but I'd like to hear peoples
>> thoughts on the matter.
> I have written some code which will start gmsh in a second thread from
> python. The only thing python does is monitor the progress of gmsh.
> After it finishes you can read the generated mesh file.
> Cheers
> magnus

We do something similar in that we read from a file and have bits of  
code that launch gmsh
with system() commands, your stuff sounds a little more  
sophisticated. Here is the code
that we use to do this:


It is fairly crude in that we write the gmsh file and then use our  
GmshImporter object to read it.
GmshImporter is subclassed from our base Mesh classes. Ideally, we'd  
like to query gmsh directly for
things like cell centers, face areas and the like and have these  
returned as numpy arrays rather than computing
all of this in python, which can be slow and use a lot of memory.

How do you query gmsh in order monitor its progress? Are you actually  
hooking into to gmsh with a python call?

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

Daniel Wheeler

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20070320/05a0436c/attachment.html>