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

Blaise Bourdin bourdin at lsu.edu
Fri Jul 6 06:24:54 CDT 2012


On Jul 6, 2012, at 6:02 PM, TAY wee-beng wrote:

> 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?
Try to clone petsc-3.3  from the mercurial repository http://petsc.cs.iit.edu/petsc/releases/petsc-3.3/ It looks like the first patch has not made its way to the tarball or petsc-dev yet. 
You can also apply the patch manually: 
cd $PETSC_DIR
patch -p1 < DMDAVecGetArrayF90.patch

> 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?

I am sending another patch that should take care of the 3d case with >1 dof to the developers list.

Blaise

-- 
Department of Mathematics and Center for Computation & Technology
Louisiana State University, Baton Rouge, LA 70803, USA
Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 http://www.math.lsu.edu/~bourdin









More information about the petsc-users mailing list