<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Dear Moritz,<br>
<br>
Here is a version of your script that use a python field to define
the characteristic mesh size.<br>
It does not use any other file than the python script itself to
define both the geometry and the mesh size.<br>
<br>
regards<br>
Jonathan<br>
<div class="moz-cite-prefix">On 22/07/13 12:19, moritz braun wrote:<br>
</div>
<blockquote
cite="mid:CAMeLzdCjdZoQYcYpY9H9BTqC=ch_ZQoh+PZJkcyfeWgSZKbQMQ@mail.gmail.com"
type="cite">
<div>Dear Jonathan</div>
<div><br>
</div>
<div>Please find attached my python script.</div>
<div><br>
</div>
<div>It allows me to cut out smaller spheres out of the one large
one.</div>
<div>However, when meshing I can only work with a constant
characteristic length.</div>
<div>What I need is a way access the characteristic length
parameter from python</div>
<div>and provide function that is smallest close to the centres of
the smaller spheres via</div>
<div>Python. This would be much convenient then </div>
<div>having to generate a geo file that defines the smaller
spheres and</div>
<div>also defines the Field function in the very restricted
expression syntax of geo files!</div>
<div><br>
</div>
<div>regards</div>
<div><br>
</div>
<div>Moritz </div>
<br>
<div class="gmail_quote">On Mon, Jul 22, 2013 at 10:06 AM,
Jonathan Lambrechts <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:jonathanlambrechts@gmail.com" target="_blank">jonathanlambrechts@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Sorry, it's not clear
for me how you specify your geometry to gmsh.<br>
If it is by loading a file (any file, not specially geo
file), I think you can use the example, just replace the
line that load the geo file by a line loading your file.<br>
If it is through the GUI, you can still do it after the
script run (just remove the line loading the geo file).<br>
if it is something else, please send me an example and I
will try to do it in python.<br>
<br>
If you want to construct the geometry directly in python,
this is doable but not documented and I'm not sure it's
stable. I have no example of this but I can try to build
one if you give me more details.<br>
<br>
regards,<br>
<br>
jonathan
<div>
<div class="h5"><br>
<br>
<blockquote type="cite">
<div>Dear Jonathan</div>
<div><br>
</div>
<div>Thanks a lot for your work and the example.</div>
<div><br>
</div>
<div>Since I am however creating the mesh without
using a .geo file but rather</div>
<div>with constructive solid Geometry the</div>
<div>example does not really help me that much!</div>
<div>An example not using a .geo file would be welcome</div>
<div><br>
</div>
<div>regards</div>
<div><br>
</div>
<div>Moritz</div>
<br>
<br>
<div class="gmail_quote">On Thu, Jul 18, 2013 at 5:29
PM, Jonathan Lambrechts <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:jonathanlambrechts@gmail.com"
target="_blank">jonathanlambrechts@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">sorry,
it should have been FieldPython.h and not
PythonField.h (corrected now)
<div>
<div><br>
On 18/07/13 16:55, trophime wrote:<br>
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex"> On Thu,
2013-07-18 at 15:51 +0200, Jonathan
Lambrechts wrote:<br>
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex"> Hi,<br>
I just added python fields (they will be
available in the next nightly<br>
build).<br>
<br>
There is no embedded python interpreter in
Gmsh, we rather provide<br>
python bindings for the Gmsh library. This
is still work in progress,<br>
in particular there is no documentation
nor stable API, we just bind<br>
most of Gmsh internal functions to python.<br>
Gmsh Library and python bindings can be
downloaded with the gmsh<br>
dynamic library from Gmsh website :<br>
<a moz-do-not-send="true"
href="http://geuz.org/gmsh/bin/Linux/gmsh-svn-Linux64-dynamic.tgz"
target="_blank">http://geuz.org/gmsh/bin/Linux/gmsh-svn-Linux64-dynamic.tgz</a><br>
<a moz-do-not-send="true"
href="http://geuz.org/gmsh/bin/MacOSX/gmsh-svn-MacOSX-dynamic.tgz"
target="_blank">http://geuz.org/gmsh/bin/MacOSX/gmsh-svn-MacOSX-dynamic.tgz</a><br>
<a moz-do-not-send="true"
href="http://geuz.org/gmsh/bin/Windows/gmsh-svn-Windows64-dynamic.zip"
target="_blank">http://geuz.org/gmsh/bin/Windows/gmsh-svn-Windows64-dynamic.zip</a><br>
<br>
On linux and OSX, to build the python
bindings, go to the "gmshpy"<br>
sub-directory the run the python script
"setup.py" (e.g. python<br>
setup.py build; python setup.py install).
On windows, I'm not sure if<br>
it works ...<br>
<br>
An example of python field is attached,
the python script imports the<br>
gmsh python bindings then loads a geo file
and adds some python fields<br>
and at the end, the GUI is started.<br>
</blockquote>
When trying to package latest rev for
debian, the installation fails :<br>
--<br>
Installing:
/tmp/buildd/gmsh-tetgen-2.8.3~svn16274/debian/tmp/usr/gmshpy/extra_include/Field.h<br>
CMake Error at
wrappers/gmshpy/cmake_install.cmake:232
(FILE):<br>
file INSTALL cannot find<br>
<br>
"/tmp/buildd/gmsh-tetgen-2.8.3~svn16274/wrappers/gmshpy/../../Mesh/PythonField.h".<br>
Call Stack (most recent call first):<br>
cmake_install.cmake:347 (INCLUDE)<br>
<br>
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex"> regards,<br>
<br>
Jonathan<br>
<br>
On 11/07/13 11:49, Nico Schlömer wrote:<br>
<br>
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex"> I'd be
very much interested in a hands-on
example of Gmsh + Python<br>
as well.<br>
<br>
<br>
--Nico<br>
<br>
<br>
On Thu, Jul 11, 2013 at 10:06 AM,
Christophe Geuzaine<br>
<<a moz-do-not-send="true"
href="mailto:cgeuzaine@ulg.ac.be"
target="_blank">cgeuzaine@ulg.ac.be</a>>
wrote:<br>
On 11 Jul 2013, at
09:07, moritz braun<br>
<<a moz-do-not-send="true"
href="mailto:moritz.braun@gmail.com"
target="_blank">moritz.braun@gmail.com</a>>
wrote:<br>
> Dear All<br>
><br>
> I am using gmsh in the
moment to<br>
> create 3D grids with
background field to control the<br>
characteristic length.<br>
> Writing functions as .F
attribute of an Field variable is<br>
rather restrictive<br>
> it would be nice if gmsh
could be extended by embedding<br>
the python interpreter for<br>
> such functions.<br>
> How difficult whould that
be?<br>
><br>
I think you
can already define fields in the Gmsh
Python<br>
interface (CC'ing Jon on this
one: Jon, could you send a<br>
small example?). If this is the
case, then your python<br>
script could simply import the
Gmsh module, merge your<br>
current .geo definitions, then
define the fields directly in<br>
Python.<br>
> regards<br>
><br>
> Moritz<br>
><br>
> --<br>
> Prof M Braun
Tel.:27-12-4298006/8027<br>
> Physics Department Fax.:
27-12-4293643<br>
> University of South Africa
(UNISA)<br>
> <a moz-do-not-send="true"
href="mailto:moritz.braun@gmail.com"
target="_blank">moritz.braun@gmail.com</a><br>
> P.O. Box 392<br>
> 0003<br>
> UNISA<br>
> South Africa<br>
> <a moz-do-not-send="true"
href="http://moritz-braun.blogspot.com" target="_blank">http://moritz-braun.blogspot.com</a><br>
>
_______________________________________________<br>
> gmsh mailing list<br>
> <a moz-do-not-send="true"
href="mailto:gmsh@geuz.org"
target="_blank">gmsh@geuz.org</a><br>
> <a moz-do-not-send="true"
href="http://www.geuz.org/mailman/listinfo/gmsh" target="_blank">http://www.geuz.org/mailman/listinfo/gmsh</a><br>
--<br>
Prof. Christophe Geuzaine<br>
University of Liege, Electrical
Engineering and Computer<br>
Science<br>
<a moz-do-not-send="true"
href="http://www.montefiore.ulg.ac.be/%7Egeuzaine"
target="_blank">http://www.montefiore.ulg.ac.be/~geuzaine</a><br>
_______________________________________________<br>
gmsh mailing list<br>
<a moz-do-not-send="true"
href="mailto:gmsh@geuz.org"
target="_blank">gmsh@geuz.org</a><br>
<a moz-do-not-send="true"
href="http://www.geuz.org/mailman/listinfo/gmsh"
target="_blank">http://www.geuz.org/mailman/listinfo/gmsh</a><br>
<br>
<br>
</blockquote>
_______________________________________________<br>
gmsh mailing list<br>
<a moz-do-not-send="true"
href="mailto:gmsh@geuz.org"
target="_blank">gmsh@geuz.org</a><br>
<a moz-do-not-send="true"
href="http://www.geuz.org/mailman/listinfo/gmsh"
target="_blank">http://www.geuz.org/mailman/listinfo/gmsh</a><br>
</blockquote>
</blockquote>
<br>
<br>
_______________________________________________<br>
gmsh mailing list<br>
<a moz-do-not-send="true"
href="mailto:gmsh@geuz.org" target="_blank">gmsh@geuz.org</a><br>
<a moz-do-not-send="true"
href="http://www.geuz.org/mailman/listinfo/gmsh"
target="_blank">http://www.geuz.org/mailman/listinfo/gmsh</a><br>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
Prof M Braun Tel.:27-12-4298006/8027<br>
Physics Department Fax.: 27-12-4293643<br>
University of South Africa (UNISA) <br>
<a moz-do-not-send="true"
href="mailto:moritz.braun@gmail.com" target="_blank">moritz.braun@gmail.com</a><br>
P.O. Box 392 <br>
0003 <br>
UNISA<br>
South Africa <br>
<a moz-do-not-send="true"
href="http://moritz-braun.blogspot.com"
target="_blank">http://moritz-braun.blogspot.com</a><br>
</blockquote>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
Prof M Braun Tel.:27-12-4298006/8027<br>
Physics Department Fax.: 27-12-4293643<br>
University of South Africa (UNISA) <br>
<a moz-do-not-send="true" href="mailto:moritz.braun@gmail.com"
target="_blank">moritz.braun@gmail.com</a><br>
P.O. Box 392 <br>
0003 <br>
UNISA<br>
South Africa <br>
<a moz-do-not-send="true" href="http://moritz-braun.blogspot.com"
target="_blank">http://moritz-braun.blogspot.com</a><br>
</blockquote>
<br>
</body>
</html>