TAY wee-beng <[email protected]> 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)
pgp54g45WWdYy.pgp
Description: PGP signature
