[Paraview] locale problem in ParaView compiled with Qt 4.5 (Re: Using real timesteps in pvd files)

Takuya OSHIMA oshima at eng.niigata-u.ac.jp
Mon Aug 17 00:27:51 EDT 2009


Hi,

Sorry about digging up a discussion held on as old as this February.

I've been also getting reports from the users of my reader, in which
strtod() is used as well, that the reader fails to work only when the
main ParaView application is compiled with Qt 4.5.x (the ParaView
versions include 3.6.1 and 3.7-cvs. I know that Qt 4.3 is the only
officially supported version for 3.6.1, but in reality many users try
to compile with Qt 4.5) and run under certain locales (de_DE, fr_FR,
etc) [1]. Besides, it is also reported that the problem always goes
away when I tell the users to run ParaView after setting LC_ALL=C.

After some digging around I found that this seems to come from a
behavior specific to Qt 4.5 [2]:

On Unix/Linux Qt is configured to use the system local settings by
default. This can cause a conflict when using POSIX functions, for
instance, when converting between data types such as floats and
strings, since the notation may differ between locales. To get around
this problem call the POSIX function setlocale(LC_NUMERIC,"C") right
after initializing QApplication or QCoreApplication to reset the
locale that is used for number formatting to "C"-locale.

which has not been in Qt 4.3/4.4 [3,4]. Hence, two possible solutions
that come to my mind are

1) Modify the reader to use the functions that are not affected by
locale settings, e.g. istream::operator<<(). Note that some readers
included in ParaView itself also has to be modified (e.g. the VRML
reader as reported in [1]) if this is the solution.

2) Ask the ParaView developers to modify ParaView as suggested by the
Qt 4.5 doc, at least for 3.7-cvs.

Do you have any ideas?

Thanks,
Takuya

[1] e.g. Comments #55-#72 in http://bugs.gentoo.org/243362
[2] http://doc.trolltech.com/4.5/qcoreapplication.html
[3] http://doc.trolltech.com/4.3/qcoreapplication.html
[4] http://doc.trolltech.com/4.4/qcoreapplication.html

Takuya OSHIMA, Ph.D.
Faculty of Engineering, Niigata University
8050 Ikarashi-Ninocho, Nishi-ku, Niigata, 950-2181, JAPAN

From: "Moreland, Kenneth" <kmorel at sandia.gov>
Subject: Re: [Paraview] Using real timesteps in pvd files
Date: Wed, 4 Feb 2009 15:56:22 -0700

