[petsc-users] Use of DMDAVecGetArrayF90 and DMDAVecRestoreArrayF90

Matthew Knepley knepley at gmail.com
Tue Nov 10 06:27:10 CST 2015


On Tue, Nov 10, 2015 at 3:27 AM, TAY wee-beng <zonexo at gmail.com> wrote:

> Hi,
>
> Inside my subroutine, I need to access the DA variable cu_types_array
> frequently.
>
> So I need to call DMDAVecGetArrayF90 and DMDAVecRestoreArrayF90 before and
> after frequently.
>
> Is this necessary? Can I call DMDAVecGetArrayF90 at the start and only
> call DMDAVecRestoreArrayF90 towards the end, where I don't need to modify
> the values of cu_types_array anymore?
>
> Will this cause memory corruption?
>

You cannot use any other vector operations before you have called Restore.


> Also, must the array be restored using DMDAVecRestoreArrayF90 before
> calling DMLocalToLocalBegin,DMLocalToLocalEnd?


Yes.

  Matt


>
> --
> Thank you.
>
> Yours sincerely,
>
> TAY wee-beng
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20151110/c3baf0d3/attachment.html>


More information about the petsc-users mailing list