<div class="gmail_quote">On Sat, Jan 21, 2012 at 14:46, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@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 id=":1oy">   That patch is hideous, introduced more complexity.<br>
<br>
    Why not  in MatSetUpPreallocation() add the one line<br>
<br>
  if (!B->preallocated && B->ops->setuppreallocation) {<br>
    ierr = PetscInfo(B,"Warning not preallocating matrix storage\n");CHKERRQ(ierr);<br>
    ierr = (*B->ops->setuppreallocation)(B);CHKERRQ(ierr);<br>
    ierr = MatSetOption(B,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr);<br></div></blockquote><div><br></div><div>This was my first inclination, but</div><div><br></div><div><br></div><div>1. DisAssemble_*() functions call preallocation routines again, but the values they use still aren't correct, so we have to avoid setting the options.</div>
<div><br></div><div>2. Users call preallocation directly (often through MatCreateMPIAIJ(), etc) with PETSC_DECIDE. In my opinion, they should see an error for not preallocating correctly. (But if you think they should have to say twice that they aren't preallocating correctly---by calling MatSetOption(), I can remove that uglyness.)</div>
<div><br></div><div>3. I didn't want to overwrite a user setting the option manually (perhaps with intent to preallocate).</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":1oy">
<br>
that turns of the alloc error, note this only happens if the user did not preallocate.<br>
<br>
   What do you say? Revert  that ugly code and add only one line of code?<br>
<br>
   Barry<br>
<br>
Note that it makes no sense for the user to not preallocate but then to set the error on alloc flag.</div></blockquote></div><br>