[petsc-users] Question on non-zero pattern

Satish Balay balay at mcs.anl.gov
Thu Mar 14 14:52:56 CDT 2013


But you might have mallocs with the new nonzero structure. Its proably
more efficient to destroy/create a new mat with the new structure.

Satish

On Thu, 14 Mar 2013, Sanjay Govindjee wrote:

> Found my answer, use
> 
>           call MatSetOption(Kmat,MAT_NEW_NONZERO_LOCATIONS,PETSC_TRUE,ierr)
> 
> after the MatAssemblyEnd( ).
> 
> 
> On 3/14/13 11:28 AM, Sanjay Govindjee wrote:
> > Is there a mechanism for resetting a matrix's non-zero pattern?
> > 
> > In particular,  I have a preallocated a matrix, set the values, and
> > assembled it.
> > And used it to solve a problem.
> > 
> > Now I would like to zero it, and reassemble it with a different non-zero
> > pattern.
> > Note the matrix has been preallocated so that it can accommodate both
> > non-zero
> > patterns.
> > 
> > -sanjay
> 
> 



More information about the petsc-users mailing list