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

TAY wee-beng zonexo at gmail.com
Fri Jul 6 09:02:58 CDT 2012


On 3/7/2012 1:23 PM, Satish Balay wrote:
> 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
Hi,

I just tested with the latest petsc-dev but it doesn't work in intel 
linux for ex11f90. Has the patch been applied? Also, is there any chance 
of it working under 3d with multiple dof since that's what I'm using and 
I have other problems with gfortran. Lastly, if the patch is applied, it 
works with 3d da with 1 dof? Is that right?



More information about the petsc-users mailing list