Adds the Gmsh finite element mesh generator library to the Fortran Package Manager (fpm).
This repository automatically downloads the Gmsh API every hour from the upstream repo https://gitlab.onelab.info/gmsh/gmsh.git. Releases are automatically authored based on the upstream repository.
The repository provides:
- Access to the Fortran F2018 API of Gmsh
- Examples of how to use the Fortran API
- A Fortran compiled executable for Gmsh itself
To use gmsh-fpm
within your fpm project, add the following to your fpm.toml
file:
Pin to a specific version (Recommended):
[dependencies]
gmsh = { git="https://github.com/gnikit/gmsh-fpm.git", tag = "4.12.2" }
or live at head:
[dependencies]
gmsh = { git="https://github.com/gnikit/gmsh-fpm.git" }
To build the gmsh
executable and all the examples, run:
fpm build --link-flag "-L/path/to/gmsh/lib"
or by setting the FPM_LDFLAGS=-L/path/to/gmsh-sdk/lib
environment variable.
To run any of the examples or the Gmsh executable itself, you need to add the lib
directory to the LD_LIBRARY_PATH
.
You can do that only for fpm
via:
export FPM_LDFLAGS="-L/path/to/gmsh/lib -Wl,-rpath,/path/to/gmsh/lib"
fpm run
With FPM_LDFLAGS
defined as above, normally one can run the examples in the usual way:
fpm run --example t1
If the example requires input files, one will need to change to the example directory and run the executable from there:
fpm run --example t13 --runner cp -- example/fortran/; pushd example/fortran/; ./t13; rm t13; popd
For the fpm feature request that would simplify the above command see Issue #410.
libgmsh.so
orlibgmsh.a
, see Installing Gmsh- A Fortran compiler with F2018 support, Compiler section
This fpm
package requires libgmsh
to be already installed on your system.
You can download relevant Software Development Kit (SDK) from the Gmsh website.
❗ Important | Download the same Gmsh SDK version as the one used in gmsh-fpm |
---|
For building Gmsh from source, instead of downloading an SDK, checkout the Gmsh repository or source distributions and follow the relevant instructions.
The API uses optional
arguments in C interoperable procedures, a feature available
in the F2018 standard. The following Fortran compilers are known to work:
Vendor | Compiler |
---|---|
GNU | gfortran |
Intel | ifort , ifx |
NAG | nagfor |