<html><head></head><body><div>On Fri, 2017-09-22 at 12:13 +0200, Jayesh Badwaik wrote:</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><pre>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.) 
</pre></blockquote><div><br></div><div>your question can be answered by grepping for '$Nodes' for example in the source tree. The answer is</div><div><br></div><div>Geo/GModelIO_MSH.cpp</div><div>Geo/GModelIO_MSH2.cpp</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><pre>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). 
</pre></blockquote><div><br></div><div>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?</div><div>If that is the case, then it is an old unresolved issue:</div><div><br></div><div><a href="http://onelab.info/pipermail/gmsh/2013/008183.html">http://onelab.info/pipermail/gmsh/2013/008183.html</a></div><div><br></div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><pre>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. 
</pre></blockquote><div><br></div><div>I am betting on inefficient loops.</div><div>I am not a Gmsh developer, but I have written my own .msh reader/writer for both FEM and FVM.</div><div>See for example</div><div><br></div><div><a href="https://bitbucket.org/seamplex/wasora/src/3dd04c3c1c236adae5799354114698112c46e232/src/mesh/gmsh.c?at=master&fileviewer=file-view-default">https://bitbucket.org/seamplex/wasora/src/3dd04c3c1c236adae5799354114698112c46e232/src/mesh/gmsh.c?at=master&fileviewer=file-view-default</a></div><div><a href="https://bitbucket.org/seamplex/wasora/src/3dd04c3c1c236adae5799354114698112c46e232/src/mesh/neighbors.c?at=master&fileviewer=file-view-default">https://bitbucket.org/seamplex/wasora/src/3dd04c3c1c236adae5799354114698112c46e232/src/mesh/neighbors.c?at=master&fileviewer=file-view-default</a></div><div><br></div><div>Regards</div><div>--</div><div>jeremy</div><div><a href="http://www.seamplex.com">www.seamplex.com</a></div><div><br></div></body></html>