Skip to content

GmshTools.jl

Install

1
(v1.1) pkg> add GmshTools

Limitations

Due to some failure of building tarballs and writing deps.jl, the libgmsh here does not rely on build_tarballs by BinaryBuilder.jl. Instead, it downloads the Gmsh SDK directly and unpack them (see build.jl). The module gmsh.jl is loaded in __init__() to avoid segment fault on Linux (no problem on MacOS or Windows).

Version

The current SDK version is 4.3.0. The .msh format is 4.1 (not back-compatible).

Basic Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using GmshTools

gmsh.initialize()
gmsh.finalize()

@gmsh_do begin
    # automatically handle initialize and finalize
end

@gmsh_open msh_file begin
    gmsh.model.getDimension()
    # any gmsh API here ...
end

@gmsh_do begin

    @addPoint begin
        x1, y1, z1, mesh_size_1, point_tag_1
        x2, y2, z2, mesh_size_2, point_tag_2
        ...
    end

    @addLine begin
        point_tag_1, point_tag_2, line_tag_1
        point_tag_2, point_tag_3, line_tag_2
        ...
    end

    @setTransfiniteCurve begin
        line_tag_1, num_points_1, Algorithm_1, coefficient_1
        line_tag_2, num_points_2, Algorithm_2, coefficient_2
        ...
    end

    @addField FieldTag FieldName begin
        name_1, value_1
        name_2, value_2
        ...
        # all added to `FieldTag` field
    end

    @addOption begin
        name_1, value_1
        name_2, value_2
        ...
    end

    # more gmsh APIs ...
end

You may see test files for more concrete examples. More convenient macros will come in the future.

To retrieve various mesh information, please refer the Gmsh Julia API.