http://www.math.univ-paris13.fr/~cuvelier/software/codes/Python/fc-oogmsh/pyfc-oogmshv3_400.png

The fc_oogmsh Python package make it possible to generate mesh files from .geo file by using gmsh which must be installed. It's also possible with the ooGmsh class to read the mesh file and to store its contains in more user-friendly form. This package must be regarded as a very simple interface between gmsh files and Python. So you are free to create any objects you want from an ooGmsh object.

Package test on
System Python gmsh
Ubuntu 14.04.5 3.6.0 (python) 64 bit: 2.15.0, 2.16.0, 3.0.1, 3.0.3, 3.0.4
  2.7.13 (python) 64 bit: 2.15.0, 2.16.0, 3.0.1, 3.0.3, 3.0.4
Windows 10 2.7.13 (canopy 2.13.3542) 3.0.4 (64 bit)
  2.7.13 (anaconda 4.4.0) 3.0.4 (64 bit)
MacOS Sierra 10.12.6 2.7.13 (python) 3.0.4 (64 bit)

Documentation is available on fc-oogmsh dedicated web page.

Installation:

The fc_oogmsh Python package is available from the Python Package Index, so to install/upgrade simply type

pip install fc_oogmsh -U

Configuration:

One have to configure the package for using with gmsh. For the default configuration we run under Python:

import fc_oogmsh
fc_oogmsh.configure()

The function fc_oogmsh.configure() try to guess where is the gmsh binary. If this command failed or if we want to specify the gmsh binary location, one can use the gmsh option to specify the gmsh binary file with full path.

Now, it's possible to run one of the demo functions

import fc_oogmsh
fc_oogmsh.demo02()

The output of the demo02() function under Linux is:

***********************
Running demo02 function
***********************
*** Build mesh file
[fc_oogmsh] Using input file: <...>/geodir/2d/condenser11.geo
[fc_oogmsh] Overwritting mesh file <...>/.local/share/fc_oogmsh/meshes/condenser11-25.msh
[fc_oogmsh] Running gmsh. Be patient... Use option verbose=3 to see gmsh output
*** Read mesh file
*** Print oGh ->
ooGmsh object
    dim : 2
  types : [1 2]
orders : [1]
    nq : 3474
      q : ndarray object[float64], size (3474, 2)
toGlobal: ndarray object[int64], size (3474,)
  sElts : list of 2 elements
*** Print oGh.sElts[0] ->
Elt object
      d : 1, type : 1, order : 1
    geo : line
    nme : 360
    me : ndarray object[int64], size (2, 360)
phys_lab: ndarray object[int64], size (360,)
geo_lab : ndarray object[int64], size (360,)
part_lab: list of 360 elements
nb_parts: ndarray object[int64], size (360,)
  nTags : list of 0 elements

Examples usage: