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

OSHIMA Takuya oshima at eng.niigata-u.ac.jp
Wed Feb 21 01:42:19 CET 2007


Dear Gmsh authors,

Assigning string labels to physical entities in Gmsh 2.0 is so nice a
feature that I've been writing a .msh-2.0 format to OpenFOAM converter
that exploits the feature. In the converter I'd like to assign patch
names or volume names according to elementary entity numbers if
there's no physical entities defined in a .msh file. I realized,
however, that there's no way to tell whether the .msh file containes

* no physical entities defined at all, or
* only physical entities that are labeled by numbers.

On the contrary, things are all fine if there's at least one physical
entity labeled by a string because we can clearly tell it by the
presence of $PhysicalNames-$EndPhysicalNames section.

So my suggestion is modifying Gmsh to write an empty $PhysicalNames
section such as

$PhysicalNames
0
$EndPhysicalNames

if the mesh contains only physical entities that are labeled by
numbers. Thus we can clearly tell that the mesh contains only physical
entities that are labeled by numbers.

Or is there a better way?

Thanks in advance,
Takuya OSHIMA
oshima at eng.niigata-u.ac.jp