On Mon, Sep 12, 2011 at 03:04:19PM +0100, Garth N. Wells wrote: > On 12 September 2011 13:42, Anders Logg <[email protected]> wrote: > > Why 20? Any perhaps this should be made into a global parameter value? > > > > That's just a left over debugging line. I've removed it now.
I see that now. -- Anders > Garth > > > > > > > ---------- Forwarded message ---------- > > From: [email protected] > > To: Anders Logg <[email protected]> > > Date: Mon, 12 Sep 2011 12:07:16 -0000 > > Subject: [Branch ~dolfin-core/dolfin/main] Rev 6178: Fix problem with > > pugixml reducing precision of doubles. > > ------------------------------------------------------------ > > revno: 6178 > > committer: Garth N. Wells <[email protected]> > > branch nick: dolfin-all > > timestamp: Mon 2011-09-12 12:52:42 +0100 > > message: > > Fix problem with pugixml reducing precision of doubles. > > > > Solution is to cast double to a string before passing to pugixml, thereby > > avoiding a cast inside pugixml. > > modified: > > dolfin/io/XMLArray.h > > > > > > > > Your team DOLFIN Core Team is subscribed to branch lp:dolfin. > > To unsubscribe from this branch go to > > https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscription > > > > === modified file 'dolfin/io/XMLArray.h' > > --- dolfin/io/XMLArray.h 2011-07-02 14:50:50 +0000 > > +++ dolfin/io/XMLArray.h 2011-09-12 11:52:42 +0000 > > @@ -23,6 +23,7 @@ > > > > #include <ostream> > > #include <string> > > +#include <boost/lexical_cast.hpp> > > #include "dolfin/common/Array.h" > > #include "dolfin/log/log.h" > > #include "pugixml.hpp" > > @@ -90,12 +91,16 @@ > > array_node.append_attribute("type") = type.c_str(); > > array_node.append_attribute("size") = size; > > > > + std::cout << std::setprecision(20); > > + > > // Add data > > for (uint i = 0; i < size; ++i) > > { > > pugi::xml_node element_node = array_node.append_child("element"); > > element_node.append_attribute("index") = i; > > - element_node.append_attribute("value") = x[i]; > > + // NOTE: Casting to a string to avoid loss of precision when > > + // pugixml performs double-to-char conversion > > + element_node.append_attribute("value") = > > boost::lexical_cast<std::string>(x[i]).c_str(); > > } > > } > > > > //----------------------------------------------------------------------------- > > > > > > _______________________________________________ > > Mailing list: https://launchpad.net/~dolfin > > Post to : [email protected] > > Unsubscribe : https://launchpad.net/~dolfin > > More help : https://help.launchpad.net/ListHelp > > > > _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : [email protected] Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp

