<br><br><div class="gmail_quote">On Sat, Feb 11, 2012 at 8:36 AM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><div class="gmail_quote">On Sat, Feb 11, 2012 at 08:32, Dmitry Karpeev <span dir="ltr"><<a href="mailto:karpeev@mcs.anl.gov" target="_blank">karpeev@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>This sounds fine to me, but what's the API for doing this? You want to do KSPSetDM() and PCSetDM(), </div><div>so that the user has to explicitly pull out the PC to set its DM?</div></blockquote></div><br></div>
<div>The PC *always* owns both matrices anyway.</div></blockquote><div><br></div><div>I think there is a rather natural API for handling DM grouping, code reuse and dealing with the issue of single matrix per DM:</div><div>
DM should support DMGetKSPDM(), DMGetPCDM() -- similar to DMDAGetCoordinateDA() -- each of which will compute the correct matrix. These calls can return the original DM (or PETSC_NULL) by default. SNES will pull out the KSP DM out to set it on the KSP, KSP will do the same for the PC, etc. DM already has Vec x, so all of the DMs can share x and compute their respective matrices at the same x and reuse whatever computation is reusable. That's up to the implementation, though.</div>
<div><br></div><div>Dmitry.</div></div><br>