Struggling with Gmsh.jl

I am struggling to use the Gmsh.jl API in order to extract some information from a 3D mesh I loaded to my application. There are two simple things I am trying to do.

  1. From the mesh I want to find all the mesh faces as a vector of the identification number of the faces and for each face I want to know the connectivity information i.e. a vector with the ids of the vertices forming each face, including the boundary vertices.

  2. I want to do the same thing for the cells: I want a vector with the identification numbers of all the mesh cells and for each cell I want a vector with the identification numbers of each face forming the cell, including the boundary faces.

I looked at the tutorials for the Gmsh Julia API but they are mostly describing ways to construct meshes, not extracting data from imported ones. I managed to read the vertices with their unique identification numbers and coordinates but the connectivity information is something I am unable to find how to access.

Can anyone please help me with this?

We may have this functionality in ExtendableGrids.jl. It has a Gmsh extension, and we create various kinds of incidence matrices from gmsh output.

@panos.asproulis please share a sample gmsh file and we can provide concrete examples on how to achieve what you need.

Thank you for that. Using this as a reference I managed to extract the vertices which form a face (face connectivity information). I am now trying to find the faces which form a cell but according to the Gmsh API I can only find how to obtain the vertices forming a cell. Any hints?

ExtendableGrids can calculate these as matrices after converting the gmsh info to an ExtendableGrid.
With examples/gmsh.jl:

julia> g=gmsh_t5();
ulia> g[FaceNodes]
3×28843 Matrix{Int32}:
1423  1423   255  1423   256   255  …   967  1914  1914  967  1271  1271
256   255   256  1539  1412  1412     2386   886   967  929  1274  1274
255  1539  1539   256   255  1539     1914   967   929  886  2852  1295

julia> g[CellFaces]
4×13801 Matrix{Int32}:
1  5   8  11  14  17  20  23  25  28  …  28837  28840  28840  28842  28842
2  3   9   6   4   7  21  22  26  12     16232  19348  28841  28658  28843
3  6  10  12  15  18  15  19  27  27     28517  26964  17764  19088  28601
4  7   2  13  16  19  22  24  10  29     28839  28838  28839  27068  28662

If this is what you need…