<div class="gmail_quote">On Wed, Jun 22, 2011 at 11:45, Milan Mitrovic <span dir="ltr"><<a href="mailto:milanm@student.ethz.ch">milanm@student.ethz.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":30r">Inside the multiplication routine I do this:<br>
<br>
CALL VecGhostUpdateBegin(from,INSERT_VALUES,SCATTER_FORWARD,info)<br>
CALL VecGhostUpdateEnd(from,INSERT_VALUES,SCATTER_FORWARD,info)<br></div></blockquote><div><br></div><div>This does update the ghost entries, right?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":30r">
<br>
! get ghosted versions of vectors<br>
CALL VecGhostGetLocalForm(from,xl,info)<br>
CALL VecSet(to,0.0_MK,info)<br>
! get arrays from petsc vectors<br>
CALL VecGetArray(xl,xx,xxi,info)<br>
CALL VecGetArray(to,yy,yyi,info)<br></div></blockquote><div><br></div><div>Is "to" a ghosted vector in which the residual should be the sum of contributions to all ghost copies (as in most finite element implementations)? If so, then you should</div>
<div><br></div><div>call VecGhostGetLocalForm(to,yl,info)</div><div>call VecGetArray(yl,yy,yyi,info)</div><div>...</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":30r">
<br>
Then I modify the data, and do the following:<br>
<br>
CALL VecRestoreArray(xl,xx,xxi,info)<br>
CALL VecRestoreArray(to,yy,yyi,info)<br>
! release local form of vectors<br>
CALL VecGhostRestoreLocalForm(from,xl,info)<br>
<br>
CALL VecGhostUpdateBegin(to,ADD_VALUES,SCATTER_REVERSE,info)<br>
CALL VecGhostUpdateEnd(to,ADD_VALUES,SCATTER_REVERSE,info)</div></blockquote></div><br><div>You can always test this by getting the local form, doing VecSet(yl,1.0), restore the local form, do the scatter above, and view to.</div>