dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #08217
Re: Reading back matrix from xml file
On Sun, Jun 15, 2008 at 05:26:01PM +0200, Dag Lindbo wrote:
> > On Sat, Jun 14, 2008 at 04:08:24PM +0200, Dag Lindbo wrote:
> >> Hello!
> >>
> >> This should work, right?
> >>
> >> #include <dolfin.h>
> >> using namespace dolfin;
> >>
> >> int main(void)
> >> {
> >> File file("matrix.xml");
> >> Matrix A;
> >> file >> A;
> >>
> >> cout << "size: " << A.size(0) << "-by-" << A.size(1) << endl;
> >> }
> >>
> >> This results in a zero-by-zero matrix A. Any ideas what's going on? Has
> >> this functionality been tested since the LA redesign? I would appreciate
> >> if someone could grab the matrix from
> >> http://www.csc.kth.se/~dag/dolfin/matrix.xml and confirm.
> >>
> >> /Dag
> >
> > Well, the following piece of code from XMLMatrix.cpp should give you a
> > hint:
> >
> > // FIXME: update to new format
> > error("This function needs to be updated to the new format.");
> >
> > /*
> > // Set default values
> > row = 0;
> > int size = 0;
> >
> > // Parse values
> > parseIntegerRequired(name, attrs, "row", row);
> > parseIntegerRequired(name, attrs, "size", size);
> >
> > // Set values
> > A.initrow(row, size);
> > */
> >
> > :-)
> >
> > Anyway, it should be fixed now so try again.
> >
>
> Yeah... the runtime error was never thrown which made me think it was
> getting lost in the Generic* abstraction.
The runtime error did not show up since there was another bug in the
XML reader. It was looking for "sparsematrix" rather than "matrix" so
it simply ignored all data in your file.
> Anyway, now the program aborts
> with a runtime error (which is better):
>
> at /usr/local/include/dolfin/la/uBlasMatrix.h:243
> 243 error("Not implemented.");
> (gdb) up
> #10 0xb7dc1afa in dolfin::XMLMatrix::setRow (this=0x805fec0)
> at dolfin/io/XMLMatrix.cpp:121
> 121 A.setrow(row, columns, values);
I only tested it for PETSc so I missed this.
> I can take a look at the uBlas interface and see if I can add this
> setrow() funcitonality. uBlas may (or not) provide a nice mechanism for
> this operation.
There might be something you can use. Otherwise, just set the values
explicitly.
--
Anders
Attachment:
signature.asc
Description: Digital signature
Follow ups
References