New Release of Gmsh Fortran API

Gmsh, the finite element meshing library has officially added a Fortran API that will be included in the next release 4.11.0. You can download the API today with fpm from the automatically updated repo gmsh-fpm, GitHub - gnikit/gmsh-fpm: Gmsh API using the Fortran Package Manager (fpm), where you will also find multiple examples showing how to use Gmsh in Fortran.

Suggestions to improve the API, especially on how optional arguments are handled, are welcome! Please keep in mind though that the API is autogenerated in the upstream GitLab repo (which is not fully open to the public).


Thanks for sharing. I used this library once a long time ago from C++. Looking at the front page, I could not find the Fortran API mentioned explicitly (although there is c, python, …). Could you/… (request to) add an explicit link to the Fortran interface on the front page?

1 Like

From what I understand the page is updated with every release. AFAIK we have updated the relevant docs and everything should be online with release 4.11.0.

1 Like

The page indicates that nagfor is known to work with this. I’m testing on my Mac and get the “Argument IERR_ of BIND(C) procedure C_API is OPTIONAL” errors even with -f2018. I cloned the git repo of gmsh and compiled it myself.

gfortran seems to work as advertised.

Here is the nagfor info:
NAG Fortran Compiler Release 7.1(Hanzomon) Build 7101
Product NPMA871NA for Apple Arm Mac OSX 64-bit