[petsc-users] setting ghost padding region

Guido Giuntoli giuntoli1991 at gmail.com
Sun Oct 29 17:37:34 CDT 2017


very clear., thank you Barry.

2017-10-29 23:30 GMT+01:00 Smith, Barry F. <bsmith at mcs.anl.gov>:

>
> > On Oct 29, 2017, at 5:20 PM, Guido Giuntoli <giuntoli1991 at gmail.com>
> wrote:
> >
> > I have a ghost vector "b" and I want to work with my local
> representation adding values in my local part and my ghost padding region.
> Is this possible or I have to use VecSetValues ?
>
>    What do you really want to do?
>
>  put values into the local and ghosted part and then add up all the
> ghosted parts into the local parts or
>
>  put values into the local parts and then have the vector fill up the
> ghosted locations based on the local parts?
>
> >
> > VecGhostGetLocalForm( b , &b_loc );
>                                                   VecGetArray( b_loc,
> &b_arr );
> > ...
> > VecSetValues( b_loc, n , index, r_e, ADD_VALUES );
> > VecRestoreArray( b_loc, &b_arr ); // this communicate something in the
> ghost padding region ?
>
> No, restore array communicates nothing. And you don't mix
> VecGetArray()/RestoreArray() with VecSetValues(). You either call
> VecSetValues() and then VecAssemblyBegin/End() to put values into a vector
> OR you use VecGetArray() put the values into the array and then call
> VecRestoreArray()
> >
> > I tried to see the code of VecRestoreArray but does not seem to be
> communicating anything. I am seeing some routines and I think that adding
> >
> > VecGhostUpdateBegin(b, ADD_VALUES, SCATTER_REVERSE);
> > VecGhostUpdateEnd(b, ADD_VALUES, SCATTER_REVERSE);
> >
> > can do what I want, i.e. adding the ghost padding regions on all the
> processes that correspond.Is this true ? Thank you, Guido.
>
>    This will take the values you put into the ghost locations and add them
> up and put them into the appropriate global (non-ghost) locations.
>
>
>
>   Barry
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20171029/52c23374/attachment.html>


More information about the petsc-users mailing list