libMesh / libmesh

libMesh github repository
http://libmesh.github.io
GNU Lesser General Public License v2.1
654 stars 287 forks source link

XDR supports gaps in Node numbering but not Elem numbering #2924

Open jwpeterson opened 3 years ago

jwpeterson commented 3 years ago

There does not seem to be a fundamental reason why we couldn't support having gaps in Elem numbering in a manner similar to the way gaps in Node numbering is supported (by writing NaNs) it just isn't implemented currently.

cc: @roystgnr

jwpeterson commented 3 years ago

Oh, and by "doesn't support" I just mean that if you write out a Mesh with Node and Elem numbering gaps to XDR and then immediately read it back in, it will "work" (won't crash) but the Elem numbering (only) will now be contiguous while the Node numbering will still be consistent with the original.

jwpeterson commented 3 years ago

I just ran into (and re-discovered) this issue again today, exactly three months to the day from creating it in the first place. In discussing with @roystgnr, he came up with an idea for writing "missing" Elems (due to non-contiguous numbering) as NodeElems with xdr_id_type(-1) for the corresponding node id. That way, we could read in and ignore these Elems without changing the XDR file format, so that seems like a good approach to me.

jwpeterson commented 3 years ago

This Exodus file has a non-contiguous node and Elem numbering, and can be used for testing. Note that the Exodus reader preserves non-contiguous Node and Elem numberings during reads, but during writes it forces renumbering regardless of the Mesh's allow_renumbering() status.