Re: [petsc-users] MAT_NEW_NONZERO_LOCATION_ERR

2019-10-10 Thread Thibaut Appel via petsc-users
Hi Hong, Thank you that was unclear to me, now I understand its purpose! Thibaut On 08/10/2019 16:18, Zhang, Hong wrote: Thibaut : Sorry, I did not explain it clearly. You call MatSetOption(A,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE); AFTER matrix is assembled. Then no more new zero is allowed

Re: [petsc-users] MAT_NEW_NONZERO_LOCATION_ERR

2019-10-08 Thread Zhang, Hong via petsc-users
Thibaut : Sorry, I did not explain it clearly. You call MatSetOption(A,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE); AFTER matrix is assembled. Then no more new zero is allowed to add/insert. For example, I add following in petsc/src/ksp/ksp/examples/tutorials/ex1.c: ierr = MatAssemblyBegin(A,MAT_

Re: [petsc-users] MAT_NEW_NONZERO_LOCATION_ERR

2019-10-08 Thread Thibaut Appel via petsc-users
Well, try and create a small SEQAIJ/MPIAIJ matrix and preallocate memory for the diagonal. When I try to call MatSetValues to fill the diagonal, on the first row I get [0]PETSC ERROR: Argument out of range [0]PETSC ERROR: Inserting a new nonzero at (0,0) in the matrix Which is within my prea

Re: [petsc-users] MAT_NEW_NONZERO_LOCATION_ERR

2019-10-08 Thread Zhang, Hong via petsc-users
Thibaut: Hi, Just out of curiosity, I'm a bit confused by the parameter option MAT_NEW_NONZERO_LOCATION_ERR. It triggers an error if you try to insert/add a value in the non-zero structure, regardless of the matrix preallocation status. In what case would such an option be useful? It triggers a

[petsc-users] MAT_NEW_NONZERO_LOCATION_ERR

2019-10-08 Thread Thibaut Appel via petsc-users
Hi, Just out of curiosity, I'm a bit confused by the parameter option MAT_NEW_NONZERO_LOCATION_ERR. It triggers an error if you try to insert/add a value in the non-zero structure, regardless of the matrix preallocation status. In what case would such an option be useful? Thank you, Thib