[Gmsh] Can GMSH return element type list

Martin Vymazal martin.vymazal at vki.ac.be
Wed Sep 24 13:32:39 CEST 2014


Hi Aleksejs,

 I don't think that GMSH has currently an option/command line switch to do 
that, but I suppose its data structures must contain this information.

 I'm writing mainly to join your question (or request): it would be nice if 
the native file format of GMSH had a section which would list all present 
element types (including their polynomial order, i.e. P1 triangles and P2 
triangles would be considered as different element types) AND how many 
elements of each type are present. I am also forced to parse the file twice 
and do a lot of counting to know how much memory I need to allocate.

Aleksejs, there's a poor man's workaround possible: each section with 
unrecognized header in the *.msh file is ignored (see paragraph 9.2 in the 
reference manual), so you could create a section $ElementTypes or similar and 
fill it with all extra info you need. For that, you can have a one-purpose 
script that will enhance existing gmsh files.

Best regards,

  Martin Vymazal

On Wednesday 24 of September 2014 11:33:32 Aleksejs Fomins wrote:
> Dear GMSH,
> 
> I was wondering if it is possible, when saving a .msh file with GMSH, to
> output the total number of elements of each type. I can of course
> calculate it myself when reading the file, but it takes extra time for
> larger meshes. In particular, if I want to read the file in parallel, I
> need to know these numbers so that I can choose a priori which elements
> belong on this process and which do not. At the moment, I have to read
> the file twice - first time to find out the total number of elements of
> each type, and second time, to actually read the elements.
> 
> Do you think this is possible?
> 
> Regards,
> Aleksejs
> 
> P.S. So far you have not replied to about 3 of my messages! I feel sad