> I would vote yes on that.  Although localization like this is good in a UI, it
> seems to be a pointless complicate to a data file in which people generally
> don’t look at the contents.
> 
> -Ken
> 
> On 2/4/09 3:48 PM, "Berk Geveci" <berk.geveci at kitware.com> wrote:
> 
>     Hmmm. Weird. We are using strtod to make the conversion from string to
>     double. That must somehow obey localization settings. Looking at here
>     http://www.mkssoftware.com/docs/man3/strtod.3.asp I see that we need
>     to somehow set the localization properly for the right radix. Should
>     we always set it to . ?
>    
>     -berk
> 
>     On Thu, Jan 29, 2009 at 7:21 AM, Christian Wellmann
>     <wellmann at ikm.uni-hannover.de> wrote:
>     > Hi all. As I now figured out, the problem with my real timestep values
>     > seems to be the decimal separator. Strangely my ParaView 3.4
>     > installation seems to require a comma as decimal separator. So
>     >
>     > <DataSet timestep="0,5e-5" group="0" part="0"
>     > file="hour_5121_fall_se0000000.vtp"/>
>     >
>     > is interpreted correctly and gives the time value 0.5e-5.
>     > The idea of using a comma as decimal separator came into my mind
>     > using the "Annotate Time" filter, which shows comma separated values
>     > in my installation.
>     >
>     >
>     > 2009/1/29 Christian Wellmann <wellmann at ikm.uni-hannover.de>:
>     >> Thanks Stephen and John for your quick answers.
>     >> Unfortunately any changes to the group and/or part tag not seem to
>     >> solve the problem.
>     >> What is strange is that, although ParaView seems to read an int value,
>     >> it is able
>     >> to handle
>     >>
>     >> <DataSet timestep="-922337203685477580825263735124730" group=""
>     >> part="0" file="sp_test0000000.vtp"/>
>     >> <DataSet timestep=" 922337203685477580825263735124730" group=""
>     >> part="0" file="sp_test0002498.vtp"/>
>     >>
>     >> correctly, what gives me
>     >>
>     >> Index      Value
>     >> 0            -9.22337e+32
>     >> 1             9.22337e+32
>     >>
>     >> in the time table although the values are out of range of any standard
>     >> integer representation I guess.
>     >> However, as a workaround -considering the large range of representable
>     >> integer values- I will simpliy
>     >> change my scale to micro- or even nano-seconds to get integer time
>     values.
>     >>
>     >>
>     >> 2009/1/29 John Biddiscombe <biddisco at cscs.ch>:
>     >>> Christian
>     >>>
>     >>> <?xml version="1.0"?>
>     >>> <VTKFile type="Collection" version="0.1" byte_order="LittleEndian">
>     >>>  <Collection>
>     >>>  <DataSet timestep="1.08267" file="1800_001-static-00000.vtmb"/>
>     >>>  <DataSet timestep="1.08367" file="1800_001-static-00001.vtmb"/>
>     >>>  <DataSet timestep="1.08467" file="1800_001-static-00002.vtmb"/>
>     >>> ...
>     >>>  <DataSet timestep="1.34967" file="1800_001-static-00267.vtmb"/>
>     >>>  </Collection>
>     >>> </VTKFile>
>     >>>
>     >>> This works for me. Can't comment on why you are having trouble, but
>     maybe
>     >>> try to remove the group, part unused tags.
>     >>>
>     >>> I use CVS paraview (3.4 should work)
>     >>>
>     >>> JB
>     >>>
>     >>>> Dear all,
>     >>>>
>     >>>> I'm using ParaView 3.4 to load the results of a transient simulation
>     >>>> via a pvd file and a set
>     >>>> of vtp XML PolyData files. Each vtp file corresponds to a particular
>     real
>     >>>> time
>     >>>> value which are not evenly spaced. I tried to provide the real time
>     >>>> values via the timestep key
>     >>>> in the pvd file:
>     >>>>
>     >>>> <?xml version="1.0"?>
>     >>>> <VTKFile type="Collection" version="0.1" byte_order="LittleEndian">
>     >>>> <Collection>
>     >>>> <DataSet timestep="1.23"  group="" part="0" file="sp_test0000000.vtp"
>     />
>     >>>> <DataSet timestep="2.34"  group="" part="0" file="sp_test0002498.vtp"
>     />
>     >>>> <DataSet timestep="3.15"  group="" part="0" file="sp_test0004496.vtp"
>     />
>     >>>> </Collection>
>     >>>> </VTKFile>
>     >>>>
>     >>>> It seems that ParaView expects integer values for the timestep key,
>     >>>> because
>     >>>> it loads the files like expected but the time table in the Object
>     >>>> Inspector -> Information
>     >>>> tab shows for the above pvd file:
>     >>>> Index   Value
>     >>>> 0         1
>     >>>> 1         2
>     >>>> 2         3
>     >>>>
>     >>>> I would be grateful for any help/suggestions.
>     >>>>
>     >>>> Thanks,
>     >>>> Christian Wellmann
>     >>>> _______________________________________________
>     >>>> ParaView mailing list
>     >>>> ParaView at paraview.org
>     >>>> http://www.paraview.org/mailman/listinfo/paraview
>     >>>>
>     >>>
>     >>>
>     >>> --
>     >>> John Biddiscombe,                            email:biddisco @ cscs.ch
>     >>> http://www.cscs.ch/
>     >>> CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
>     >>> Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82
>     >>>
>     >>>
>     >>>
>     >>
>     >
>     >
>     >
>     > --
>     > Christian Wellmann
>     > Institute of Continuum Mechanics
>     > Leibniz Universitaet Hannover
>     > Appelstr. 11
>     > 30167 Hannover, Germany
>     > phone: +49 511 762 2285
>     > fax: +49 511 762 5496
>     > email: wellmann at ikm.uni-hannover.de
>     > _______________________________________________
>     > ParaView mailing list
>     > ParaView at paraview.org
>     > http://www.paraview.org/mailman/listinfo/paraview
>     >
>     _______________________________________________
>     ParaView mailing list
>     ParaView at paraview.org
>     http://www.paraview.org/mailman/listinfo/paraview
> 
>    ****      Kenneth Moreland
>     ***      Sandia National Laboratories
> ***********  
> *** *** ***  email: kmorel at sandia.gov
> **  ***  **  phone: (505) 844-8919
>     ***      web:   http://www.cs.unm.edu/~kmorel
> 
> *
> 


More information about the ParaView mailing list