[petsc-dev] who broke petsc-dev
Barry Smith
bsmith at mcs.anl.gov
Sun Nov 13 16:36:07 CST 2011
PetscErrorCode KSPSetOperators(KSP ksp,Mat Amat,Mat Pmat,MatStructure flag)
{
MatNullSpace nullsp;
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(ksp,KSP_CLASSID,1);
if (Amat) PetscValidHeaderSpecific(Amat,MAT_CLASSID,2);
if (Pmat) PetscValidHeaderSpecific(Pmat,MAT_CLASSID,3);
if (Amat) PetscCheckSameComm(ksp,1,Amat,2);
if (Pmat) PetscCheckSameComm(ksp,1,Pmat,3);
if (!ksp->pc) {ierr = KSPGetPC(ksp,&ksp->pc);CHKERRQ(ierr);}
ierr = PCSetOperators(ksp->pc,Amat,Pmat,flag);CHKERRQ(ierr);
if (ksp->setupstage == KSP_SETUP_NEWRHS) ksp->setupstage = KSP_SETUP_NEWMATRIX; /* so that next solve call will call PCSetUp() on new matrix */
if (ksp->guess) {
ierr = KSPFischerGuessReset(ksp->guess);CHKERRQ(ierr);
}
ierr = MatGetNullSpace(Amat, &nullsp);CHKERRQ(ierr);
if (nullsp) {
ierr = KSPSetNullSpace(ksp, nullsp);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
1) It is legitimate to call KSPSetOperators with a null Amat so this is a bug that crashes large parts of PETSc
2) Do you really want to do this? I am not sure I like it.
More information about the petsc-dev
mailing list