[petsc-users] matrix preallocation

Barry Smith bsmith at mcs.anl.gov
Fri Oct 21 18:05:50 CDT 2016


   We don't currently have a MatReset  (corresponding to PCRest() etc) but it is the right thing for you in this situation I think.

   A shallow MatReset() would destroy all the matrix data structures but not the Layout information (likely you want this one) while a deep reset would even get rid of the size information and be like the matrix just came from MatCreate(). 

    If you want to start a MatReset() and post a pull request we can get it in. Note that you will need a MatReset_SeqAIJ() and a MatReset_MPIAIJ() to start with.

    Barry

> On Oct 21, 2016, at 4:51 PM, Kong, Fande <fande.kong at inl.gov> wrote:
> 
> Hi,
> 
> For mechanics problems, the contact surface changes  during each nonlinear iteration. Therefore, the sparsity of matrix also changes during each nonlinear iteration. We know the preallocaiton is important for performance.
> 
> My question is:  it is possible to re-allocate memory during each nonlinear iteration?
> 
> Fande



More information about the petsc-users mailing list