Small suggestion to improve GridIn::read_unv()

42 views
Skip to first unread message

vachanpo...@gmail.com

unread,
Sep 30, 2021, 8:02:32 AM9/30/21
to deal.II User Group
Dear all,

I found this thread which highlights one small issue in importing a unv file (generated by Salome): https://groups.google.com/g/dealii/c/iWnLv4v0V1M/m/38jm5Ck8WXYJ.

If I understand correctly, dealii expects the file to start with "-1" and then have the section "2411", instead of all the other stuff that Salome prints. This issue still persists in dealii-9.3.0 (and Salome 9.7).

Is there any specific reason why we simply can not ignore all the lines between "-1" and "2411"?

I am willing to submit a patch if the developers feel this not wrong and would be useful.

Thank you
Vachan

Wolfgang Bangerth

unread,
Sep 30, 2021, 8:27:41 AM9/30/21
to dea...@googlegroups.com
Yes, this makes sense. A patch would be welcome!

(Fundamentally, the reason why UNV is such a terrible file format is because
it is essentially a memory dump of a program built decades ago. It has a large
number of "sections" -- 2411 being one of them -- each of which one has to
understand because there are no begin- and end-markers for each section. You
can't just read the file until you find the number 2411: if you wanted to do
it right, you'd have to correctly read the previous section until it is over,
at which point you can inspect the next number and see whether it is 2411,
indicating the 2411 section. In practice, you are probably safe if you skip
forward to a place where a new -1 alone on one line is followed by 2411 alone
on one line, but while this works, this is not the *correct* way to read these
files. It really is a complete nightmare and my preference would be if that
file format was banned from existence by the QAnon high council. My second
choice would be if people/Salome exported meshes in other, better described
and easier to read formats.)

Best
W.


--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

vachan potluri

unread,
Oct 4, 2021, 5:33:34 AM10/4/21
to dea...@googlegroups.com
Yes, this makes sense. A patch would be welcome!
Please have a look at pr12787.

It really is a complete nightmare and my preference would be if that 
file format was banned from existence by the QAnon high council. My second 
choice would be if people/Salome exported meshes in other, better described 
and easier to read formats.
I hope they realise this and make necessary changes soon :). 

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/2ba62583-1f00-bdd4-d514-254a120f8c8b%40colostate.edu.
Reply all
Reply to author
Forward
0 new messages