pygmsh icon indicating copy to clipboard operation
pygmsh copied to clipboard

[Mixed-type mesh] make pygmsh optionally returns meshio object

Open BinWang0213 opened this issue 4 years ago • 2 comments

Hi,

I'm using pygmsh and native gmsh api to generate recombined hex-dominant mesh. I may have mixed-type element (say, Hex + Prism).

So this will trigger an error in extract_to_meshio(): https://github.com/nschloe/pygmsh/blob/b869ab37f348c30cc2b26c75bdf4cdded87574ae/pygmsh/helpers.py#L102

Could you make generate_mesh() optionally returns meshio object?

BinWang0213 avatar Mar 08 '21 20:03 BinWang0213

MWE please.

nschloe avatar Mar 09 '21 14:03 nschloe

Here you go test.zip

Info    : Reading 'sf.pos'...
Info    : Done reading 'sf.pos'
Traceback (most recent call last):
  File "test.py", line 53, in <module>
    mesh = geom.generate_mesh()
  File "D:\anaconda3\lib\site-packages\pygmsh\common\geometry.py", line 363, in generate_mesh
    return extract_to_meshio()
  File "D:\anaconda3\lib\site-packages\pygmsh\helpers.py", line 102, in extract_to_meshio
    assert len(elem_types) == 1
AssertionError

BinWang0213 avatar Mar 09 '21 23:03 BinWang0213