Commits

Anonymous committed 71b23a6

added guards for PC UseAmat in PC_MG.

Hg-commit: 2fc7fd9974d23a05132e51224a8f8fa2b2c835ee

Comments (0)

Files changed (1)

src/ksp/pc/impls/mg/mg.c

   PetscErrorCode ierr;
   PetscInt       i,n = mglevels[0]->levels;
   PC             cpc;
-  PetscBool      preonly,lu,redundant,cholesky,svd,dump = PETSC_FALSE,opsset;
+  PetscBool      preonly,lu,redundant,cholesky,svd,dump = PETSC_FALSE,opsset,use_amat;
   Mat            dA,dB;
   MatStructure   uflag;
   Vec            tvec;
     ierr = KSPGetOperators(mglevels[n-1]->smoothd,NULL,&mmat,NULL);CHKERRQ(ierr);
     if (mmat == pc->pmat) opsset = PETSC_FALSE;
   }
-  if (!opsset) {
+  ierr = PCGetUseAmat(pc,&use_amat);CHKERRQ(ierr);
+  if (!opsset && use_amat) {
     ierr = PetscInfo(pc,"Using outer operators to define finest grid operator \n  because PCMGGetSmoother(pc,nlevels-1,&ksp);KSPSetOperators(ksp,...); was not called.\n");CHKERRQ(ierr);
     ierr = KSPSetOperators(mglevels[n-1]->smoothd,pc->mat,pc->pmat,pc->flag);CHKERRQ(ierr);
   }