On Sat, Jan 21, 2012 at 14:46, Barry Smith <bsmith at mcs.anl.gov> wrote:

>    That patch is hideous, introduced more complexity.
>
>    Why not  in MatSetUpPreallocation() add the one line
>
>  if (!B->preallocated && B->ops->setuppreallocation) {
>    ierr = PetscInfo(B,"Warning not preallocating matrix
> storage\n");CHKERRQ(ierr);
>    ierr = (*B->ops->setuppreallocation)(B);CHKERRQ(ierr);
>    ierr =
> MatSetOption(B,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr);
>

This was my first inclination, but


1. DisAssemble_*() functions call preallocation routines again, but the
values they use still aren't correct, so we have to avoid setting the
options.

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.)

3. I didn't want to overwrite a user setting the option manually (perhaps
with intent to preallocate).


> that turns of the alloc error, note this only happens if the user did not
> preallocate.
>
>   What do you say? Revert  that ugly code and add only one line of code?
>
>   Barry
>
> Note that it makes no sense for the user to not preallocate but then to
> set the error on alloc flag.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120121/457d8383/attachment.html>

Reply via email to