[petsc-users] Questions abt DM and DMDALocalToLocalBegin / End
Jed Brown
jed at jedbrown.org
Sun Apr 6 21:54:48 CDT 2014
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140406/b1052324/attachment.pgp>
More information about the petsc-users
mailing list