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

Barry Smith bsmith at mcs.anl.gov
Wed Feb 25 22:56:26 CST 2015


> On Feb 25, 2015, at 10:45 PM, Dmitry Karpeyev <karpeev at mcs.anl.gov> wrote:
> 
> 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()

Yes (this is in analogy to how KSPReset etc work, they clean out data objects but keep the options the user has selected for them)

> as well as MatFactorType and MatStencilInfo should be preserved,

  
Don't know about these.

> while MatRedundant and the (Near)NullSpace have to go.

  Yes

> What about the logging info? num_ass?

  Keep I think
>  Do we increment nonzerostate or reset it?

increment

>  The PetscObject state?

increment

> I don't know what to do about the GPU pointers.

I would clean those all out.
> 
> 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

   I agree it seems like 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.
> 




More information about the petsc-dev mailing list