[petsc-users] INSERTVALUES after ADDVALUES

Satish Balay balay at mcs.anl.gov
Fri Oct 21 10:29:00 CDT 2011


On Fri, 21 Oct 2011, NAN ZHAO wrote:

> Dear all,
> 
> I am assembling a matrix using ADD_VALUES option, I need to insert certain
> values to the matrix cause I need to apply some boundary conditions. But I
> got the error
> [0]PETSC ERROR: Object is in wrong state!
> [0]PETSC ERROR: You have already added values; you cannot now insert!
> 
> Is anyone have a solution of this?

You would have to add MatAssemblyBegin/End(MAT_FLUSH_ASSEMBLY) when you
switch between ADD_VALUES and INSERT_VALUES [with a
MatAssemblyBegin/End(MAT_FINAL_ASSEMBLY) at the end of inserting/adding
all the necessary values in the matrix.

Satish


More information about the petsc-users mailing list