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

OSHIMA Takuya oshima at eng.niigata-u.ac.jp
Thu Feb 22 04:14:52 CET 2007

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.

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

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