On Wed, Jul 6, 2011 at 08:20, Barry Smith <bsmith at mcs.anl.gov> wrote:

> > >>  Do not call MatZeroEntries on a freshly created matrix (that destroys
> the preallocation pattern) so skip the MatZeroEntries the first time.
> > I found an earlier thread (
> http://lists.mcs.anl.gov/pipermail/petsc-users/2011-April/008566.html)
> where you said that it would not destroy the preallocation too.
> >
> > So is the behavior different in the dev version ?
>
>    Just try it.


PetscErrorCode MatZeroEntries_SeqAIJ(Mat A)
{
  Mat_SeqAIJ     *a = (Mat_SeqAIJ*)A->data;
  PetscErrorCode ierr;

  PetscFunctionBegin;
  ierr =
PetscMemzero(a->a,(a->i[A->rmap->n])*sizeof(PetscScalar));CHKERRQ(ierr);
  PetscFunctionReturn(0);
}

This does not touch indices, therefore it does not destroy preallocation
information. I can't think of a format where this operation would naturally
destroy the information.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110706/f9911022/attachment.htm>

Reply via email to