← Back to team overview

dolfin team mailing list archive

Re: pydolfin and DefaultVector

 

2008/3/10, Anders Logg <logg@xxxxxxxxx>:
> On Mon, Mar 10, 2008 at 02:37:15PM +0100, Ola Skavhaug wrote:
>  > Hi,
>  >
>  > it seems like we have some trouble when Vector::vec() returns a DefaultVector
>  > in the Python interface to DOLFIN. By some reason, swig doesn't see that the
>  > DefaultVector is simply either a PETScVector or a uBlasVector. Hence, the
>  > returned vector is not usable from PyDOLFIN.
>  >
>  > Does anyone have a solution to this? I have tried to use typedefs to get
>  > around, but no luck so far.
>  >
>  > Ola
>
>
> In my experience, typedefs don't seem to work very well with SWIG (see
>  for example dolfin_la_post.i).
>
>  Does it help if we write
>
>  #ifdef HAS_PETSC
>     inline const PETScVector& vec() const
>     { return vector; }
>  #else
>     inline const uBlasVector& vec() const
>     { return vector; }
>  #endif
>
>  instead of
>
>     inline const DefaultVector& vec() const
>     { return vector; }
>
>  ?
>
>  --
>
> Anders

Is it #typedef you have problems with? Maybe %typedef helps.

-- 
Martin


References