In a somewhat related matter, it appears that I cannot duplicate a preallocated MATXXXAIJ until it has been assembled:<div>if my DM implementation keeps a preallocated MATSEQAIJ, which it wants to duplicate on every call to DMGetMatrix,</div>

<div>it would have to put in fake entries before any duplication is possible.</div><div><br></div><div>Dmitry.<br><div><div><br><div class="gmail_quote">On Thu, Feb 9, 2012 at 11:51 PM, Dmitry Karpeev <span dir="ltr"><<a href="mailto:karpeev@mcs.anl.gov">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 class="gmail_quote">Good point.  It is still strange, however, that SNES insists on using the same Mat obtained from DMGetMatrix for J and P.  </div>

<span class="HOEnZb"><font color="#888888"><div class="gmail_quote">Dmitry.</div></font></span><div class="HOEnZb"><div class="h5"><div class="gmail_quote">On Thu, Feb 9, 2012 at 11:46 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">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="gmail_quote"><div><div>On Thu, Feb 9, 2012 at 23:41, 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">
Currently DMGetMatrix(DM dm, MatType mattype , Mat *J)  is supposed to produce the system Jacobian, according to the docs.<div>SNES will use it, but, since DMGetMatrix returns a single matrix, it can't use a different preconditioning matrix.</div>





<div>Why not change this to DMGetMatrices(DM dm, MatType jtype, Mat *J, MatType  ptype, Mat *P)?</div><div>I'm not exactly sure what the best way of handling MatType should be (same MatType for J and P, separate types, how dm->mattype </div>





<div>affects the result), but I think it can be sorted out, whereas the absence of P is a clear limitation.</div></blockquote><div><br></div></div></div><div>Umm, this doesn't put in values, it just creates a matrix of the right size. You can make two if you want two different matrices.</div>



<div><br></div><div>If you are talking about DMDAFormJacobianLocal(), that does actually restrict what you can do, and you have to hack it a bit to use two different matrices (except by MFFD because the library specifically supports that).</div>



</div>
</blockquote></div><br>
</div></div></blockquote></div><br></div></div></div>