[petsc-users] [petsc-dev] Getting 2d array with updated ghost values from DM global vector

Satish Balay balay at mcs.anl.gov
Tue Jul 3 13:23:28 CDT 2012


On Tue, 3 Jul 2012, Barry Smith wrote:

> 
> On Jul 3, 2012, at 3:08 AM, Blaise Bourdin wrote:
> 
> > 
> > On Jul 3, 2012, at 4:10 AM, Barry Smith wrote:
> > 
> >> 
> >> Blaise,
> >> 
> >>  I don't understand why the patch does anything:
> >> 
> >> -  *ierr = VecRestoreArray(*v,0);if (*ierr) return;
> >> +  PetscScalar *fa;
> >> +  *ierr = F90Array1dAccess(a,PETSC_SCALAR,(void**)&fa PETSC_F90_2PTR_PARAM(ptrd));
> >> +  *ierr = VecRestoreArray(*v,&fa);if (*ierr) return;
> >> *ierr = F90Array1dDestroy(&a,PETSC_SCALAR PETSC_F90_2PTR_PARAM(ptrd));
> >> 
> >> All that passing &fa into VecRestoreArray() does is cause fa to be zeroed. Why would that have any affect on anything?
> > 
> > 
> > Not sure either, I quite don't understand this code, but I noticed that the logic of VecRestoreArrayF90 was different from that of DMDAVecRestoreArrayF90
> > 
> > src/vec/vec/interface/f90-custom/zvectorf90.c:33
> > PetscScalar *fa;
> > *__ierr = F90Array1dAccess(ptr,PETSC_SCALAR,(void**)&fa PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;
> > *__ierr = F90Array1dDestroy(ptr,PETSC_SCALAR PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;
> 
>      It could be the above line is important; but the Accesser and restore array are not.
> 
>      I'll have Satish apply the patch.

pushed to petsc-3.3 [petsc-dev will get this update]

Satish


More information about the petsc-users mailing list