[petsc-users] DMDAVecGetArray vs DMDAVecRestoreArray

Alan Wei zhenglun.wei at gmail.com
Thu Aug 18 17:02:01 CDT 2011


Dear all,
    I hope you're having a nice day.
    I'm trying to get the x, y-value of a coordinate created by
DMDACreate2d. Lines I wrote down are:

  DMDAGetCoordinateDA(da, &cda);
  DMDAGetGhostedCoordinates(da, &gc);
  DMDAVecGetArray(cda, gc, &coors);

  for (i = xs; i < xs+xm; i++) {
    for (j = ys; j < ys+ym; j++) {
      printf("%f  %f\n", coors[j][i].x, coors[j][i].y);
    }
  }

  DMDAVecRestoreArray(cda, gc, &coors);

I wonder why I need to use "DMDAVecRestoreArray(cda, gc, &coors);" I used it
because the manual said I need. Actually, I tried to comment it out and
there is no difference.

Thanks,
Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110818/287758ff/attachment.htm>


More information about the petsc-users mailing list