[petsc-users] Can I use MAT_FINAL_ASSEMBLY instead of MAT_FLUSH_ASSEMBLY?

Rongliang Chen rongliang.chan at gmail.com
Tue Nov 9 11:27:32 CST 2010


   Message: 2

> Date: Mon, 8 Nov 2010 19:57:16 -0600
> From: Barry Smith <bsmith at mcs.anl.gov>
> Subject: Re: [petsc-users] Can I use MAT_FINAL_ASSEMBLY instead of
>        MAT_FLUSH_ASSEMBLY?
> To: PETSc users list <petsc-users at mcs.anl.gov>
> Message-ID: <52AFD8FB-17C1-4B51-97E9-C77112B69F3C at mcs.anl.gov>
> Content-Type: text/plain; charset=us-ascii
>
>
> On Nov 8, 2010, at 7:49 PM, Rongliang Chen wrote:
>
> > Hi everyone,
> >
> > Can I use MAT_FINAL_ASSEMBLY instead of MAT_FLUSH_ASSEMBLY in the
> function MatAssemblyBegin/End when switching between ADD_VALUES and
> INSERT_VALUES in MatSetValues()?  Thank you!
> >
> > Regards,
> >
> > Rongliang
>
> Yes, but generally there is no reason to. It is best to use the flush until
> your final assembly because then it doesn't do any work that needs to be
> redone or prematurely free memory that may be needed later.
>
> Why do you want to do that?
>
>   Barry
>
>
>
Hi Barry,

Thank you for your reply. I find that when I use MAT_FINAL_ASSEMBLY instead
of MAT_FLUSH_ASSEMBLY in the function MatAssemblyBegin/End, it will
 cause problem. I do not know why.

The reason that I want to use it like this is that I first set the matrix
with ADD_VALUES and then I need to zero some rows of the matrix using
MatZeroRowsLocalIS(), at last I still need to set some elements of the
matrix with INSERT_VALUES. Between MatSetValues() and MatZeroRowsLocalIS() I
need to use MAT_FINAL_ASSEMBLY.
The order is:
ADD_VALUES--->MatZeroRowsLocalIS()--->INSERT_VALUES.

Thanks!

Regards,

Rongliang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20101109/c24d062a/attachment.htm>


More information about the petsc-users mailing list