← Back to team overview

dolfin team mailing list archive

Re: SWIG and uBlas

 

On Mon, 2006-07-10 at 19:09 +0200, Johan Jansson wrote: 
> On Mon, Jul 10, 2006 at 02:26:19PM +0200, Garth N. Wells wrote:
> 
> > My first implementation of DenseMatrix worked something like this. I
> > changed it later because it didn't seem very elegant given that uBlas is
> > written in C++. Also, it's not possible to access member functions of
> > uBlasMatrixImplementation without a wrapper function or directly working
> > with the pointer to uBlasMatrixImplementation. 
> 
> Why is it a problem to work with the pointer? Isn't it a good idea to
> work with uBlasMatrix if you want to use the GenericMatrix interface,
> and to work with uBlasMatrixImplementation (or
> ublas_sparse_matrix/ublas_dense_matrix) if you want to use the uBlas
> interface?
> 

It might be  possible to first get the pointer to
uBlasMatrixImplementation before doing anything, but I prefer not to
(could be because I'm lazy). Besides my laziness, it might not be so
simple. If we use the same design as PETScSparseMatrix, I'm pretty sure
that it's not possible to have a pointer

    uBlasMatrixImplementation* mat;

if uBlasMatrixImplementation is templated. It needs to be

    uBlasMatrixImplementation<matrix_type>* mat;

How do we deal then with the different matrix_type.

Garth 

> > 
> > Would it help if rather than having 
> > 
> >    typedef uBlasMatrix<ublas_sparse_matrix> uBlasSparseMatrix;
> > 
> > we have 
> > 
> >    class  uBlasSparseMatrix : uBlasMatrix<ublas_sparse_matrix> {};?
> > 
> > Garth
> > 
> 
> This doesn't help unfortunately. uBlasMatrix<ublas_sparse_matrix> is
> not instantiable without knowing what ublas_sparse_matrix is. The
> result is that SWIG ignores it and uBlasSparseMatrix becomes empty.
> 
>   Johan



Follow ups

References