dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #08216
Re: Reading back matrix from xml file
> 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. 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 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.
/Dag
> --
> Anders
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev
>
Follow ups
References