← Back to team overview

dolfin team mailing list archive

Re: uBlasFactory

 



Martin Sandve Alnæs wrote:
2008/5/18 Garth N. Wells <gnw20@xxxxxxxxx>:
Anders Logg wrote:
On Sun, May 18, 2008 at 12:42:21PM +0100, Garth N. Wells wrote:
Anders Logg wrote:
On Sun, May 18, 2008 at 12:09:04PM +0100, Garth N. Wells wrote:
The uBlasFactory class doesn't look right to me. It appears to be tied
to ublas_sparse_matrix, whereas uBlasMatrix allows the user to choose
the matrix type. Is there a way around this?

Garth
Looks like we just need to template the factory and make some minor
changes in uBlasMatrix.cpp?

Yes, but it has some knock-on effects on some other classes which I
don't yet fully understand, e.g. uBlasFactory.

Garth
Another option would be to have two different uBlas factories, one for
each matrix type.

Doesn't that defeat the purpose of uBlasMatrix being a templated class?

I'll take a look at what to do with templates, but if someone more
expert in the factory classes can fix it, all the better.

Garth

This is the classical conflict between static typing/generic
programming/templates
on one side and dynamic typing/OOP/abstract interfaces on the other.
I see basically two options:
- Add more than one variant of uBlasFactory (one for each set of
template options)
- Add run-time options to uBlasFactory somehow to switch between
  a set of predefined instantiated templates.

The other backends also have different matrix formats,
so a simple and general solution is probably difficult.


I think that this has been resolved.

Garth

--
Martin



References