← Back to team overview

dolfin team mailing list archive

Re: Bug in XMLFile.cpp

 

Yes I read from the file I previously wrote like:

 File meshout("outmesh.xml");
 meshout << mesh;

 Mesh mesh2;
 File meshin("outmesh.xml");
 meshin >> mesh2;

I was just testing the io in one run, should be possible in principle, right. but not if the object has to be destroyed to write everything. A similar example of mesh io is in the user manual. but I know, it's always hard to keep up the documentation :-), but the mailing list is great, good response if one is developing something with dolfin.

Alex

Anders Logg wrote:

Yes of course, together with a thousand other things we also need to
document... :-)

How did you manage to not have the object destroyed? Are you reading
from the same file object that you previously wrote to, or opening the
same file twice, once for writing and then for reading, with the first
object still existing when the second is opened?

/Anders


On Fri, Feb 24, 2006 at 12:56:58PM +0000, Alexander Jarosch wrote:
Okay fine, thanks, maybe this should find it's way into the user manual of dolfin.

Alex

Johan Jansson wrote:

On Fri, Feb 24, 2006 at 12:28:13PM +0000, Alexander Jarosch wrote:


I just want to report a bug in XMLFile.cpp. no matter what type of data I write to a xml file, vector, matrix, Function, it will not close the file with the needed </dolfin>.

So upon readin of any xml file, mesh included, dolfin fails because it does not find the end of the file. I did not look deeply into that just made a quick hack so I can work. I added the writeFooter(); into each write out section, but now I get a double </dolfin> at the end.

Alex

Hi!

The footer is written in the destructor of XMLFile, so it should
always be written unless you manage to avoid destroying the file
object.

The reason the footer is not written out in each write operation is
that you might want to write several objects to the same file, a mesh
and a vector for example. Currently, the only way DOLFIN can tell that
a user has finished writing is at the destructor.

Johan


_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev






--
Alexander H. Jarosch

Jarðvísindastofnun Háskólans
Institute of Earth Sciences, University of Iceland
Náttúrufræðahús, Askja
Building of Natural Sciences, Askja
Sturlugata 7
IS - 101 Reykjavík
Iceland

Tel.: +354 525 4906
http://raunvis.hi.is/~jarosch/




Follow ups

References