[petsc-users] customized MatMult

Marco Cisternino marco.cisternino at optimad.it
Mon Jan 19 09:28:44 CST 2015

Good morning, 
I'm writing my MatMult function, but I don't know how to treat the ghost elements of the result vec. Let's say myMatMult(A,x,y). 

First question is: if I use my MatMult in a KSP to solve a linear system, do I have to update ghost elements in the result vec of MatMult?? Consider that any time the code enters myMatMult the vec x is copied in my container and the ghost of my container are updated. I made computation for matrix-vector and I copied the results in vec y, without considering ghost elements of y. 

Second question: if I have to, how? 
Let's say I state: 
ierr = myMatMult(A,x,y) ; 
and x has been built out of myMatMult with VecGhostCreate. 
How do I update ghost elements of y in myMatMult? VecGhostUpdateBegin/VecGhostUpdateEnd in myMatMult? 

Any hints would be appreciated. 
Thanks for you advices in advance. 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150119/f6deffba/attachment.html>

More information about the petsc-users mailing list