← Back to team overview

dolfin team mailing list archive

Re: [HG DOLFIN] merge

 

On Sun, Apr 13, 2008 at 04:53:53PM +0200, DOLFIN wrote:

> changeset:   3984:bdb5a0987ef166d0775f5dec72cf331597faf61c
> user:        "Martin Sandve Alnæs <martinal@xxxxxxxxx>"
> date:        Sun Apr 13 16:29:10 2008 +0200
> files:       dolfin/swig/dolfin_la_post.i
> description:
> Added python wrapper for down_cast.
> Usage:
> 
> u = Vector()
> v = down_cast(u, PETScVector)
> 
> is the same as
> 
> Vector u;
> PETScVector & v = u.down_cast<PETScVector>();
> 
> If people are happy with this, we can remove the
> "as_foo" functions I added earlier.

Looks good to me.

-- 
Anders


> The implementation uses a small python dict to map the
> class argument to a helper function that calls
> the right instantiation of the template member
> function GenericTensor::down_cast<T>().
> 
> 
> changeset:   3983:be36cdd9b6787ea9e6f5b63d97ac6a32420b3b57
> parent:      3981:dab0e9f4cb27208e5947210dd9cefcc880f7e2a7
> user:        "Martin Sandve Alnæs <martinal@xxxxxxxxx>"
> date:        Sat Apr 12 16:48:26 2008 +0200
> files:       dolfin/la/GenericMatrix.h dolfin/la/GenericTensor.h dolfin/la/GenericVector.h dolfin/la/Matrix.h dolfin/la/PETScVector.h dolfin/la/uBlasVector.h
> description:
> Added instance() to GenericTensor so it can be used by down_cast<T>().
> Changed down_cast to return a reference instead of pointer.
> Cleaned up instance() implementations (all return GenericFoo* now).
> 
> ----------------------------------------------------------------------
> For more details, visit http://www.fenics.org/hg/dolfin

> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev



References