← Back to team overview

dolfin team mailing list archive

Re: Bug in XMLFile.cpp

 

Should be fixed now.

/Anders

On Fri, Feb 24, 2006 at 08:33:56AM -0600, Anders Logg wrote:
> Thanks. Maybe we can fix this in the same way as Garth has done with
> the VTK format and make sure that a file is always complete after each
> write. This is also good if you are running a long computation and
> want to monitor the output and perhaps kill the process but still be
> able to use the data generated so far.
> 
> We have the same thing in the OpenDX format, but Garth's solution for
> the VTK format is nicer: remember the position from before the footer
> from the previous write and start from there at the next write.
> 
> Does anyone have time to fix? Otherwise I will take a look later.
> 
> /Anders
> 
> 
> On Fri, Feb 24, 2006 at 02:29:43PM +0000, Alexander Jarosch wrote:
> > 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
> > >>>
> > >>>
> > >>>
> > >>>     
> > >>>
> > >>   
> > >>
> > >
> > > 
> > >
> > 
> > 
> 

-- 
Anders Logg
Research Assistant Professor
Toyota Technological Institute at Chicago
http://www.tti-c.org/logg/



References