[Gmsh] gmsh and python

Eiser, Sebastian sebastian.eiser at k-ai.at
Fri Jan 25 09:04:23 CET 2013


Elisabetta,
I'm also curious on the python interface and heard about it, but have never used it. From what you write though, it may be sufficient to do this in a python script:

#!/usr/bin/python
from subprocess import call
# you script that writes "input.geo"
# ... 
# after writing the geo file, call gmsh
call(["gmsh", "-2", "-order 2", "input.geo", "-o", "out.msh"])

Alternatively, you can put everything into a (e.g.) bash script (if you use Linux)

#!/bin/bash
python createGeometry.py # writes "input.geo"
gmsh -2 input.geo -o out.msh 

hope this helps


-----Original Message-----
From: gmsh-bounces at ace20.montefiore.ulg.ac.be [mailto:gmsh-bounces at ace20.montefiore.ulg.ac.be] On Behalf Of Elisabetta Sieni
Sent: Tuesday, January 22, 2013 11:58 AM
To: gmsh at geuz.org
Subject: [Gmsh] gmsh and python

Dear gmsh developper,
I would use gmsh to implement my project. I would to use my code written in Python to run gmsh to build the geometry and the mesh of my problem domain and after save results.

I see that is possible to interface gmsh and python script. Currently I written a phyton script that writes the .geo file to build my geometry. 
I would like to known how I can open gmsh and run my gmsh-files in gmsh using python. Where I can find a tutorial with commands to interface python and gmsh?

Thank you very much

Elisabetta Sieni

-- 

Elisabetta Sieni
Dipartimento di Ingegneria Industriale
Università di Padova
via Gradenigo 6/a
35131 Padova - Italy
e-mail: elisabetta.sieni at dii.unipd.it
         elisabetta.sieni at unipd.it
tel  +39 049 827 7514
fax  +39 049 827 7599
cell +39 338 9991731


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