mfem: Broken MFEM mesh format v1.1
In PETSc, me and @dalcinl have used MFEM v1.1 to visualize meshes for years.
Currently, MFEM master
will always force to use the NCMesh extension, see e.g. https://github.com/mfem/mfem/blob/master/mesh/mesh.cpp#L3472 even if the mesh is conforming. This is causing issues in parallel, see eg the valgrind stack trace of the glvis
command
==1990783== Invalid write of size 4
==1990783== at 0x55F316: mfem::NCMesh::LegacyToNewVertexOrdering(mfem::Array<int>&) const (/home/szampini/Devel/glvis-fork/mfem/mesh/ncmesh.cpp:5996)
==1990783== by 0x636CD5: mfem::GridFunction::LegacyNCReorder() (/home/szampini/Devel/glvis-fork/mfem/fem/gridfunc.cpp:3706)
==1990783== by 0x6374B7: mfem::GridFunction::GridFunction(mfem::Mesh*, std::istream&) (/home/szampini/Devel/glvis-fork/mfem/fem/gridfunc.cpp:70)
==1990783== by 0x52B9C6: mfem::Mesh::Loader(std::istream&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (/home/szampini/Devel/glvis-fork/mfem/mesh/mesh.cpp:3621)
==1990783== by 0x535B06: Load (/home/szampini/Devel/glvis-fork/mfem/mesh/mesh.hpp:737)
==1990783== by 0x535B06: mfem::Mesh::Mesh(std::istream&, int, int, bool) (/home/szampini/Devel/glvis-fork/mfem/mesh/mesh.cpp:3268)
==1990783== by 0x431865: ReadInputStreams(StreamState&) (/home/szampini/Devel/glvis-fork/glvis.cpp:1606)
==1990783== by 0x42D8CD: main (/home/szampini/Devel/glvis-fork/glvis.cpp:1289)
==1990783== Address 0x5c09440 is 0 bytes after a block of size 32 alloc'd
==1990783== at 0x483A582: operator new[](unsigned long) (/builddir/build/BUILD/valgrind-3.16.1/coregrind/m_replacemalloc/vg_replace_malloc.c:431)
==1990783== by 0x439697: New (/home/szampini/Devel/glvis-fork/mfem/mesh/../general/mem_manager.hpp:468)
==1990783== by 0x439697: New (/home/szampini/Devel/glvis-fork/./mfem/general/mem_manager.hpp:699)
==1990783== by 0x439697: Memory (/home/szampini/Devel/glvis-fork/mfem/linalg/../general/mem_manager.hpp:178)
==1990783== by 0x439697: mfem::Array<int>::GrowSize(int) (/home/szampini/Devel/glvis-fork/mfem/fem/../linalg/../general/array.hpp:648)
==1990783== by 0x55F3DE: SetSize (/home/szampini/Devel/glvis-fork/mfem/mesh/../general/array.hpp:669)
This is because RemoveUnusedVertices() is called. If we compile GLVis using MFEM v4.2, we are able to visualize all meshes (conforming or nonconforming) we want.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (13 by maintainers)
Here is another reproducer, using the mesh at
https://gitlab.com/petsc/petsc/-/blob/main/src/snes/tutorials/output/ex12_glvis_2d_hex_p0.out
(output from a PETSc DMPLEX). Using the current master in MFEM andexamples/ex1p
. (this issue is independent of the visualization, it is a Mesh loading issue in MFEM)With v1.1 as version
With v1.0 as version
Here you have a reproducer that emulates how PETSc and our solver interacts with GLVis. You need netcat to run it (
nc
command).Launch
glvis
in server mode (I’ll assumelocalhost:19916
)Execute the following two commands
Yes it most likely is caused by #1392, and I hope it can be fixed by adjusting the v1.1 compatibility code.