[petsc-users] array still valid after DMDAVecRestoreArrayF90()?

Panruo Wu pwu at mymail.mines.edu
Mon Jul 16 20:15:48 CDT 2012


How about in the inner block use a different array name
like array2?

Panruo Wu

On Sun, Jul 15, 2012 at 10:39 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> On Sun, Jul 15, 2012 at 11:20 PM, Panruo Wu <pwu at mymail.mines.edu> wrote:
>
>> Hello,
>>
>> For some reason, it would be convenient for me to do something
>> like
>>
>> call DMDAVecGetArrayF90(da, global, array, ierr)
>>
>> call DMDAVecGetArrayF90(da, global, array, ierr)
>> ! read-only access to array here.
>> call DMDAVecRestoreArrayF90(da, global, array,ierr)
>> ! read&write access to array here.
>> call DMDAVecRestoreArrayF90(da, global, array, ierr)
>>
>
> No, it is not okay to lie about the array status.
>
>
>>
>> Will this piece of code do what I expect?  I wrote a simply
>> program which gave positive answer but I want to know if
>> it's guaranteed to work or only happened to be working.
>>
>> Thanks!
>> Panruo Wu
>>
>> On Sat, Jul 14, 2012 at 1:30 PM, Panruo Wu <pwu at mymail.mines.edu> wrote:
>>
>>> Thank you Barry!
>>>
>>> Panruo
>>>
>>>
>>> On Sat, Jul 7, 2012 at 3:10 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>>
>>>>
>>>>    So long as you have the same boundary types and the same array sizes
>>>> in the i and j direction they give the same distribution.
>>>>
>>>>     Barry
>>>> On Jul 7, 2012, at 3:58 PM, Panruo Wu wrote:
>>>>
>>>> > Hello,
>>>> >
>>>> > If I create 2 DAs with (almost) identical parameters except DA name
>>>> > and dof like:
>>>> >
>>>> > call DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_GHOSTED,
>>>> > DMDA_BOUNDARY_GHOSTED, &
>>>> >   stype, M, N, m, n, dof1, s &
>>>> >   PETSC_NULL_INTEGER, PETSC_NULL_INTEGER, &
>>>> >   da1, ierr)
>>>> >
>>>> >
>>>> >
>>>> > call DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_GHOSTED,
>>>> > DMDA_BOUNDARY_GHOSTED, &
>>>> >   stype,  M, N, m, n, dof2, s &
>>>> >   PETSC_NULL_INTEGER, PETSC_NULL_INTEGER, &
>>>> >   da2, ierr)
>>>> >
>>>> >
>>>> > my question is, will the two DAs have the same distribution scheme?
>>>> > Specifically,
>>>> > will the DMDAGetCorners() give the same results when querying da1 &
>>>> da2?
>>>> >
>>>> > Thanks,
>>>> > Panruo Wu
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120716/941c1c31/attachment-0001.html>


More information about the petsc-users mailing list