[Gmsh] telling whether physical entities are defined in a .msh file

Christophe Geuzaine cgeuzaine at ulg.ac.be
Mon Feb 26 11:00:12 CET 2007

OSHIMA Takuya wrote:
> Hi all,
> I'm so sorry for a successive post but please let me explain more
> regarding my previous post since I got a personal response.
>> About your original mail, there also a question I would like to ask:
>>> no physical entities defined at all, or
>> I thought, that if there are mesh elements (!=nodes) in the gmsh2, there need to be also physical objects, as they physical object number tag is obligatory in the msh file? So if there is no "$PhysicalNames" section, there are either no string-names or no mesh elements.
> No, Gmsh2 writes all the elementary entities "as is" with physical
> entity numbers all set to 0 (zero) if no physical entity is defined,
> as is written in the Section 4.1 of the Reference manual. Thus as far
> as my knowledge goes, I think we can't tell by only looking into the
> final .msh file whether
> Case 1: the physical entity numbers are intentionally set to all 0 (by
>   such as "Physical Surface (0) = {...};"), or
> Case 2: no physical entity is defined from the first.

Hi - It's safe to assume that "Case 1" never happens (and even if it
does, the end result is the same as if no Physicals are defined).

So looking at physicals numbers in the .msh file and decising that there 
are no physicals if all the ids are 0 looks fine to me.


> And in Case 2 I'd like to assign elementary entity numbers instead of
> physical entity numbers. It's mainly for backward compatibility with
> Gmsh 1.x, because Gmsh 1.x assigned the elementary entity numbers as
> physical entity numbers in such a case (as also is written in the
> footnote of Section 4.1, p. 47), which is a different behavior than
> Gmsh2.
> So my proposal is to write an empty $PhysicalNames section in Case 1
> (which is supposed to mean "all the elements in this .msh file have
> intentionally assigned physical entity numbers, but no string labels")
> so that we can distinguish between Case 1 and 2.
> ... Do I miss some points? My sincere apologies to too detailed a
> discussion.
> Regards,
> OSHIMA Takuya
> _______________________________________________
> 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