[Gmsh] python wrappers : how to specify the Mesh algorithm and mesh size?

Daniel Wheeler daniel.wheeler2 at gmail.com
Fri Dec 7 16:11:19 CET 2012


On Fri, Dec 7, 2012 at 4:54 AM, Vladimir Popescu <
vladimir.popescu at logilab.fr> wrote:

> Hello,
>
> For specifying the meshing algorithm, along with the various
> meshing options (including the mesh size), it suffices to add
> lines such as the following to your Python script,
> between the GmshInitialize() line and the GModel() line:
>
> // Delaunay 2D meshing algorithm:
> GmshSetOption("Mesh", "Algorithm", 5.)
>
> // Delaunay 3D meshing algorithm:
> GmshSetOption("Mesh", "Algorithm3D", 1.)
>
> // minimal mesh element size; pay attention to the dot after the (0)
> integer:
> GmshSetOption("Mesh", "CharacteristicLengthMin", 0.)
>


I have a few questions about how this works. Is the "mesh" object or are
the mesh data structures held in memory (I assume python-gmsh is not
reading and writing data files since it is using swig)? So, is it possible
to query the mesh from the python command line? How would I do the
following for example.

    >>> mesh = SomeGmshMeshClassOrStructure(...)
    >>> print mesh.numberOfElements
    >>> print mesh.nodeLocations

or whatever the equivalent commands are in python-gmsh. So, what internal
structures are exposed?

A code I work with has an elaborate wrapper for Gmsh data files and creates
classes that can be queried as above. It might be nice to remove the
requirement for reading and writing data files and just access the gmsh
internals via python-gmsh. I'm wondering how feasible this is.

--
Daniel Wheeler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20121207/ad2e1ceb/attachment.html>