Afraid this problem has arisen for me again. My previous solution depended on being able to not finalize the tensor then add the zeros in after the first assembly but before collapsing the sparsity. The addition of:
MatSetOption(*A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_TRUE);
in PetscMatrix::init in r6784-5 has meant that this is no longer possible.
I've had another go at implementing a fix (see lp:~ldeo-magma/dolfin/diagonalentries ) that includes the diagonal in the sparsity and sets zeros in the matrix to ensure they're not collapsed out. It's controlled by the parameter keep_diagonal, which can be passed into any assembly routine (that calls init_global_tensor) but defaults to the current behaviour (false). This is all based on the changes to incorporate periodic bcs into the sparsity.
Afraid this problem has arisen for me again. My previous solution depended on being able to not finalize the tensor then add the zeros in after the first assembly but before collapsing the sparsity. The addition of: NONZERO_ ALLOCATION_ ERR, PETSC_TRUE);
MatSetOption(*A, MAT_NEW_
in PetscMatrix::init in r6784-5 has meant that this is no longer possible.
I've had another go at implementing a fix (see lp:~ldeo-magma/dolfin/diagonalentries ) that includes the diagonal in the sparsity and sets zeros in the matrix to ensure they're not collapsed out. It's controlled by the parameter keep_diagonal, which can be passed into any assembly routine (that calls init_global_tensor) but defaults to the current behaviour (false). This is all based on the changes to incorporate periodic bcs into the sparsity.
Cheers,
Cian