[petsc-dev] What should MatReset() do?

Dmitry Karpeyev karpeev at mcs.anl.gov
Wed Feb 25 22:45:29 CST 2015


Since user callbacks, such as the one to compute the Jacobian, are now
supposed to modify matrices in place, we need to provide the equivalent of
MatReset() so that the user can do things like reset the sparsity pattern,
etc. What should that call do?

I assume it would keep the type, sizes and the block size of the matrix and
reset everything else.   The impl-specific stuff is handled by
MatDestroy(), but what about the generic data members?  I imagine that the
structural properties, such as symmetry and others set with MatSetOption()
as well as MatFactorType and MatStencilInfo should be preserved, while
MatRedundant and the (Near)NullSpace have to go. What about the logging
info? num_ass?  Do we increment nonzerostate or reset it?  The PetscObject
state? I don't know what to do about the GPU pointers.

While MatReset() isn't yet available,  MatSetType(mat,newtype);
MatSetType(mat,oldtype); should have the same effect,
but it doesn't, which to me is a bug and I'd like to fix it in maint.
It would be good, however, to do it "right" by answering the questions above.
Any opinions?

Dmitry.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20150226/65045c46/attachment.html>


More information about the petsc-dev mailing list