[petsc-users] (no subject)

Barry Smith bsmith at mcs.anl.gov
Thu Dec 27 10:40:44 CST 2012


On Dec 27, 2012, at 10:34 AM, amlan barua <abarua at iit.edu> wrote:

> I think I can use VecSetValues, is that right?

   Yes you could do that. But since you are using a DMDA you could also use DMGetLocalVector(), DMGlobalToLocalBegin/End() followed by DMDAVecGetArray() to access the ghost values. 

   Barry

> Amlan
> 
> 
> On Thu, Dec 27, 2012 at 9:04 AM, amlan barua <abarua at iit.edu> wrote:
> Hi Barry,
> Is this scattering a very costly operation? I have to compute x[i] = f(x[i-1]) where f is known. Since this operation is strictly sequential, I thought of gathering the entire vector on processor 0, do the sequential operation there and scatter the result back. However this is unnecessary because I only need the bordering x[i] values. What can be a better way?
> Amlan
> 
> 
> On Thu, Dec 27, 2012 at 8:18 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> 
>   ierr = DMDACreateNaturalVector(da,&natural);CHKERRQ(ierr);
>     ierr = DMDAGlobalToNaturalBegin(da,xin,INSERT_VALUES,natural);CHKERRQ(ierr);
>     ierr = DMDAGlobalToNaturalEnd(da,xin,INSERT_VALUES,natural);CHKERRQ(ierr);
> 
> Now do VecScatterCreateToZero() from natural and the vector will be in the natural ordering on process zero with the dof interlaced.
> 
> 
>    Barry
> 
> On Dec 27, 2012, at 12:22 AM, amlan barua <abarua at iit.edu> wrote:
> 
> > Hi,
> > Is there an analogue of VecScatterCreateToZero for DA vectors? The DMDA object has more than one degrees of freedom.
> > If there isn't any, should I use an IS object to do the scattering?
> > Amlan
> 
> 
> 



More information about the petsc-users mailing list