[Gmsh] Extract mesh info from C++ API classes

Sacconi, Andrea a.sacconi11 at imperial.ac.uk
Tue Feb 11 11:38:23 CET 2014

Hi all GMSH users,

I would like to ask you a quick question about the usage of the API C++ classes to extract the connectivity of the mesh, once it has been created.
The setting is a planar mesh of triangles. I managed to create the GModel, passing lines, planar surface and physical entities. So far, so good.
The problem is, how can I extract how many triangles I have got and their vertices? It seems a silly question, but I am really confused about all the methods I found. What is the method to traverse only the elements and extract their vertices?

For example, what is the difference between GVertex and MVertex? Same questions for the other geometrical objects ...
In general, I need to pass the connectivity information to the C++ code I am writing for my thesis simulations.

Any help would be much appreciated!
Kind regards,

Andrea Sacconi
PhD student, Applied Mathematics
AMMP Section, Department of Mathematics, Imperial College London,
London SW7 2AZ, UK
a.sacconi11 at imperial.ac.uk