Page 1 of 1

"." vs. "," in UNV files

Posted: 15 Jun 2010, 19:13
by petroo
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

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

Posted: 15 Jun 2010, 21:17
by Koske
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

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

Posted: 15 Jun 2010, 22:12
by petroo
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

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

Posted: 22 Jun 2010, 21:34
by raback
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