← Back to team overview

dolfin team mailing list archive

Re: Vector type casting

 

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();

-- 
Martin


Follow ups

References