On Fri, 2017-09-22 at 12:13 +0200, Jayesh Badwaik wrote:

> I am looking for code in gmsh that reads the msh file (say of an 2d 
> triangular grid as the msh file attached in the mail) and populates the 
> faces which are displayed in the mesh but not written in the gmsh file. 
> (As far as I understand, gmsh writes only the boundary faces.) 

your question can be answered by grepping for '$Nodes' for example in the 
source tree. The answer is

Geo/GModelIO_MSH.cpp
Geo/GModelIO_MSH2.cpp

> I am trying to write a code that reads msh files and and converts it into 
> a grid. This involves populating the faces which are not written in the 
> msh file. I see that gmsh itself is able to read the msh file and populate 
> the faces very quickly (almost instantly on my computer). 

At first I did not understand your point, but after a second look it seems to 
me you are referring to the
faces of the volumetric elements that are in the bulk of a volume (i.e. the 
triangles that conform a
tetrahedron) so you can detect neighboring cells,  aren't you?
If that is the case, then it is an old unresolved issue:

http://onelab.info/pipermail/gmsh/2013/008183.html


> In contrast, my own finite volume code takes substantially more time to 
> read the same mesh. Hence, I am wondering how gmsh does it so quickly 
> and would like to read the relevant code. 

I am betting on inefficient loops.
I am not a Gmsh developer, but I have written my own .msh reader/writer for 
both FEM and FVM.
See for example

https://bitbucket.org/seamplex/wasora/src/3dd04c3c1c236adae5799354114698112c46e232/src/mesh/gmsh.c?at=maste
r&fileviewer=file-view-default
https://bitbucket.org/seamplex/wasora/src/3dd04c3c1c236adae5799354114698112c46e232/src/mesh/neighbors.c?at=
master&fileviewer=file-view-default

Regards
--
jeremy
www.seamplex.com

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
gmsh mailing list
[email protected]
http://onelab.info/mailman/listinfo/gmsh

Reply via email to