Arvind, The reason for this is that the attributes are ignored when they are read in from the .msh file. I sent in a patch for this a long time back but I'm not entirely sure whether it was updated. Of course, I have added more things to my version of Gmsh reader/writer in libMesh to suit my needs which includes updating the subdomain_id, and the surface_id/volume_id if you want it.
Meanwhile you might want to look at GmshIO's read/write implementation where they parse the attributes. The physical region is usually the first attribute that is read after the element_id and num_attributes. I'm not on my work computer now but I can probably create a new patch against the working copy and send it over tomorrow. Vijay On Tue, Oct 27, 2009 at 6:07 PM, Arvind Ajoy <[email protected]> wrote: > Dear Users and Developers > > I am trying to read in a simple mesh created using Gmsh, which has two > Physical regions. > I use the example programme ex1.cc to read the .msh file, and write it out > as another > .msh file, i.e ./ex1 -d 2 in.msh out.msh. > > I find that the output of ex1.cc mentions n_subdomains()=1, though there are > two physical > regions. > > Mesh Information: > mesh_dimension()=2 > spatial_dimension()=3 > n_nodes()=45 > n_local_nodes()=45 > n_elem()=32 > n_local_elem()=32 > n_active_elem()=32 > n_subdomains()=1 > n_processors()=1 > processor_id()=0 > > Also, when I look at the out.msh file, I notice that there is only one > Physical region! > > I have tried with both the Gmsh v1 and v2 formats. My libmesh version > corresponds > to the svn trunk. > > I have searched extensively on the archives, but didnt find a solution to my > problem. > Can someone with experience with Gmsh import throw more light on this issue? > > Thanks. > Regards > > Arvind Ajoy > > > > The Gmsh in.geo file is as under ........ > > ================================================================== > a = 1; > > // 4 3 6 > // + + + > // > // > // > // > // + + + > // 1 2 5 > > Point(1) = {0, 0, 0}; > Point(2) = {a, 0, 0} ; > Point(3) = {a, a, 0} ; > Point(4) = {0, a, 0} ; > Point(5) = {2*a,0, 0}; > Point(6) = {2*a,a, 0}; > > Line(1) = {1,2} ; > Line(2) = {3,2} ; > Line(3) = {3,4} ; > Line(4) = {4,1} ; > Line(5) = {2,5} ; > Line(6) = {5,6} ; > Line(7) = {6,3} ; > > Line Loop(8) = {4,1,-2,3} ; > Line Loop(9) = {5,6,7,2}; > Ruled Surface(10) = {8} ; > Ruled Surface(11) = {9} ; > > Transfinite Line{4} = 5 ; > Transfinite Line{2} = 5 ; > Transfinite Line{1} = 5 ; > Transfinite Line{3} = 5 ; > Transfinite Line{5} = 5 ; > Transfinite Line{6} = 5 ; > Transfinite Line{7} = 5 ; > > Transfinite Surface{10} = {1,2,3,4}; > Transfinite Surface{11} = {2,5,6,3}; > // (Note that the list on the right hand side refers to points, not > // curves. > > // Recombine the triangles into quads > Recombine Surface{10}; > Recombine Surface{11}; > > Physical Surface (100) = {10}; > Physical Surface (200) = {11}; > Physical Line (300) = {1,5,6,7,3,4}; > ================================================================ > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Libmesh-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/libmesh-devel > > ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Libmesh-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-users
