How about in the inner block use a different array name<div>like array2?</div><div><br></div><div>Panruo Wu<br><br><div class="gmail_quote">On Sun, Jul 15, 2012 at 10:39 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div class="im">On Sun, Jul 15, 2012 at 11:20 PM, Panruo Wu <span dir="ltr"><<a href="mailto:pwu@mymail.mines.edu" target="_blank">pwu@mymail.mines.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Hello,</div><div><br></div>For some reason, it would be convenient for me to do something<div>like</div><div><br></div><div>call DMDAVecGetArrayF90(da, global, array, ierr)</div><div><br></div><div>call DMDAVecGetArrayF90(da, global, array, ierr)</div>
<div>! read-only access to array here.</div><div>call DMDAVecRestoreArrayF90(da, global, array,ierr)</div><div>! read&write access to array here.</div><div>call DMDAVecRestoreArrayF90(da, global, array, ierr)</div></blockquote>
<div><br></div></div><div>No, it is not okay to lie about the array status.</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
<br></div><div>Will this piece of code do what I expect? I wrote a simply</div><div>program which gave positive answer but I want to know if</div><div>it's guaranteed to work or only happened to be working.<br><br></div>
<div>Thanks!</div><div>Panruo Wu</div><div><br><div class="gmail_quote">On Sat, Jul 14, 2012 at 1:30 PM, Panruo Wu <span dir="ltr"><<a href="mailto:pwu@mymail.mines.edu" target="_blank">pwu@mymail.mines.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thank you Barry!<span><font color="#888888"><div><br></div></font></span><div><span><font color="#888888">Panruo</font></span><div>
<div><br><br><div class="gmail_quote">On Sat, Jul 7, 2012 at 3:10 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
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.<br>
<span><font color="#888888"><br>
Barry<br>
</font></span><div><div>On Jul 7, 2012, at 3:58 PM, Panruo Wu wrote:<br>
<br>
> Hello,<br>
><br>
> If I create 2 DAs with (almost) identical parameters except DA name<br>
> and dof like:<br>
><br>
> call DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_GHOSTED,<br>
> DMDA_BOUNDARY_GHOSTED, &<br>
> stype, M, N, m, n, dof1, s &<br>
> PETSC_NULL_INTEGER, PETSC_NULL_INTEGER, &<br>
> da1, ierr)<br>
><br>
><br>
><br>
> call DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_GHOSTED,<br>
> DMDA_BOUNDARY_GHOSTED, &<br>
> stype, M, N, m, n, dof2, s &<br>
> PETSC_NULL_INTEGER, PETSC_NULL_INTEGER, &<br>
> da2, ierr)<br>
><br>
><br>
> my question is, will the two DAs have the same distribution scheme?<br>
> Specifically,<br>
> will the DMDAGetCorners() give the same results when querying da1 & da2?<br>
><br>
> Thanks,<br>
> Panruo Wu<br>
<br>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div>
</blockquote></div></div></div><br>
</blockquote></div><br></div>