<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000'>Thank you Matthew,<br>If I have understood:<br>- I have to pass to myMatMult global vecs. And Vec created with VecGhostCreate are global, right?<br>- In myMatMult I use VecGetArray, I store my result in the associated c-array, I call VecRestoreArray and the global vec is done! Right?<br>- If I re-use VecGetArray/VecRestore array, ghosted locations in the c-array are updated, right?<br>I'm sorry about confusion and thanks, again.<br><br>Marco<br><br><br><br><div><span name="x"></span>--<br>-----------------------------------------------<br>Marco Cisternino, PhD<br>Software Developer<br>OPTIMAD Engineering s.r.l.<br>Via Giacinto Collegno 18<br>10143 Torino - Italy<br>www.optimad.it<br>marco.cisternino@optimad.it<br>+39 011 19719782<br>-----------------------------------------------<span name="x"></span><br></div><br><hr id="zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>Da: </b>"Matthew Knepley" <knepley@gmail.com><br><b>A: </b>"Marco Cisternino" <marco.cisternino@optimad.it><br><b>Cc: </b>petsc-users@mcs.anl.gov<br><b>Inviato: </b>Lunedì, 19 gennaio 2015 16:40:28<br><b>Oggetto: </b>Re: [petsc-users] customized MatMult<br><br><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 19, 2015 at 9:28 AM, Marco Cisternino <span dir="ltr"><<a href="mailto:marco.cisternino@optimad.it" target="_blank">marco.cisternino@optimad.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt;color:#000000">Good morning,<br>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).<br><br>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.<br><br>Second question: if I have to, how? <br>Let's say I state:<br>ierr = myMatMult(A,x,y);<br>and x has been built out of myMatMult with VecGhostCreate.<br>How do I update ghost elements of y in myMatMult? VecGhostUpdateBegin/VecGhostUpdateEnd in myMatMult?<br><br>Any hints would be appreciated.<br></div></div></blockquote><div><br></div><div>There is some confusion here about the spaces that Vecs represent. Vecs in the solver are globally</div><div>assembled vectors, which come from the "global" space. Vecs used in calculated integrals, differences,</div><div>etc. for assembly often have ghost entries. We will say that these come from the "local" space.</div><div><br></div><div>MatMult takes in a global Vec x and returns a global Vec y.</div><div><br></div><div> Hopefully that is clear,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt;color:#000000">Thanks for you advices in advance.<br><br>Bests,<br><br>Marco<br></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>
</div><br></div></body></html>