<br><br><div class="gmail_quote">On Fri, Feb 10, 2012 at 3:40 PM, 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 Fri, Feb 10, 2012 at 15:24, 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>So, as I understand, this behavior is reasonable for the use with SNES, since the matrix is assembled with a call to SNES(DM)ComputeJacobian. DMGetMatrix is also used with KSP, when it is also expected to assemble the matrix.</div>
</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>This seems to make the behavior of DMGetMatrix a bit schizophrenic and dependent on whether it is used from a SNES or a KSP. Should we try to unify this instead? One option is to assume that DMGetMatrix (or DMGetOperators) merely preallocates the matrix of a DM-preferred type, while a call to SNESDMComputeJacobian or (the new method) KSPDMFormOperators, respectively, would actually compute the values and assemble or do the equivalent thing for MF. In fact, one could unify this behavior already by treating linear problems as nonlinear.</div>
</blockquote></div><br></div><div>"DMGetMatrix" (which is spelled "DMCreateMatrix") allocates the matrix. It does not fill in the entries (except with zeros during preallocation).</div><div><br></div>
<div><br>
</div><div>The concept of creating a preconditioning matrix with different sparsity is actually hacky to deal with now. I have various code where I make a complete copy of a STENCIL_BOX or stencil_width=2 DM, changing these values to STENCIL_STAR or stencil_width=1, just so I can call DMCreateMatrix(). Unfortunately, I don't know a nice way to do this at the generic DM level.</div>
</blockquote><div> </div><div>Why not simply allow DM to return two matrices as SNES and KSP would want anyway? </div><div>Dmitry.</div></div><br>