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

Christophe Geuzaine cgeuzaine at ulg.ac.be
Wed Feb 12 17:02:11 CET 2014


On 11 Feb 2014, at 11:38, Sacconi, Andrea <a.sacconi11 at imperial.ac.uk> wrote:

> 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.
> 

Basically:

* a model is stored as a GModel
* the GModel contains a bunch of geometrical entities derived from GEntity (GVertex, GEdge, GFace, GRegion)
* each GEntity can store its mesh: i.e., both mesh elements, derived from MElement (MPoint, MLine, MTriangle, MTetrahedron, etc.), and mesh vertices (derived from MVertex)

The 2009 paper contains the basics... but we should indeed write a short introduction to the API. 

Christophe


> Any help would be much appreciated!
> Kind regards,
> Andrea
> __________________________________________________________
> 
> Andrea Sacconi
> PhD student, Applied Mathematics
> AMMP Section, Department of Mathematics, Imperial College London,
> London SW7 2AZ, UK
> a.sacconi11 at imperial.ac.uk
> 
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh

-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine