← Back to team overview

dolfin team mailing list archive

Re: Vector type casting

 



Martin Sandve Alnæs wrote:
2008/4/12, Garth N. Wells <gnw20@xxxxxxxxx>:

 Martin Sandve Alnæs wrote:

Circular dependencies... But we could put templated functions in Generic*.

F.ex.:
Foo & v = vector_cast<Foo>(genericvector);

Templates must be renamed in the python interface though.


 I've added template functions to GenericTensor. Take a look.

 Garth


Looks good, but I'm not sure about all details around templated member
functions. But I think they should return references. Then we'll have:

uBlasVector & v = gv.down_cast<uBlasVector>();
ublas_vector & u = gv.down_cast<uBlasVector>()->vec();


References would be nicer to work with, so that's fine by me.

Garth


Follow ups

References