Skip to content
This repository has been archived by the owner on Jul 20, 2021. It is now read-only.
/ gmsh-sys Public archive

Unofficial Rust bindings to the Gmsh API

License

Notifications You must be signed in to change notification settings

mxxo/gmsh-sys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unofficial bindings to the Gmsh C API (currently v4.4.1). The bindings are directly generated using bindgen. They're very low-level and you'll likely want them wrapped in a higher-level crate, like rgmsh.

You'll need a copy of the Gmsh SDK library (libgmsh) to link with.

Setting up libgmsh

This crate uses an environment variable GMSH_LIB_DIR. Set GMSH_LIB_DIR to the location of your Gmsh SDK /lib folder. You'll also need to adjust your LD_LIBRARY_PATH to be able to find the library at runtime.

libgmsh installation (Linux)

Download the Gmsh SDK (v4.4.1) to the current folder and set your library variables accordingly.

$ wget http://gmsh.info/bin/Linux/gmsh-4.4.1-Linux64-sdk.tgz -O /tmp/gmsh-sdk.tar.gz
$ tar -xvf /tmp/gmsh-sdk.tar.gz
$ export GMSH_LIB_DIR=$PWD/gmsh-4.4.1-Linux64-sdk/lib/
$ export LD_LIBRARY_PATH=$GMSH_LIB_DIR:$LD_LIBRARY_PATH
$ cargo test -- --test-threads=1

Add the variables to your shell configuration file to avoid having to set them each time.

# in your .bashrc or similar 
GMSH_LIB_DIR="/path/to/your/gmsh-sdk/lib"
export GMSH_LIB_DIR

LD_LIBRARY_PATH=$GMSH_LIB_DIR:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

For posterity, the exact bindgen call (v0.50.0) was

let bindings = bindgen::Builder::default()
                .header("gmsh/api/gmshc.h")
                .generate_comments(true)
                .generate()
                .expect("Unable to generate bindings");

    let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
    bindings
        .write_to_file(out_path.join("bindings.rs"))
        .expect("Couldn't write bindings!");

Gmsh is copyright (C) 1997-2019 by C. Geuzaine and J.-F. Remacle.

From the Gmsh website:

Gmsh is a free 3D finite element mesh generator with a built-in CAD engine and post-processor.

Links:

About

Unofficial Rust bindings to the Gmsh API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages