[petsc-users] Is there easy to update the ghost value in the vector created using DMCreatLocalVector?
leejearl
leejearl at mail.nwpu.edu.cn
Wed Jan 16 07:52:33 CST 2019
Hi Matt, Thanks for you reply. If I use DMGlobalToLocal() to
update the local vector from global vector.The value of
cStart<=c<cEndinterior is ok. But the value of cEndInterior<=c<cEnd is
not the right value. I do not know whether it has something to do
with the DMGlobalToLocal(). My problem is as follow.After the mesh is
distributed , the cells and ghost cells (local vector) look like
processor 0: 0, 1, 2, 3, 4 (cell 4 is the ghost cell)processor 1: 0, 1,
2, 3, 4 (cell 4 is the ghost cell)
The value of cell 4 in "processor 0" is same as the value of cell 0 in
"processor 1". The value of cell 0 in "processor 1" hasbeen set in the
global vector. I should copy the corresponding global value of cell 0
in "processor 1" to cell 4 in "processor 0".
This is my problem. I want to know how to implement it easily. Can you
give me some advices?
Thanks
leejearl
On Wed, 2019-01-16 at 08:07 -0500, Matthew Knepley wrote:
> On Tue, Jan 15, 2019 at 8:34 PM leejearl via petsc-users <
> petsc-users at mcs.anl.gov> wrote:
> > Hi all Petscer,
> >
> >
> >
> > I have a question about how to update the ghost value in the
> > vector.
> >
> > The prolblem is as follow.
> >
> >
> >
> > 1. A dmplex dm object is created using DMPlexCreateFromFile
> >
> > 2. The dm is distributed using DMPlexDistribute, and the overlap is
> > set
> >
> > as 1.
> >
> > 3. The ghosted dm is constructed by DMConstructGhostCells.
> >
> > 4. A global Vector X and a local vector localX are created by
> >
> > DMCreateGlobalVector and DMCreateLocalVector
> >
> >
> >
> > Now, the problem is that the ghost value are needed in the
> > computation
> >
> > using local vector localX. and the ghost value must be update from
> > the
> >
> > global vector.
> >
> >
> >
> > For example, gCellId is the index of ghost cell in the local vector
> >
> > localX of process 0, and cellId is the index of cell in the global
> >
> > vector of process 1. I must update the data of cellId to gCellId.
> > How
> >
> > can I do it easily?
> >
> >
> >
> > I can implement it use the PetscSFBcastBegin/PetscSFBcastEnd. Is
> > there
> >
> > other simple way to do it?
>
> Doesn't DMGlobalToLocal() work?
> Thanks,
> Matt
> > Any helps are appreciated.
> >
> >
> >
> > Thanks.
> >
> >
> >
> >
> >
> >
> >
> > leejearl
> >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190116/fd4cc9e4/attachment.html>
More information about the petsc-users
mailing list