Julia artifacts for Gmsh Software Development Kit
Install from the Pkg REPL:
pkg> add https://github.com/WaveProp/GmshSDK
This package provides in its Artifacts.toml
the information required to
download and use the Gmsh Software Development Toolkit, as well as some
convenience functions to interface meshes and domains created by Gmsh with
solvers in the WaveProp organization.
To simply use the Gmsh
API, you can do the following:
using GmshSDK
gmsh.initialize()
# do gmsh-fu
gmsh.finalize()
where gmsh-fu stands for anything described on the official gmsh api manual.
As mentioned, the package also provides some convenience functions for
converting meshes and/or domains created in Gmsh to internal representations
defined in WavePropBase
. An
example of such a usage would be:
using GmshSDK, Plots
import WavePropBase as WPB
Ω,M = @gmsh begin
WPB.clear_entities!()
gmsh.model.occ.addSphere(0,0,0,1)
gmsh.model.occ.synchronize()
gmsh.model.mesh.generate(3)
Ω = GmshSDK.domain()
M = GmshSDK.meshgen(Ω)
return Ω,M
end
Γ = WPB.boundary(Ω) # extract the boundary
plot(view(M,Γ)) # plot the elements of the mesh on Γ
The version of gmsh
used is stored in the GmshSDK.GMSH_VERSION
variable. You
can also query the Gmsh version through gmsh.GMSH_API_VERSION
,
gmsh.GMSH.API_VERSION_MAJOR
, and gmsh.GMSH_API_VERSION_MINOR
. If you need a
specific version of Gmsh, you can run scripts/generate_artifacts.jl
to
create your own Artifacts.toml
file locally.
If you simply need a wrapper for the Gmsh api, see also:
Please file an issue if you run into a problem when trying to install this package.