[petsc-users] Questions abt DM and DMDALocalToLocalBegin / End
TAY wee-beng
zonexo at gmail.com
Sun Apr 6 21:59:21 CDT 2014
Hi Jed,
Thanks for the clarifications.
Yours sincerely,
TAY wee-beng
On 7/4/2014 10:54 AM, Jed Brown wrote:
> TAY wee-beng <zonexo at gmail.com> writes:
>
>> On 7/4/2014 10:40 AM, Jed Brown wrote:
>>> but might not be
>>> negligible if called once for each degree of freedom.
>> Sorry I don't understand this sentence.
>>
>> So you mean if I have 3 dof u,v,w, it will not be cheap if I access and
>> restore it many times. Is that so?
> It means that you should not do this:
>
> do k=1,zm
> do j=1,ym
> do i=1,zm
> call DMDAVecGetArrayF90(... x,ierr)
> x(i,j,k) = something
> call DMDAVecRestoreArrayF90(... x,ierr)
> end
> end
> end
>
> Lift the call out of the loop.
>
> call DMDAVecGetArrayF90(... x,ierr)
> do k=1,zm
> do j=1,ym
> do i=1,zm
> x(i,j,k) = something
> end
> end
> end
> call DMDAVecRestoreArrayF90(... x,ierr)
More information about the petsc-users
mailing list