Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] converting a med file to gmsh 4.1 fails #1484

Open
martin-bernhard opened this issue Jul 25, 2024 · 0 comments
Open

[BUG] converting a med file to gmsh 4.1 fails #1484

martin-bernhard opened this issue Jul 25, 2024 · 0 comments

Comments

@martin-bernhard
Copy link

Description
We are using meshio inside SALOME and I want to convert a mesh in MED format to MSH format.
When trying to write to gmsh v4.1, it fails with the following error:

bernhard@debian11:/hdd2/S2/SALOME-MBS-DB11$ meshio convert -o gmsh ~/Shared/med/Cube.med ~/Shared/med/Cube.msh
Traceback (most recent call last):
  File "/hdd2/S2/SALOME-MBS-DB11/INSTALL/meshio/lib/python3.9/site-packages/bin/meshio", line 8, in <module>
    sys.exit(main())
  File "/hdd2/S2/SALOME-MBS-DB11/INSTALL/meshio/lib/python3.9/site-packages/meshio/_cli/_main.py", line 52, in main
    return args.func(args)
  File "/hdd2/S2/SALOME-MBS-DB11/INSTALL/meshio/lib/python3.9/site-packages/meshio/_cli/_convert.py", line 75, in convert
    write(args.outfile, mesh, **kwargs)
  File "/hdd2/S2/SALOME-MBS-DB11/INSTALL/meshio/lib/python3.9/site-packages/meshio/_helpers.py", line 188, in write
    return writer(filename, mesh, **kwargs)
  File "/hdd2/S2/SALOME-MBS-DB11/INSTALL/meshio/lib/python3.9/site-packages/meshio/gmsh/main.py", line 111, in <lambda>
    "gmsh": lambda f, m, **kwargs: write(f, m, "4.1", **kwargs),
  File "/hdd2/S2/SALOME-MBS-DB11/INSTALL/meshio/lib/python3.9/site-packages/meshio/gmsh/main.py", line 102, in write
    writer.write(filename, mesh, binary=binary, float_fmt=float_fmt)
  File "/hdd2/S2/SALOME-MBS-DB11/INSTALL/meshio/lib/python3.9/site-packages/meshio/gmsh/_gmsh41.py", line 332, in write
    _write_nodes(fh, mesh.points, mesh.cells, mesh.point_data, float_fmt, binary)
  File "/hdd2/S2/SALOME-MBS-DB11/INSTALL/meshio/lib/python3.9/site-packages/meshio/gmsh/_gmsh41.py", line 584, in _write_nodes
    raise WriteError(
meshio._exceptions.WriteError: Specify entity information (gmsh:dim_tags in point_data) to deal with more than one cell type. 

But there is no problem to write the same MED file to gmsh v2.2 or gmsh v4.0!

Is it possible to register explicitly the output format v4.0 in the .../meshio/gmsh/main.py file like shown below?
This would overcome the problem with the v4.1 format!

register_format(
    "gmsh",
    [".msh"],
    read,
    {
        "gmsh22": lambda f, m, **kwargs: write(f, m, "2.2", **kwargs),
        "gmsh40": lambda f, m, **kwargs: write(f, m, "4.0", **kwargs),
        "gmsh": lambda f, m, **kwargs: write(f, m, "4.1", **kwargs),
    },
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant