Perhaps this is a valid fix

-      if (missing) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Matrix 
is missing diagonal entry in row %D",d);
+      if (missing) {
+        for (i=0; i<N; i++) {
+          if (rows[i] == d) 
SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Cannot insert diagonal 
value! Matrix is missing diagonal entry in row %D",d);
+        }
+      }

> On Jan 18, 2017, at 6:58 PM, Eric Chamberland 
> <[email protected]> wrote:
> 
> Hi,
> 
> we are calling MatZeroRows_SeqAIJ (petsc 3.7.5) with:
> 
> N=3
> 
> rows[0]=15
> rows[1]=30
> rows[2]=65
> 
> diag = 1
> x=0
> b=0
> 
> and (Mat_SeqAIJ*)A->data->keepnonzeropattern is true.
> 
> but MatMissingDiagonal_SeqAIJ finds a missing diagonal at line 1 and then 
> return on error here:
> 
> if (missing) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Matrix is 
> missing diagonal entry in row %D",d);
> 
> with d=1
> 
> I understand that MatZeroRows verify all the lines for missing diagonals with 
> MatMissingDiagonal_SeqAIJ, even if I try to zero only some lines.
> 
> Is that the wanted behavior?
> 
> Thanks,
> 
> Eric

Reply via email to