← Back to team overview

dolfin team mailing list archive

Re: Bug in XMLFile.cpp

 

I don't think that we should write the XML footer in the destructor. I
started to move the writing of the footer for VTK XML file to the
destructor, but went back to the old way because if the user kills a
program with ctr-c, they are not left with valid XML files. In the VTK
format, the footer is written, and when adding to the file the write
process is backed up two lines to write over the top of the old footer.

Garth



On Fri, 2006-02-24 at 07:58 -0600, 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
> > >
> > > 
> > >
> > 
> > 
> 
-- 
Dr. Garth N. Wells
Faculty of Civil Engineering and Geosciences
Delft University of Technology
Stevinweg 1
2628 CN Delft
The Netherlands

tel.     +31 15 278 7922
fax.     +31 15 278 6383
e-mail   g.n.wells@xxxxxxxxxx
url      http://www.mechanics.citg.tudelft.nl/~garth




References