<div dir="ltr">On Fri, Oct 11, 2013 at 7:50 AM, Åsmund Ervik <span dir="ltr"><<a href="mailto:asmund.ervik@ntnu.no" target="_blank">asmund.ervik@ntnu.no</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi again,<br>
<br>
I am using a 3D DMDA and I want to extract the bounds for the local<br>
domain. For some reason, DMDAGetGhostCorners gives me the wrong<br>
numbers. Consider this code:<br>
<br>
    call DMCreateLocalVector(SolScal,Lpressure,ierr)<br>
    call DMDAVecGetArrayF90(SolScal,Lpressure,array,ierr)<br>
    tmp=shape(array)<br>
    call DMDAVecRestoreArrayF90(SolScal,Lpressure,array,ierr)<br>
    call DMDAGetGhostCorners(SolScal,i,j,k,m,n,p,ierr)<br>
    write(*,*) tmp(2:)<br>
    write(*,*) m-i,n-j,p-k<br>
<br>
I.e. I create a local array and inquire about it's shape, and then I<br>
get info from DMDAGetGhostCorners. So the two last lines should print<br>
the same, but they don't:<br>
<br>
mpirun -np 2 meph<br>
          25          26          50<br>
          25           2          50<br>
          25          26          50<br>
          25          26          50<br>
<br>
Note the difference between the first and second lines.<br>
<br>
Am I using DMDAGetGhostCorners wrong here, or what?<br></blockquote><div><br></div><div>Yes. n-j does not mean anything. n is the local size, whereas j is the global y offset.</div><div><br></div><div>   Matt</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Best regards,<br>
Åsmund Ervik<br>
<br>
<br>
<br>
On 07. okt. 2013 17:55, Jed Brown wrote:<br>
> Åsmund Ervik <<a href="mailto:asmund.ervik@ntnu.no">asmund.ervik@ntnu.no</a>> writes:<br>
>> Thanks for this comment; I have been suspecting this is a bad<br>
>> idea, nice to get confirmation. I will follow your advice.<br>
><br>
> Cool.<br>
><br>
>> Other than that, does the mapping from local to global using<br>
>> Fortran assumed-shape arrays make sense, or is there a better way<br>
>> of doing it?<br>
><br>
> It looks okay to me.<br>
><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>