[petsc-users] local row calculation in 3D
Randall Mackie
rlmackie862 at gmail.com
Mon Apr 18 09:25:19 CDT 2011
Here's how I do it:
do kk=zs,zs+zm-1
do jj=ys,ys+ym-1
do ii=xs,xs+xm-1
row=ii-gxs + (jj-gys)*gxm + (kk-gzs)*gxm*gym
Good luck,
Randy M.
On Mon, Apr 18, 2011 at 6:54 AM, ilyas ilyas <ilyascfd at gmail.com> wrote:
> Hi,
> Thank you for your suggestion. I will take it into account.
> Since changing this structure in my "massive" code may take too much time,
> I would like to know that how "row" is calculated in 3D, independently from
> processor numbers.
>
> Regards,
> Ilyas
>
> 2011/4/18 Matthew Knepley <knepley at gmail.com>
>
>> On Mon, Apr 18, 2011 at 8:34 AM, ilyas ilyas <ilyascfd at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> In ex14f.F in KSP, "row" variable is calculated either
>>>
>>
>> These are very old. I suggest you use the FormFunctionLocal() approach in
>> ex5f.F which
>> does not calculate global row numbers when using a DA.
>>
>> Matt
>>
>>
>>> 349: do 30 j=ys,ys+ym-1
>>> 350: ...
>>> 351: do 40 i=xs,xs+xm-1
>>> 352: row = i - gxs + (j - gys)*gxm + 1
>>>
>>> or
>>>
>>> 442: do 50 j=ys,ys+ym-1
>>> 443: ...
>>> 444: row = (j - gys)*gxm + xs - gxs
>>> 445: do 60 i=xs,xs+xm-1
>>> 446: row = row + 1
>>>
>>> How can I calculate "row" in 3D ?
>>>
>>> I tried this;
>>>
>>> do k=zs,zs+zm-1
>>> do j=ys,ys+ym-1
>>> do i=xs,xs+xm-1
>>>
>>> row = i - gxs + (j - gys)*gxm + (k - gzs)*gxm*gym + 1
>>>
>>> It does not work for certain number of processors.
>>>
>>>
>>> Thanks,
>>>
>>> Ilyas
>>>
>>
>>
>>
>> --
>> 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/20110418/6c37c1af/attachment.htm>
More information about the petsc-users
mailing list