← Back to team overview

dolfin team mailing list archive

Re: GenericVector and PyDOLFIN

 

On Wednesday 19 August 2009 18:50:13 Garth N. Wells wrote:
> Johan Hake wrote:
> > On Wednesday 19 August 2009 17:29:52 Garth N. Wells wrote:
> >> What's going on behind the scene when I copy one vector to another in
> >> PyDOLFIN using
> >>
> >>      u0.vector()[:] = u.vector()[:]
> >
> > When I add:
> >
> > u2 = Function(V)
> > u2.vector()[:] = u.vector()[:]
> >
> > # Plot solution
> > plot(u2)
> >
> > In a the Poisson demo it works fine.
>
> In parallel?

Yupp!

> > This type of slice only uses the assignment operator.
>
> The GenericVector assignment operator?

Yes. This is done in __setslice__/__getslice__ in the extended python class.

> I delved into the problem and the program ends up in the function
> _compare_vector_with_vector from dolfin_la_get_set_items.i. It uses
> GenericVector::get and GenericVector::set. These need to be used with
> caution in parallel.

Yes, when other type of slices are used we need to find a way to do that in 
parallel. I have just started digging in the parallel code, and need to look 
into all the changes to get familiar with it before I try to solve this.

The best solution would be to have a full fledge VectotView in place ;)

Johan

> Garth
>
> Other slices might not
>
> > work. Have not checked.
> >
> > Johan
> >
> >> ? The issue is that it doesn't work in parallel.
> >>
> >> Garth
> >> _______________________________________________
> >> DOLFIN-dev mailing list
> >> DOLFIN-dev@xxxxxxxxxx
> >> http://www.fenics.org/mailman/listinfo/dolfin-dev


Follow ups

References