dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #02910
Re: SWIG and uBlas
On Fri, Jul 14, 2006 at 08:45:13AM +0200, Garth N. Wells wrote:
> I understand from Johan that any templated class which takes a uBlas
> data type as a template argument will be a problem. What we could do, is
> rather than wrapping uBlas for SWIG, is wrap them for DOLFIN. At the
> moment, we use typedef's for various uBlas matrices. For the uBlas
> matrices that we use a template arguments (only two at this stage),
> rather having a typedef we could have
>
> class ublas_dense_matrix : public ublas::matrix<double> {};
> class ublas_sparse_matrix : public ublas::compressed_matrix<double> {};
>
> // sparse matrix
> uBlasMatrix<ublas_sparse_matrix> A;
>
> A disadvantage is that we don't have direct access to the uBlas
> constructors.
>
> Garth
>
Yes, this works for SWIG. I'm missing a constructor right now, but I
don't think it has anything to do with this.
But this can also be solved in SWIG. You can avoid including these
definitions in the interface, and define them just for SWIG in the
interface file:
namespace dolfin {
class ublas_dense_matrix {};
class ublas_sparse_matrix {};
}
(or some other names)
Since we're not interested in wrapping the uBlas interface, all SWIG
needs to know is that these are defined.
As we said, we shouldn't take SWIG into account when designing the
DOLFIN interface. So I think it's better if you just proceed and do
whatever you think is best, and then we'll see what parts we can wrap
and what parts we can or have to ignore.
Johan
References
-
Re: SWIG and uBlas
From: Anders Logg, 2006-07-10
-
Re: SWIG and uBlas
From: Garth N. Wells, 2006-07-10
-
Re: SWIG and uBlas
From: Anders Logg, 2006-07-12
-
Re: SWIG and uBlas
From: Garth N. Wells, 2006-07-13
-
Re: SWIG and uBlas
From: Johan Jansson, 2006-07-13
-
Re: SWIG and uBlas
From: Anders Logg, 2006-07-13
-
Re: SWIG and uBlas
From: Johan Jansson, 2006-07-13
-
Re: SWIG and uBlas
From: Garth N. Wells, 2006-07-13
-
Re: SWIG and uBlas
From: Anders Logg, 2006-07-13
-
Re: SWIG and uBlas
From: Garth N. Wells, 2006-07-14