dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #01222
Re: io interface for MatrixMarket
On Mon, Oct 17, 2005 at 04:47:13PM +0200, hetzel.devel@xxxxxx wrote:
>
> Hi, I'm currently implementing some stuff with dolfin and so I
> rewrote the C-interface to read and write my MatrixMarket
> matrices(http://math.nist.gov/MatrixMarket/) for dolfin. The
> interface is quite simple and does not support the whole
> functionality of the MatrixMarket syntax, but I think this would be
> a good think to incorporate to dolfin. So my question is: How can I
> help? Who is responsible for the io-stuff?
>
> /Haiko
It would be good with support for the MatrixMarket format in DOLFIN.
I suggest you look at the files in the directory src/kernel/io. You
need to write a new class MTXFile as a subclass of GenericFile and
modify the class File so that files with extension .mtx or .mtx.gz are
coupled to the MTX format. Then matrices (and vectors?) can be written
to file in MatrixMarket format as follows:
Matrix A;
...
File file("matrix.mtx");
file << A;
and read from file as follows:
Matrix A;
File file("matrix.mtx");
file >> A;
We could add a new constructor to Matrix that allows us to do
Matrix A("matrix.mtx");
and the implementation would just be
File file(filename);
file >> *this;
You will probably need to make MTXFile a friend of Matrix so you can
modify the matrix from within MTXFile at read.
/Anders
References