"." vs. "," in UNV files

Mesh generators, CAD programs, and other tools
Post Reply
petroo
Posts: 148
Joined: 13 Jan 2010, 19:07
Location: Aachen, Germany

"." vs. "," in UNV files

Post by petroo » 15 Jun 2010, 19:13

Hello @all,

when I read a Salomé generated UNV file into Elmer the displayed geometry is completely broken. This can be overcome by first changing all decimal points against decimal commas (as is the usual way of writing in Germany at least).

So Elmer on my Ubuntu 10.4 box, set for a German locale for obvious reasons, wants decimal commas in the UNV file whereas Salomé writes the international dotted decimals. Is there a way to tell Elmer to expect the usual dots again?

Kind regards,

Peter

Koske
Posts: 39
Joined: 15 Nov 2009, 17:02

Re: "." vs. "," in UNV files

Post by Koske » 15 Jun 2010, 21:17

hi,

my salome creates also dots in the files and everything is fine.
you cannot load the unv file directly into elmer. you have to use --> ElmerGrid 8 2 yourfile.unv -autoclean in console.
this command creates the .mesh files which can be loaded into ElmerGui via load mesh.

regards
martin

petroo
Posts: 148
Joined: 13 Jan 2010, 19:07
Location: Aachen, Germany

Re: "." vs. "," in UNV files

Post by petroo » 15 Jun 2010, 22:12

Hello Martin,
Koske wrote:you cannot load the unv file directly into elmer.
Yes, you can. I did it frequently already, apart from this dreaded ./, problem. If I do the sed conversion in between, i.e.

Code: Select all

sed "s/\./,/g" <Salome.unv >Elmer.unv
everything works fine. I assume ElmerGUI doing the ElmerGrid conversion automagically - and I seem to remember that I read it somewhere in the manuals - if it deems appropriate. ElmerGUI does it also on the Salomé files, but those are broken upon loading, as described.

Therefore my question posed!

Regards,

Peter

raback
Site Admin
Posts: 3305
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: "." vs. "," in UNV files

Post by raback » 22 Jun 2010, 21:34

Hi, I looked at this problem and the reason seems to be the use of "strtod" function to convert strings to doubles. This depends on the locale. The remedy would be to use locale-independent strtod function. In fact I found one also under GPL and will perhaps plug it in in near future. Thanx for reporting!

In the meantime perhaps you could try something like

Code: Select all

setenv LC_NUMERIC en_US
before running ElmerGrid. I guess when you now say locale you get LC_NUMERIC="de_DE..." which is the cause of the problems.

-Peter

Post Reply