On Mon, Aug 20, 2012 at 9:53 AM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote"><div class="im">On Mon, Aug 20, 2012 at 9:49 AM, Toby Isaac <span dir="ltr"><<a href="mailto:tisaac@ices.utexas.edu" target="_blank">tisaac@ices.utexas.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I have finite element code, developed outside of PETSc thus far, with matrix-free operators. I've written the operators so that they expect ghosted input vectors and return ghosted output vectors.<br>
<br>
I know that I can write a MatShell that creates a temporary ghosted versions of the input Vec and output Vec and calls my operators on these. What I want to know is if there is any way to work in place, i.e. write a MatShell that expects ghosted inputs/outputs. This would also require KSP methods to work with ghosted vectors and only use the locally-owned variables in the dot products.<br>
</blockquote><div><br></div></div><div>You can write one that expects VecGhost (or your own vector type). To do that, you usually want to implement MatGetVecs() and make sure solvers get passed ghosted initial vectors. Then MatMult_YourShell() uses VecGhostUpdateBegin()/End, VecGhostGetLocalForm(), your local evaluation into the residual vector, VecGhostRestoreLocalForm(), and VecGhostUpdateBegin() to finish assembling the residual vector.</div>
</div>
</blockquote></div><br>Personally, I think this is quite cumbersome compared to the Local/Global vector strategy we use in DM, and<div>does not have any real advantages.</div><div><br></div><div> Matt<br clear="all"><div>
<br></div>-- <br>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<br>
</div>